Create File
Changed onStarts an upload: creates a pending file at path and returns an upload to PUT its bytes to. The bytes go straight to storage, not through the API. Then call Complete File to make the file ready.
Retry-safe: sending the identical request again (same path, size, sha256, content_type and expires_at) returns the existing file with 200 instead of 201: a pending one with a fresh upload, or a ready one without. If its bytes were uploaded but the upload was never completed, it is completed then. A different request at a path whose file is still pending and has no bytes replaces that file; at any other taken path it returns 409.
The file counts against the organization's Drive quota from creation, pending or not: 1 GiB and 10,000 files by default. A file that doesn't fit returns 403 with code limit_exceeded. Deleting a file frees its space within seconds. Expired files count until a create needs their space: a create that doesn't fit first gives back what expired files hold, a batch at a time, so retry a refusal while many expired files remain.
Requires the file_create permission, which an unverified organization's keys don't have at any scope until it completes agent verification. A key without file_read can still create files, but gets the plain 409 at any taken path, even for an identical request at a file it didn't create.
Agent Drive is in AgentMail Labs, available in US production (api.agentmail.to) but not yet in EU production (api.agentmail.eu). Organizations that have not joined Labs receive a 403.
Request
- Base URLhttps://api.agentmail.to
- URLhttps://api.agentmail.to/v0/inboxes/{inbox_id}/files
- AuthHTTP bearer
Path parameters
The ID of the inbox.
Request body
Response
Response with status 200
Changes
- info
endpoint added
- info