Batch API - Upload multiple images using direct upload

Hey,

I’m trying to upload multiple images using the direct upload api using the batch api But I keep getting a 400 error whenever I use the batchToken.

I’m following the step outlined in the docs:

  1. Request batch token
  2. Request direct upload url using batch token x

Could someone help me understand what I’m doing wrong?

Links:

Hey, what is your request look like? you can DM.

1 Like

@asemiglazov Thanks for the reply!

Here’s an example using httpie:

## Get batch token
http -A bearer -a PERSONAL_API_TOKEN POST https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/images/v1/batch_token

## Upload multiple images using batch token
http --multipart -A bearer -a BATCH_API_TOKEN POST https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/images/v1 photo1@'~fooPhoto.jpg;type=image/jpg' photo2@'~barPhoto.jpg;type=image/jpg'

This topic was automatically closed after 15 days. New replies are no longer allowed.

Sorry for late reply, but to keep it for future references: batch api only allows to send API request bypassing Cloudflare rate-limiting, you still need to send one request per image, it doesn’t support multi file upload