API Reference
Base URL, rate limits, and conventions
Complete technical reference for the EasyRAG API.
All API requests use:
https://api.easyrag.com/v1
Include authentication in every request using one of these headers:
httpAuthorization: Bearer YOUR_API_KEY_OR_TOKEN
or
httpx-easyrag-key: YOUR_API_KEY_OR_TOKEN
See Authentication API for details on API keys and frontend tokens.
multipart/form-dataapplication/jsonbashcurl -X POST https://api.easyrag.com/v1/search \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "datasetId": "my-dataset", "question": "What is the refund policy?" }'
All responses return JSON with this structure:
json{ "success": true, "data": { /* endpoint-specific data */ } }
or for file operations:
json{ "success": true, "message": "Operation completed", "files": [ /* file objects */ ] }
json{ "error": "ERROR_CODE", "message": "Human-readable error message" }
| Code | Meaning | Common Causes |
|---|---|---|
| 200 | Success | Request completed successfully |
| 400 | Bad Request | Missing required parameters, invalid input |
| 401 | Unauthorized | Missing or invalid API key/token |
| 402 | Payment Required | Insufficient credits |
| 403 | Forbidden | Dataset mismatch with token, permission denied |
| 404 | Not Found | File or dataset not found |
| 413 | Payload Too Large | File exceeds size limit |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
stringjson{ "datasetId": "customer-support" }
Currently not implemented. The /v1/files endpoint returns all files in a dataset.
Used in search and query endpoints. See Metadata Filtering guide.
json{ "filters": [ { "key": "department", "match": { "value": "sales" } } ] }
Rate limits apply per customer:
| Endpoint | Limit |
|---|---|
| File uploads | 100 files/minute |
| Search/Query | 1000 requests/minute |
| Token generation | 100 requests/minute |
Responses include rate limit information:
httpX-RateLimit-Limit: 1000 X-RateLimit-Remaining: 998 X-RateLimit-Reset: 1702468800
json{ "error": "RATE_LIMIT_EXCEEDED", "message": "Too many requests. Please try again later.", "retryAfter": 60 }
File uploads are not idempotent. Uploading the same file twice creates two separate entries with different fileId values.
To avoid duplicates:
GET /v1/filesOperations are charged before execution. If insufficient credits:
json{ "error": "INSUFFICIENT_CREDITS", "message": "You are out of credits. Please top up to continue.", "details": { "required": 10, "available": 5 } }
| Operation | Cost |
|---|---|
| File upload | 1 credit per file |
| Search | 0.1 credit per request |
| Query | 0.1 credit per request |
| Token generation | Free |
| File listing | Free |
| File deletion | Free |
| Endpoint | Method | Description |
|---|---|---|
/v1/tokens/create | POST | Create frontend token |
| Endpoint | Method | Description |
|---|---|---|
/v1/files/upload | POST | Upload and index files |
/v1/files | GET | List files in dataset |
/v1/files/:fileId | GET | Get file details + download URL |
/v1/files/:fileId | DELETE | Delete single file |
/v1/datasets/:datasetId/files | DELETE | Delete all files in dataset |
/v1/files | DELETE | Delete all customer files |
| Endpoint | Method | Description |
|---|---|---|
/v1/search | POST | Semantic search (returns chunks) |
/v1/query | POST | AI-generated answers (RAG) |
typescriptinterface File { fileId: string; // Unique identifier originalName: string; // Original filename datasetId: string; // Parent dataset customerId: string; // Owner customer ID filePath: string; // Storage path mimeType: string | null; // MIME type size: number | null; // Bytes loaderId: string; // EmbedJS loader ID created: string; // ISO 8601 timestamp extension: string; // File extension transcriptionText: string | null; // For audio/video transcriptionSrt: any[] | null; // SRT subtitles extraMeta: object | null; // Custom metadata permanentUrl?: string; // Signed download URL (cached) }
typescriptinterface SearchResult { score: number; // Similarity score (0-1) pageContent: string; // Chunk text metadata: { fileId: string; originalName: string; customerId: string; datasetId: string; [key: string]: any; // Custom metadata }; }
typescriptinterface Filter { key: string; // Metadata field name match: { value: string | number | boolean; }; }
The API supports CORS for browser-based applications.
Allowed origins: * (all origins)
Allowed methods: GET, POST, DELETE, OPTIONS
Allowed headers: Authorization, Content-Type, x-easyrag-key
Coming soon: Webhook support for:
The current API version is v1. Breaking changes will be introduced in new versions (e.g., v2).
The version is included in the base URL:
https://api.easyrag.com/v1
https://api.easyrag.com/v2 (future)
We'll maintain support for previous versions for at least 12 months after deprecation notice.
Coming soon:
None yet. We'd love to feature yours! Email support@easyrag.com
Coming soon: Separate sandbox environment for testing without using production credits.
For testing, you can use these small files: