Files API
Upload once, reuse across requests with file_id in document or image content blocks.
This API is compatible with Anthropic's Files beta concepts and works across our router. Files are scoped to your API key and cannot be accessed by other users.
Endpoints
POST /api/anthropic/v1/files– upload via multipart/form-data (file) or JSON{ content, filename, mime_type }GET /api/anthropic/v1/files– list filesGET /api/anthropic/v1/files/{id}– get file metadataDELETE /api/anthropic/v1/files/{id}– delete a fileGET /api/anthropic/v1/files/{id}/content– download content (returns raw bytes for base64 uploads)
Headers
x-api-key: $API_KEYorAuthorization: Bearer $API_KEY- Optional:
anthropic-version: 2023-06-01 - Optional:
anthropic-beta: files-api-2025-04-14
Upload
Multipart (recommended):
curl -X POST https://api.kushrouter.com/api/anthropic/v1/files \
-H "x-api-key: $API_KEY" \
-H "anthropic-version: 2023-06-01" \
-F "file=@/path/to/document.pdf"JSON:
curl -X POST https://api.kushrouter.com/api/anthropic/v1/files \
-H "x-api-key: $API_KEY" \
-H "content-type: application/json" \
-d '{
"content": "data:application/pdf;base64,....",
"filename": "paper.pdf",
"mime_type": "application/pdf"
}'List
curl -s https://api.kushrouter.com/api/anthropic/v1/files \
-H "x-api-key: $API_KEY"Get metadata
curl -s https://api.kushrouter.com/api/anthropic/v1/files/file_123 \
-H "x-api-key: $API_KEY"Download content
curl -s -L https://api.kushrouter.com/api/anthropic/v1/files/file_123/content \
-H "x-api-key: $API_KEY" -o out.binIf the file was uploaded as base64 (e.g., data:application/pdf;base64,...), the router will decode and return raw bytes with the correct Content-Type.
Delete
curl -X DELETE https://api.kushrouter.com/api/anthropic/v1/files/file_123 \
-H "x-api-key: $API_KEY"Using files in messages
Reference the uploaded file via file_id in an Anthropic Messages request.
Security
- Files are always scoped to your API key and cannot be accessed by other users.
- Download and metadata routes verify ownership using your API key.
- The streaming endpoints (Edge) do not access storage directly; they call these Node-based routes with your API credentials.