Skip to main content
Upload one or more files to a chat session. Supported file types include documents (PDF, CSV, XLSX) and images (PNG, JPG). If no chat_id is provided, a new chat is created automatically.
Uploaded files are processed server-side: documents are parsed and chunked for retrieval, images are captioned and embedded. After uploading, reference the returned upload IDs in a Send Message request to attach them to a conversation turn.
Authorization
string
required
Bearer token obtained from the authenticate endpoint.
files
file[]
required
One or more files to upload. Sent as multipart/form-data. Maximum 5 files per request, each up to 5 MB.Supported MIME types:
  • application/pdf
  • text/csv
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (XLSX)
  • image/png
  • image/jpeg
chat_id
string
ID of an existing chat to attach the files to. If omitted, a new chat is created.

Response

chat_id
string
required
The chat the files were uploaded to. If no chat_id was provided in the request, this is the newly created chat’s ID.
uploads
array
required
List of successfully processed uploads.
curl -X POST https://api.trellis.sh/v1/chats/uploads \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "files=@report.pdf" \
  -F "files=@data.csv" \
  -F "chat_id=chat_abc123"
{
  "chat_id": "chat_abc123",
  "uploads": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "filename": "report.pdf",
      "mime_type": "application/pdf",
      "file_size": 245760,
      "upload_type": "document",
      "presigned_url": "https://s3.amazonaws.com/...",
      "created_at": "2025-06-15T09:30:00Z",
      "message_id": null
    },
    {
      "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
      "filename": "data.csv",
      "mime_type": "text/csv",
      "file_size": 1024,
      "upload_type": "document",
      "presigned_url": "https://s3.amazonaws.com/...",
      "created_at": "2025-06-15T09:30:01Z",
      "message_id": null
    }
  ]
}