Files
Create a file
Reserve an input file and get an upload URL.
POST
/v1/filesAuthorization
AuthorizationstringheaderrequiredBearer ast_gw_.... The key needs thefiles:writescope.
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. statusstringawaiting_uploaduntil the bytes arrive.upload.urlstring- Where to
PUTthe 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.