Guides
Technical reference for file management endpoints.
/v1/filesList all files in a dataset.
| Parameter | Type | Required | Description |
|---|---|---|---|
datasetId | string | Yes* | Dataset to list files from (*optional with frontend token) |
bashcurl https://api.easyrag.com/v1/files?datasetId=my-dataset \ -H "Authorization: Bearer YOUR_API_KEY"
json{ "success": true, "files": [ { "customerId": "user_abc123", "datasetId": "my-dataset", "fileId": "f7a3b2c1-4d5e-6f7g", "filePath": "customers/user_abc123/datasets/my-dataset/f7a3b2c1-manual.pdf", "originalName": "manual.pdf", "mimeType": "application/pdf", "size": 245678, "loaderId": "pdf_loader_xyz", "created": "2024-12-12T10:30:00.000Z", "extension": ".pdf", "transcriptionText": null, "transcriptionSrt": null, "extraMeta": { "department": "support", "version": "2.0" } } ] }
json{ "success": true, "files": [] }
400 Bad Request
json{ "error": "datasetId is required via token or query parameter" }
401 Unauthorized
json{ "error": "Missing API key or token" }
403 Forbidden
json{ "error": "datasetId mismatch between token and query" }
/v1/files/:fileIdGet detailed information about a specific file, including a signed download URL.
| Parameter | Type | Required | Description |
|---|---|---|---|
fileId | string | Yes | Unique file identifier |
| Parameter | Type | Required | Description |
|---|---|---|---|
datasetId | string | Yes* | Dataset containing the file (*optional with frontend token) |
bashcurl https://api.easyrag.com/v1/files/f7a3b2c1-4d5e?datasetId=my-dataset \ -H "Authorization: Bearer YOUR_API_KEY"
json{ "success": true, "file": { "customerId": "user_abc123", "datasetId": "my-dataset", "fileId": "f7a3b2c1-4d5e-6f7g", "filePath": "customers/user_abc123/datasets/my-dataset/f7a3b2c1-manual.pdf", "originalName": "manual.pdf", "mimeType": "application/pdf", "size": 245678, "loaderId": "pdf_loader_xyz", "created": "2024-12-12T10:30:00.000Z", "extension": ".pdf", "transcriptionText": null, "transcriptionSrt": null, "extraMeta": { "department": "support" }, "permanentUrl": "https://storage.googleapis.com/bucket-name/path/to/file?Expires=2491-03-09&..." } }
All fields from file object plus:
| Field | Type | Description |
|---|---|---|
permanentUrl | string | Signed URL valid until 2491 for direct file access |
Note: The permanentUrl is cached after first access for performance.
404 Not Found
json{ "error": "File not found" }
400 Bad Request
json{ "error": "datasetId is required via token or query parameter" }
403 Forbidden
json{ "error": "datasetId mismatch between token and query" }
/v1/files/:fileIdDelete a specific file from a dataset. Removes:
| Parameter | Type | Required | Description |
|---|---|---|---|
fileId | string | Yes | Unique file identifier |
| Parameter | Type | Required | Description |
|---|---|---|---|
datasetId | string | Yes* | Dataset containing the file (*optional with frontend token). Can be in query string or request body |
bashcurl -X DELETE \ "https://api.easyrag.com/v1/files/f7a3b2c1-4d5e?datasetId=my-dataset" \ -H "Authorization: Bearer YOUR_API_KEY"
bashcurl -X DELETE https://api.easyrag.com/v1/files/f7a3b2c1-4d5e \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"datasetId": "my-dataset"}'
json{ "success": true }
404 Not Found
json{ "error": "File not found" }
400 Bad Request
json{ "error": "datasetId is required via token, body or query" }
403 Forbidden
json{ "error": "datasetId mismatch between token and path" }
/v1/datasets/:datasetId/filesDelete all files in a specific dataset. Bulk operation that:
| Parameter | Type | Required | Description |
|---|---|---|---|
datasetId | string | Yes | Dataset to clear |
bashcurl -X DELETE https://api.easyrag.com/v1/datasets/my-dataset/files \ -H "Authorization: Bearer YOUR_API_KEY"
json{ "success": true, "deleted": 15 }
| Field | Type | Description |
|---|---|---|
deleted | number | Number of files removed |
json{ "success": true, "deleted": 0 }
400 Bad Request
json{ "error": "datasetId is required" }
403 Forbidden
json{ "error": "datasetId mismatch between token and path" }
/v1/filesDelete all files across all datasets for the authenticated customer. Complete wipe that:
⚠️ Warning: Irreversible operation affecting all data.
bashcurl -X DELETE https://api.easyrag.com/v1/files \ -H "Authorization: Bearer YOUR_API_KEY"
json{ "success": true, "deleted": 127 }
| Field | Type | Description |
|---|---|---|
deleted | number | Total files removed across all datasets |
401 Unauthorized
json{ "error": "Missing API key" }
typescriptinterface File { customerId: string; // Customer who owns the file datasetId: string; // Dataset containing the file fileId: string; // Unique file identifier (UUID) filePath: string; // Cloud Storage path originalName: string; // Original filename mimeType: string | null; // MIME type (e.g., "application/pdf") size: number | null; // File size in bytes loaderId: string; // EmbedJS loader ID created: string; // ISO 8601 timestamp extension: string; // File extension (e.g., ".pdf") transcriptionText: string | null; // Transcription text (media only) transcriptionSrt: SrtEntry[] | null; // SRT subtitles (media only) extraMeta: Record<string, any> | null; // Custom metadata permanentUrl?: string; // Signed download URL (GET only) } interface SrtEntry { id: string; startTime: string; // Format: "HH:MM:SS,mmm" endTime: string; // Format: "HH:MM:SS,mmm" text: string; }
json{ "customerId": "user_abc123", "datasetId": "my-dataset", "fileId": "f7a3b2c1-4d5e-6f7g-8h9i-0j1k2l3m4n5o", "filePath": "customers/user_abc123/datasets/my-dataset/f7a3b2c1-document.pdf", "originalName": "document.pdf", "mimeType": "application/pdf", "size": 245678, "loaderId": "pdf_loader_f7a3b2c1", "created": "2024-12-12T10:30:00.000Z", "extension": ".pdf", "transcriptionText": null, "transcriptionSrt": null, "extraMeta": { "userId": "user_123", "department": "legal", "uploadedAt": "2024-12-12T10:29:45.123Z" } }
json{ "fileId": "a1b2c3d4-5e6f-7g8h", "originalName": "podcast.mp3", "extension": ".mp3", "transcriptionText": "Welcome to episode 47 of the AI podcast. Today we're discussing...", "transcriptionSrt": [ { "id": "1", "startTime": "00:00:00,000", "endTime": "00:00:03,500", "text": "Welcome to episode 47 of the AI podcast." }, { "id": "2", "startTime": "00:00:03,500", "endTime": "00:00:07,200", "text": "Today we're discussing machine learning." } ] }
Deletes in this order:
Failures are logged but don't stop the process.
Processes all files concurrently for efficiency.
Iterates through all datasets, processing files concurrently.
If some operations fail:
| Endpoint | Limit |
|---|---|
| List files | 1000 requests/minute |
| Get file | 1000 requests/minute |
| Delete single | 100 requests/minute |
| Delete bulk | 10 requests/minute |
All file management operations are free:
Note: Credits spent on uploads are not refunded when files are deleted.
javascriptif (confirm('Delete ALL files in this dataset?')) { await fetch(`https://api.easyrag.com/v1/datasets/${datasetId}/files`, { method: 'DELETE', headers: { 'Authorization': `Bearer ${apiKey}` } }); }
javascript// Cache for 5 minutes const cacheKey = `files-${datasetId}`; const cached = cache.get(cacheKey); if (cached && Date.now() - cached.timestamp < 5 * 60 * 1000) { return cached.files; } const { files } = await listFiles(datasetId); cache.set(cacheKey, { files, timestamp: Date.now() });
javascripttry { const { file } = await getFile(fileId, datasetId); } catch (error) { if (error.status === 404) { console.log('File not found, may have been deleted'); return null; } throw error; }
javascriptconst deleteFile = async (fileId) => { await fetch(`https://api.easyrag.com/v1/files/${fileId}?datasetId=${datasetId}`, { method: 'DELETE', headers: { 'Authorization': `Bearer ${apiKey}` } }); // Remove from UI setFiles(files.filter(f => f.fileId !== fileId)); };
permanentUrl is cached in file metadata for performanceloaderId is used internally by EmbedJS for vector cleanupnull for non-media filesPOST /v1/files/upload - Upload filesPOST /v1/search - Search indexed filesPOST /v1/query - Query indexed files