Skip to main content
POST
Uploads go directly to cloud storage. The API returns an upload target and never receives the bytes. The response’s upload_type selects the flow and is chosen from the size_bytes you declare.

upload_type: "single"

  1. POST /experimental/files returns a file_id, an upload_url, and the fields to send with the bytes.
  2. POST the bytes to upload_url as multipart form-data, with every key in fields included as a form field. Success returns 204 No Content.
  3. POST /experimental/files/{file_id}/finalize with an empty body.

upload_type: "multipart"

  1. POST /experimental/files returns a file_id, an upload_id, a part_size_bytes, and a part_count.
  2. Split the file into part_count chunks of part_size_bytes. The last chunk is the remainder.
  3. POST /experimental/files/{file_id}/parts with the upload_id and the part numbers you want, which returns a PUT URL per part. You can request them in batches.
  4. PUT each chunk to its URL and keep the ETag response header for that part number.
  5. POST /experimental/files/{file_id}/finalize with { "upload_id": "…", "parts": [{ "part_number": 1, "etag": "…" }, … ] }.
Once finalized, attach the file_id to a task with file_ids on POST /experimental/tasks/{id}/messages.

Authorizations

Authorization
string
header
required

Requires an API key. See the Authentication guide.

Body

application/json
project_id
string
required
filename
string
required
size_bytes
integer
required
mime_type
string | null

Response

200 - application/json

Upload started. For upload_type=single, POST the bytes to upload_url with fields. For upload_type=multipart, pass upload_id to POST /experimental/files/{file_id}/parts.

project_id
string
required
filename
string
required
size_bytes
integer
required
type
string
default:upload_intent
Allowed value: "upload_intent"
file_id
string | null
path
string | null
upload_type
enum<string>
default:single
Available options:
single,
multipart
upload_url
string | null
fields
Fields · object
upload_id
string | null
part_size_bytes
integer | null
part_count
integer | null
expires_at
string<date-time> | null
mime_type
string | null