Upload a file
Stores a file the organization can attach to any number of sessions. Attaching one mounts it read-only into the session’s sandbox under its files directory, and the agent knows where to find it. Send the bytes as the file part of a multipart/form-data body; the part’s filename and Content-Type become the file’s name and media type. Up to 30 MiB in one request; send a larger file, up to 1 GiB, in parts with startFileUpload. The bytes are served back through GET /v1/files//content to the same organization. An upload that would carry the organization’s live files past its byte quota answers 413 with code file_quota_exceeded and the quota, the bytes in use, and the incoming size in details.
Authorizations
A Recursion API key, created in the console under API keys.
Body
Multipart body for uploading a file. Send the bytes as the file part; the part's filename and Content-Type become the file's name and media type.
How long the file stays attachable and its content served, from 3600 (an hour) to 7776000 (ninety days); its metadata stays readable, with expires_at in the past, for a grace after that. Omit for a file that does not expire. Set once: a file's expiry cannot be changed.
The file's bytes. Its part filename is the name the file is stored and mounted under; its part Content-Type is recorded as the media type. Up to 30 MiB; upload a larger file, up to 1 GiB, with startFileUpload.
Caller-owned key/value data as a JSON object, since a form part cannot carry structure. Rejected rather than dropped when it does not parse.
Response
A file object: bytes uploaded once and attachable to any number of sessions as a resource, or bytes a session produced. Attaching a file mounts it read-only into the session's sandbox at a path the session is told about.
A file object: bytes uploaded once and attachable to any number of sessions as a resource, or bytes a session produced. Attaching a file mounts it read-only into the session's sandbox at a path the session is told about.
Size of the file in bytes.
Server-assigned RFC 3339 timestamp of the upload.
Whether GET /v1/files/{file_id}/content serves the bytes. True for every live file, upload or session output; expiry, not source, is what closes the content route.
Server-assigned id, used to attach the file to a session as a resource.
The name the file was uploaded under, without any directory. This is the name it is mounted under in a sandbox unless a resource says otherwise.
The upload's declared Content-Type. When the part declared none, or declared application/octet-stream, the type is detected from the filename's extension, through a fixed table rather than the host's, and then from the bytes, falling back to application/octet-stream when neither says anything. Informational: the platform does not transcode or validate against it.
Organization that owns the file. Server-assigned from the caller's credentials.
SHA-256 of the file's contents, for checking a download.
How the file came to exist: upload for a file you uploaded, session_output for a deliverable a session saved.
upload, session_output Always file.
file When the file stops being attachable and its content stops being served. Its metadata stays readable and listed, with this in the past, for a grace before the file is reclaimed. Absent means it does not expire.
Caller-owned key/value data stored with the file and returned unchanged.
For a session output, the session that produced it. Absent on an upload, which belongs to the organization rather than to any one session.