Skip to content
中文

Limits and errors

Limits

ItemLimit
Single file, direct upload (one request)100,000,000 bytes; empty files are rejected
Single file, multipart upload20 GiB
File storage quota20 GiB (21,474,836,480 bytes), shared by files in the account
OpenAI expires_afteranchor: "created_at", 3,600–2,592,000 seconds (1 hour–30 days)
Native expires_after3,600–7,776,000 seconds (1 hour–90 days)
Anthropic form expires_in_seconds3,600–7,776,000 seconds (1 hour–90 days)

Choose one expiry setting. Anthropic expires_in_seconds belongs in the form body; as a query parameter it returns 400. See upload parameters.

Signed uploads

Take the upload addresses, part size and complete_url from the createSigned response; do not hard-code them.

Errors on the completion path

Branch on code, not only on the HTTP status.

SituationStatus and codeWhat the client should do
The upload record does not exist (expired and cleaned up, or not in this account)404 FILE_NOT_FOUNDCall createSigned again and upload from the start
The token is invalid, revoked or from another account (the signature does not hold, it was revoked, or the upload is not in this account)404 FILE_NOT_FOUNDCall createSigned again
The link is genuine but the action is wrong: POST to status_url, or GET to complete_url403 CAPABILITY_MISMATCHDo not swap the two links; use each as issued
The entry named in the token is not the entry the upload belongs to403 ENTRY_MISMATCHUse all links of one session on the same entry; do not forward across entries
The session has expired410 UPLOAD_EXPIRED (same for status_url and complete_url)Call createSigned again
Some parts are still missing400 UPLOAD_PARTS_INVALIDGET status_url to see which part is missing, upload it, then complete
Already completed, POSTed again201 with the same file as the first timeTreat it as the result of the first call

Unknown fields

The compatible APIs reject unknown arguments the way their vendors do instead of ignoring them:

APIAccepted argumentsAnything else
Anthropic uploadForm file, expires_in_seconds; query beta only400 invalid_request_error, e.g. purpose: Extra inputs are not permitted
OpenAI uploadForm file, purpose, expires_after[anchor], expires_after[seconds]; no query parameters400 invalid_request_error, e.g. Unrecognized request argument supplied: foo, with param naming the field
OpenAI listQuery after, order, limit, purposeSame as above

The scope_id extension is available on the native file API.

Content detection accepts PDF, DOCX/XLSX/PPTX, PNG/JPEG/GIF/WebP, supported audio and video, and UTF-8 text. A filename extension does not make arbitrary binary data acceptable.

Errors

ErrorWhat to do
PURPOSE_UNSUPPORTEDSupply user_data or vision.
FILE_EMPTYUpload a nonempty file.
FILE_TOO_LARGEHTTP 413: keep the file within the direct-upload byte limit above.
FILE_TYPE_UNSUPPORTEDUse a supported content type; renaming the extension is insufficient. purpose=vision accepts only images, and a corrupt Office document or ZIP archive also returns this error.
VALIDATION_ERRORCheck the filename and expiry parameters.
QUOTA_EXHAUSTEDDelete unneeded files before uploading more.
HTTP 404Check the ID, account and whether the file has expired or been deleted.
File is not an eligible imageFor conversation input, upload a supported image with purpose=user_data.

Oversized requests can be rejected by the edge with HTTP 413 and an HTML body before the file API returns JSON. Handle the HTTP status before decoding an error body.

API reference → · Cookbook →