Skip to main content

File object

Upload, get, and list endpoints return File objects.
FieldTypeDescription
file_idstringFile ID with the file_ prefix
filenamestringStored file name
size_bytesintegerFile size in bytes
mime_typestringMIME type supplied by the upload or detected from the file name
purposestringFile purpose. See File purpose
statusstringFile status. See File status
metadataJSON valueMetadata JSON supplied at upload time; defaults to {}
created_atstringUTC creation time in RFC 3339 format
updated_atstringUTC update time, returned only when different from created_at
session_idstringReturned when the file is associated with a Session

File purpose

ValueDescription
user_uploadFile uploaded by the user for later use
tool_outputFile produced by a tool
skill_outputFile produced by a Skill
session_resourceFile attached as a Session resource
agent_outputFile produced as an Agent output

File status

ValueDescription
uploadingUpload record has been created and content upload is in progress
readyFile content is available
errorUpload failed after the record was created
deletedFile has been deleted; returned only by list requests that explicitly include deleted files
GET /v1/files/{file_id}/content returns this object.
FieldTypeDescription
urlstringPresigned download URL
expires_atstringUTC expiration time for the URL in RFC 3339 format

Upload form fields

POST /v1/files uses multipart/form-data.
FieldTypeRequiredDescription
filefileYesText-based file content
namestringNoStored file name. Defaults to the uploaded file name. After server sanitization, length must be 1-255 bytes and cannot be . or ..
purposestringNoDefaults to user_upload. See File purpose
metadataJSON stringNoValid JSON encoded as a form field. Maximum raw length is 8 KB. Defaults to {}

Supported upload file types

The upload endpoint accepts text-based files only.
CategoryAccepted values
MIME typeAny text/* MIME type, plus application/json, application/xml, application/javascript, application/x-yaml, and application/x-toml
Extension.txt, .md, .csv, .json, .xml, .yaml, .yml, .toml, .ini, .conf, .cfg, .env, .log, .html, .htm, .css, .scss, .less, .js, .jsx, .ts, .tsx, .vue, .svelte, .py, .go, .rs, .java, .kt, .scala, .c, .cpp, .cc, .h, .hpp, .rb, .php, .swift, .r, .lua, .pl, .sh, .bash, .zsh, .fish, .ps1, .sql, .graphql, .gql, .proto, .dockerfile, .makefile, .gitignore, .editorconfig, .eslintrc, .prettierrc, .tex, .rst, .adoc, .org, .svg
Extensionless file namedockerfile, makefile, gemfile, rakefile, procfile, vagrantfile, justfile, brewfile

Attach and download files

Upload files to give your agent context, and download files it produces.