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 a single synthesized result with a confidence score.
Usage
from cortexdb import Cortex
client = Cortex(api_key="your-api-key")
result = client.recall(
query="What database are we using for the payments service?",
tenant_id="my-app"
)
print(result.context) # "Chose CockroachDB for the payments service..."
print(result.confidence) # 0.94
print(result.latency_ms) # 87
import { CortexDB } from "cortexdbai";
const client = new CortexDB({ apiKey: "your-api-key" });
const result = await client.recall(
"What database are we using for the payments service?",
"my-app"
);
console.log(result.context); // "Chose CockroachDB for the payments service..."
console.log(result.confidence); // 0.94
console.log(result.latencyMs); // 87
curl -X POST https://api.cortexdb.ai/v1/recall \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"query": "What database are we using for the payments service?",
"tenant_id": "my-app"
}'
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Natural language query |
| tenant_id | string | Yes | Tenant identifier |
Response
The response is a single object, not a list. It contains the synthesized context from matching memories.
{
"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.0 to 1.0) |
| latency_ms | integer | Server-side processing time in milliseconds |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Missing required fields |
| 401 | authentication_error | Invalid or missing API key |
| 429 | rate_limit | Too many requests |
What happens under the hood
Both the Python and TypeScript SDKs wrap a POST /v1/recall REST call. The SDK handles authentication (reading CORTEX_API_KEY from your environment if not passed explicitly), serializes the request, and deserializes the response into a typed object. CortexDB performs hybrid retrieval (vector search + graph traversal) and returns a single synthesized context, not a list of raw matches.