Overview

The Uploads API accepts base64-encoded file payloads from clients, stores them on the server, and returns a fetchable URL. The agent-chat bridge forwards the returned URL to the runtime as a file message part. Uploads are commonly used by the Allternit mobile composer to stage photos or documents before sending.

Base URL

All endpoints require a valid Bearer token in the Authorization header. See Authentication for details.

Endpoints

Upload file

Request body:
Limits:
  • Maximum decoded payload: 20 MB.
  • Upload IDs are alphanumeric and extensionless; the sidecar stores the original filename and media type.
Response:

Download upload

The response returns the stored bytes with the original Content-Type. If the sidecar is missing, application/octet-stream is used. Range requests are supported. Every upload is served with these headers, whoever made it (a client, run_code, or the sandbox files output): So an HTML or SVG upload downloads and never runs as a page on the API’s origin. To show one in an app, fetch the bytes and display them in a sandboxed frame, for example <iframe sandbox srcdoc=…> or a blob URL in a frame with the sandbox attribute. fetch() and <img> are not affected by these headers. Upload IDs are random. run_code and sandbox output files get the same kind of ID as client uploads.

Error codes