API Reference
Programmatic access to your RAG pipelines via Bearer token.
Authentication
All requests to the public API require an API key in the Authorization header:
Authorization: Bearer rgp_YOUR_KEY
Generate a key in your Account settings. A key is shown only once — store it securely.
POST/api/v1/rag/query
Runs a full RAG pipeline (embed → retrieve → generate) against a dataset you own. Optionally uses a specific published pipeline configuration.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| dataset_id | string | yes | UUID of the dataset to query |
| query | string | yes | Natural language question |
| top_k | integer | no (default: 5) | Number of chunks to retrieve |
| pipeline_id | string | null | no | UUID of a published pipeline; uses default config if omitted |
Response (200 OK)
| Field | Type | Description |
|---|---|---|
| answer | string | Generated answer |
| chunks[] | array | Retrieved chunks — each has id, text, score, document_id, document_name |
| usage | object | prompt_tokens, completion_tokens |
| trace | object | embedder, retriever, generator, model |
curl example
curl -X POST https://api.lekottt.ru/api/v1/rag/query \
-H "Authorization: Bearer rgp_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"dataset_id": "DS_UUID",
"query": "what is hexagram 5?",
"top_k": 5
}'Try it now
Нужен UUID из URL датасета, не его имя.
Этот вызов идентичен curl-команде сверху. Ключ хранится только в памяти браузера, не отправляется на наш сервер кроме как через CORS-запрос к API.
Response example
{
"answer": "Hexagram 5, Xu (Waiting), ...",
"chunks": [
{
"id": "chunk-uuid",
"text": "...",
"score": 0.94,
"document_id": "doc-uuid",
"document_name": "iching.txt"
}
],
"usage": { "prompt_tokens": 312, "completion_tokens": 87 },
"trace": {
"embedder": "cohere-embedder",
"retriever": "pgvector-hybrid",
"generator": "litellm-generator",
"model": "deepseek/deepseek-v4-flash"
}
}Error codes
| Status | Meaning |
|---|---|
| 401 | Missing or invalid API key |
| 404 | Dataset or pipeline not found / not yours |
| 422 | Validation error or pipeline has no published version |
| 500 | Internal error (retriever or generator plugin unavailable) |
Rate limits
Currently no rate limit enforced. Please be reasonable.