Get an upload URL for each file of a session's input.

POST/o/{org}/files
View .md

Name each file and its type, then PUT its bytes to the upload_url that comes back, straight to storage and in parallel if you like, with the same Content-Type as its mime_type. There is no size field and no size limit here: one PUT takes a file up to 5 GB. An upload_url is good for an hour. Pass each id as a {"type": "file", "source": {"type": "file", "file_id": id}} block in a session's or a follow-up's input. When the session starts, each file's bytes are checked against its type and its size is read from storage; a file never uploaded is refused there with 409 ATTACHMENT_NOT_UPLOADED. At most 50 files per call. Rate-limited to 30 calls a minute per caller.

Authenticate with a signed-in session token (an API key cannot call this route).

Path parameters

orgstringrequired

The org's slug or id. A caller with no role in the org gets 404.

Request body

filesarray of objectrequired
2 item fields
namestringrequired

The file name in the sandbox. No /, \, .., leading ., or control characters.

at most 255 characters
mime_typestringrequired

The file's media type. Send it as the Content-Type of the PUT.

Responses

201An upload URL per file, in the order asked for.
filesarray of objectrequired
5 item fields
idstringrequired
Format uuid
namestringrequired
mime_typestringrequired
upload_urlstringrequired

A signed URL to PUT the file to, with Content-Type: <mime_type>.

Format uri
upload_expires_atstringrequired
Format date-time
400Not the JSON shape above, a multipart/form-data body or a size field (INVALID_BODY, naming the shape), an invalid name or type, or more than 50 files (TOO_MANY_FILES).
errorstringoptional

A sentence for a person.

codestringoptional

Stable machine code, e.g. AUTH_FAILED, NOT_FOUND, VALIDATION_ERROR, RATE_LIMITED, TOKEN_LIMIT_REACHED.

error_codestringoptional

The machine code on routes that name it this way.

messagestringoptional
requestIdstringoptional
401No bearer, an unknown, revoked or expired one, or an API key on a route keys cannot call.
errorstringoptional

A sentence for a person.

codestringoptional

Stable machine code, e.g. AUTH_FAILED, NOT_FOUND, VALIDATION_ERROR, RATE_LIMITED, TOKEN_LIMIT_REACHED.

error_codestringoptional

The machine code on routes that name it this way.

messagestringoptional
requestIdstringoptional
404No such resource for the caller, including one in an org the caller is not in or a Project that is private to someone else.
errorstringoptional

A sentence for a person.

codestringoptional

Stable machine code, e.g. AUTH_FAILED, NOT_FOUND, VALIDATION_ERROR, RATE_LIMITED, TOKEN_LIMIT_REACHED.

error_codestringoptional

The machine code on routes that name it this way.

messagestringoptional
requestIdstringoptional
429Upload rate limit exceeded, or the account is over its 1,800-a-minute request budget.

Upload rate limit exceeded, or the account is over its 1,800-a-minute request budget. Retry-After is set.

errorstringoptional

A sentence for a person.

codestringoptional

Stable machine code, e.g. AUTH_FAILED, NOT_FOUND, VALIDATION_ERROR, RATE_LIMITED, TOKEN_LIMIT_REACHED.

error_codestringoptional

The machine code on routes that name it this way.

messagestringoptional
requestIdstringoptional

Used in