Sending files
PreviewSend a small, one-off file inline with Chat Completions. Upload first when you use Responses, reuse a file, or need the larger upload limit.
Choose a method
| Inline base64 | Uploaded file | |
|---|---|---|
| Available on | Chat Completions | Chat Completions and Responses |
| Request field | file_data | file_id returned by POST /v1/files |
| Best for | One-off files | Reuse, Responses, and larger files |
| Size | 25 MiB for the whole request, base64 included (about 18 MiB of file bytes) | 50 MiB per file; 10 MiB per image |
| Retention | Follows the request policy; inline PDF and Word persist | Kept until you delete the file |
See Data retention for storage details.
Format support
| Format | Inline Chat | Uploaded Chat | Uploaded Responses |
|---|---|---|---|
| PDF, Word, text, Markdown, CSV, TSV, JSON, XML | Yes | Yes | Yes |
| PNG, JPEG, WebP | Yes | Yes | Yes, as input_image |
| JSONL | No | Yes | Yes |
- Responses images: send an uploaded image as
{ "type": "input_image", "file_id": "file_img456" }. See Uploaded images. - Word: keep a
.docor.docxfilename so SubQ can detect the format. - Uploaded non-text files: wait for
status: "processed"before using the ID.
Inline base64
Inline file_data is Chat Completions only. Pass raw base64 with no line
wrapping or data: prefix.
Use the flat file part shown above for every supported inline format:
{ "type": "file", "filename": "report.pdf", "file_data": "<base64>" }For OpenAI compatibility, PDFs also accept a nested file object. Nested file
parts are PDF-only and accept raw base64 or a
data:application/pdf;base64, URI.
{ "type": "file", "file": { "filename": "report.pdf", "file_data": "<base64>" } }| Field | Required | Description |
|---|---|---|
filename | Recommended | Required for Word; use a .doc or .docx extension. |
mime_type | No | If omitted, SubQ detects the type from the bytes and filename. |
file_data | Yes | Base64-encoded file bytes. |
Use exactly one source per file part: file_data or file_id.
Uploaded files
Upload through the Files API with purpose
assistants, then use the returned ID. The example IDs below represent values
returned by POST /v1/files.
Chat Completions accepts the flat file_id part shown in the Chat tab for
every supported format. PDFs also accept the nested OpenAI shape:
{ "type": "file", "file": { "file_id": "file_abc123" } }. Responses uses
{ "type": "input_file", "file_id": "file_abc123" } for documents and
{ "type": "input_image", "file_id": "file_img456" } for images.
Common errors
| Error | Cause |
|---|---|
400 validation_error | Malformed part, more than one source, invalid declared MIME type, or a Responses input_image with image_url instead of file_id |
400 unsupported_file_type | Unsupported bytes, an image in a Responses input_file part, or a document in an input_image part |
409 file_not_ready | Uploaded file has not reached processed |
413 | File or inline request exceeds its size limit |
See the Files API for upload mechanics and Structured outputs to extract fields instead of a free-text summary.