Retrieve relevant memories using natural language.
POST /v1/recall
Retrieve relevant memories using a natural language query. CortexDB finds the most relevant context and returns it in a format ready for use with LLMs.
Request
POST /v1/recall
Content-Type: application/json
Authorization: Bearer <api-key>
Body
{
"query": "What database are we using for the payments service?",
"tenant_id": "my-app"
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Natural language query |
| tenant_id | string | No | Tenant identifier (default: "default") |
| max_tokens | integer | No | Maximum token budget for response (default: 4096) |
| min_confidence | float | No | Minimum confidence threshold (default: 0.0) |
Response
Status: 200 OK
Python SDK Response
{
"context": "Chose CockroachDB for the payments service. Rationale: multi-region support, PostgreSQL compatibility. Migration completed March 2026.",
"confidence": 0.94,
"latency_ms": 87
}
| Field | Type | Description |
|---|---|---|
| context | string | Synthesized context from matching memories |
| confidence | float | Confidence score (0-1) |
| latency_ms | integer | Server-side processing time |
TypeScript SDK Response
{
"matches": [
{
"content": "Chose CockroachDB for the payments service. Rationale: multi-region support, PostgreSQL compatibility.",
"confidence": 0.94,
"episodeId": "ep_a1b2c3d4",
"metadata": {}
}
],
"total": 1
}
| Field | Type | Description |
|---|---|---|
| matches | array | Ranked list of matching memories |
| matches[].content | string | Memory content |
| matches[].confidence | float | Relevance score (0-1) |
| matches[].episodeId | string | Episode ID |
| matches[].metadata | object | Episode metadata |
| total | integer | Total matches |
Example
curl -X POST https://api.cortexdb.io/v1/recall \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"query": "What database are we using for payments?",
"tenant_id": "my-app"
}'