Skip to content

Files

The Files API mirrors OpenAI’s surface so SDKs work unchanged. Gatewyse stores file metadata in a tenant-scoped registry and assigns a stable gateway file ID (UUID); downstream references (chat content parts, batch input lines, vector-store attachments) use the gateway ID, and the gateway translates to the underlying provider’s file ID at request time.

Required capability: files

Endpoints

MethodPathDescription
POST/v1/filesUpload a file (multipart or base64 JSON).
GET/v1/filesList files with cursor pagination.
GET/v1/files/:fileIdFetch metadata for a single file.
DELETE/v1/files/:fileIdDelete from both the gateway registry and the upstream provider.

Upload — multipart

Terminal window
curl https://your-gateway.example.com/v1/files \
-H "Authorization: Bearer aigw_sk_your_api_key" \
-F "file=@dataset.jsonl" \
-F "provider=openai" \
-F "purpose=batch"

Upload — JSON

Terminal window
curl https://your-gateway.example.com/v1/files \
-H "Authorization: Bearer aigw_sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"provider": "openai",
"filename": "dataset.jsonl",
"mime_type": "application/jsonl",
"content_base64": "<base64 bytes>",
"purpose": "batch"
}'

Request fields

FieldTypeRequiredDescription
providerstringYesProvider slug to upload to (openai, anthropic, etc.).
purposestringYesassistants | batch | fine-tune | vision | user_data.
filenamestringYes (JSON only)Original filename. Inferred from multipart file field.
mime_typestringYes (JSON only)MIME type. Inferred from multipart upload.
content_base64stringYes (JSON only)File bytes, base64-encoded.
expires_in_secondsintegerNoTTL for the gateway registry entry. Defaults to the provider’s own TTL.
metadataobjectNoFree-form tenant metadata.

Response

{
"id": "file-7c8b9d3e-...",
"object": "file",
"bytes": 12480,
"created_at": 1748284800,
"expires_at": null,
"filename": "dataset.jsonl",
"purpose": "batch",
"status": "processed",
"provider": "openai"
}

List

Terminal window
curl 'https://your-gateway.example.com/v1/files?purpose=batch&limit=50' \
-H "Authorization: Bearer aigw_sk_your_api_key"

Returns a paginated list. Use next_cursor to walk the next page.

ID translation

When you embed a gateway file ID anywhere a request body accepts a file reference — chat content parts, batch input lines (input_file_id), vector-store attachments — the gateway automatically translates the gateway UUID to the underlying provider’s file ID before dispatching. Callers never need to track provider IDs.

The translation is tenant-scoped. A file uploaded by one tenant cannot be referenced by another.

Limits

LimitValue
Max upload size512 MiB (multipart) / 50 MiB (JSON body)
Files per upload1
Purposes that participate in vector storesassistants, user_data