Sudden 400 error on file upload endpoint

Currently getting a 400 error when trying to upload a file at the endpoint /v1/files when it worked previously.

Is anybody else encountering this right now?

1 Like

Welcome to the dev forum @atlascardengineering

Sharing the API call code would be helpful in diagnosing the issue.

1 Like

Same here, the error message “There was an error uploading the file: Invalid file format for Fine-Tuning API. Must be .jsonl” is raised when I actually try to upload a standard .jsonl file which I could upload successfully yesterday… Strange.

image

Detailed error 400 : “You didn’t provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY). You can obtain an API key from https://platform.openai.com/account/api-keys.”
Strange as I am trying to upload this file through the web interface…

Problem seemed to be an encoding problem on my side.
I switched the format of my files from “UTF-8-BOM” to “UTF-8” and everything is now working fine for me :slight_smile:
Maybe try this as well @atlascardengineering?

curl --location ‘v1/files’
–form ‘file=@“text_file.txt”’
–form ‘purpose=“fine-tune”’

Here’s the correct cURL call for file upload:

curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F purpose="fine-tune" \
  -F file="@mydata.jsonl"