Upload document file
Upload a file to associate with a document. Supports two upload methods: 1. Multipart form-data with file field 2. Binary stream with X-Original-Filename…
Upload a file to associate with a document. Supports two upload methods:
- Multipart form-data with file field
- Binary stream with X-Original-Filename header
File validation includes size limits (10MB), MIME type checking, and automatic type detection from file signatures.
Authorization
bearerAuth In: header
Path Parameters
Document ID to upload file for
uuidQuery Parameters
Locale whose document file should be uploaded or removed. Base locale codes are resolved to Directus language codes such as ja-JP, ko-KR, and zh-CN.
"en" | "de" | "fr" | "ja" | "ko" | "zh"Header Parameters
Original filename (required for binary uploads)
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
curl -X PUT "https://example.com/api/v1/documents/550e8400-e29b-41d4-a716-446655440000/file?locale=ja" \ -H "X-Original-Filename: privacy-policy.pdf" \ -F file="string"{
"success": true,
"data": {
"fileId": "file-789",
"url": "https://directus.example.com/assets/file-789"
}
}{
"error": "document_too_large",
"details": "File size exceeds 10MB limit"
}{
"error": "unsupported_media_type"
}{
"error": "file_upload_failed_generic"
}How is this guide?