Forum Academy Marketplace Showcase Pricing Features

Uploading file via API

I’m trying to upload a file via API. Here is the documentation: | apis

Request should look like:
curl -X POST
-H “Key: YOUR_KEY”
-F “file=@The_Solar_System.mp4”

And this is what I have (key removed for privacy):

Yet I am receiving the error:
There was an issue setting up your call.
Raw response for the API
Status code 400

I have a feeling it has to do with the way the file is called, but looking for someone else’s input.
Its my first time with cURL and it was going great until this file upload!

you don’t provide the file at all and you enter a curl parameter in body that won’t work.
Delete content type header, change Body type to Form-data and add a parameter “file” and select file for the type.

Upload a file to the file field and initialize. It should work

WOW worked like a charm. Thank you so much!!

1 Like

Hello. I managed to make it available as an editor. it would be very useful

Hey @Jici , I am trying to do what you suggested for OpenAI fine tunning

But I am getting this error


Adding the header:

Content-Type: application/json

generates the same error.

Any help would be appreciated! Thanks!

@pachocastillosr Do multipart/form-data for the Content-type

1 Like

Thanks for replying @tylerboodman ! This is what I got:


Oops I didn’t read the whole response, yes sorry use appliation/json, but according to OpenAI’s docs you have to upload the file first like the solution in this post.

Then when it returns the file ID that’s what you send to the call you are trying to make but in a standard JSON body, not Form-data


Upload file using a post to and it will give you a file ID that you will use in further call


You are both right, thanks a lot! @tylerboodman @Jici


How i can upload the file dynamically from the user


Same problem here, and no answers found.

1 Like

Try to get the curl from the api provider

Its works for me

I’m trying to use Stability API image-to-image generation, and the cURL they give it’s this one.
Though I’m still unsure how this solves my issue of dynamically sending users image uploading images. All help is much welcome.


curl -f -sS -X POST "$URL" \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: image/png' \
  -H "Authorization: Bearer $STABILITY_API_KEY" \
  -F 'init_image=@"../init_image.png"' \
  -F 'init_image_mode=IMAGE_STRENGTH' \
  -F 'image_strength=0.35' \
  -F 'text_prompts[0][text]=A galactic dog in space' \
  -F 'cfg_scale=7' \
  -F 'clip_guidance_preset=FAST_BLUE' \
  -F 'samples=1' \
  -F 'steps=30' \

Did you check import curl in the Api connector