Files

Create a file

Reserve an input file and get an upload URL.

POST/v1/files

Authorization

Authorizationstringheaderrequired
Bearer ast_gw_.... The key needs the files:write scope.

Reserves a file and returns a URL to upload its bytes to. After you PUT the bytes, use file_id in a job's input. See Input files.

Headers

Idempotency-Keystringheaderrequired
A unique value per new request, 1 to 200 visible ASCII characters. Reuse it only to retry the same request. See Idempotency.

Body

filenamestringrequired
1 to 255 characters. Only for display; it doesn't choose where the file is stored.
mime_typestringrequired
One of the supported types.
size_bytesintegerrequired
Exact size in bytes. At most 200 MB.

Response

file_idstring
Use as { "file_id": "..." } in a job input once uploaded.
statusstring
awaiting_upload until the bytes arrive.
upload.urlstring
Where to PUT the bytes. Don't send your API key there.
upload.headersobject
Send exactly these headers with the PUT.
upload.expires_atstring
The upload URL stops working after this (15 minutes).
retention_days_after_uploadinteger
Days until the file is deleted.

Replaying the same idempotency key returns the same file_id with a fresh upload URL. A completed upload can't be overwritten.