REST API

Files and storage

Upload a file via POST /api/files, get back an input-ready object and drop it straight into input[].

Uploading a file

POST /api/files

The body is multipart/form-data with a file field.

bash
curl -X POST https://agent.aist-ai.com/api/files \
  -H "Authorization: Bearer <jwt>" \
  -H "Accept: application/json" \
  -F "file=@document.pdf"

The response is an object ready to go straight into input[]:

response
{
  "type": "file",
  "file": {
    "id": "42",                        // always a string
    "name": "document.pdf",
    "mime_type": "application/pdf",
    "provider_data": { "path": "uploads/…/document.pdf" }
  }
}

Limits

ParameterValue
Max size1,024,000 KB (~1 GB)
FormatsAny: archives, office documents, source code, audio, video, unknown binary files. A file with a text or code extension (.txt, .md, .py, …) must actually be text — otherwise you get 422 with errors.file.

The validation rules are the same as in Aist Backend — the upload is proxied straight there. The file is stored exactly as uploaded: images aren't downscaled, a GIF stays animated. The assistant works with the original — converts it, unpacks it, reads it, and returns as a file whatever it can't display.

Storage base URL

GET /api/storage/base

Returns the public base URL of the storage. Join it with provider_data.path to get a direct download link to a file (for example, a generated image from output).

response
{ "url": "https://storage.aist.example" }
js
const downloadUrl = `${base.url}/${file.provider_data.path}`;
A JWT is only needed for the GET /api/storage/base request. Downloading the file from the resulting link requires no authorization.