API Documentation
Schema-defined entity layer with CRUD, filtering, and semantic retrieval to support deterministic business data in agent workflows.
Overview
Records provide a transactional, schema-backed data API with full CRUD, structured filtering, and semantic search. Unlike memories, records let you define typed schemas and store structured objects that your AI can query and reason over.
Use cases: CRM contacts, product catalogs, knowledge bases, task lists, inventory, support tickets — any structured data your AI needs to read, write, and search.
AI Integration: Records can be automatically recalled and learned during chat via the mnx.records config — the LLM can read and write structured data as part of the conversation flow.
1. Define a Schema
Schemas define the structure of your records. Each schema has a type_name and a set of typed fields.
type_namerequiredfieldsrequireddisplay_namedescriptioncurl -X POST "https://www.mnexium.com/api/v1/records/schemas" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{
"type_name": "account",
"display_name": "Customer Account",
"description": "CRM customer accounts",
"fields": {
"name": { "type": "text", "required": true },
"industry": { "type": "text" },
"revenue": { "type": "number" },
"is_active": { "type": "boolean" }
}
}'2. Insert Records
Create a record of a given type. The data is validated against the schema and automatically embedded for semantic search.
datarequiredowner_idvisibilitycollaboratorscurl -X POST "https://www.mnexium.com/api/v1/records/account" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": {
"name": "TechCorp",
"industry": "Technology",
"revenue": 5000000,
"is_active": true
},
"owner_id": "user_123",
"visibility": "private",
"collaborators": ["user_456"]
}'3. Get, Update & Delete
Standard CRUD operations on individual records.
# Get a record
curl "https://www.mnexium.com/api/v1/records/account/rec_abc123" \
-H "x-mnexium-key: $MNX_KEY"
# Update (partial merge)
curl -X PUT "https://www.mnexium.com/api/v1/records/account/rec_abc123" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{ "data": { "revenue": 7500000 } }'
# Delete (soft)
curl -X DELETE "https://www.mnexium.com/api/v1/records/account/rec_abc123" \
-H "x-mnexium-key: $MNX_KEY"4. Query with Filters
Filter records with field-value matching and server-side sorting.
whereorder_bylimitoffsetcurl -X POST "https://www.mnexium.com/api/v1/records/account/query" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{
"where": {
"industry": "Technology",
"is_active": true
},
"order_by": "-revenue",
"limit": 10
}'// Response
{
"records": [
{
"record_id": "rec_abc123",
"type_name": "account",
"data": { "name": "TechCorp", "industry": "Technology", "revenue": 7500000, "is_active": true },
"owner_id": "user_123",
"visibility": "private",
"created_at": "2025-01-15T10:00:00Z"
}
]
}5. Semantic Search
Search records by natural language query using pgvector embeddings. Records are automatically embedded on insert/update.
queryrequiredlimitcurl -X POST "https://www.mnexium.com/api/v1/records/account/search" \
-H "x-mnexium-key: $MNX_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "enterprise technology companies", "limit": 5 }'6. Access Control
Records support fine-grained access control via owner_id, visibility, and collaborators.
public records are visible to all. private records are visible only to the owner and collaborators.
Only the owner or collaborators can update or delete a record. System actors (no subject_id) bypass ownership checks.
AI-Powered Records in Chat
Enable automatic record recall and learning during conversations via the mnx.records config:
curl -X POST "https://www.mnexium.com/api/v1/chat/completions" \ -H "x-mnexium-key: $MNX_KEY" \ -H "x-openai-key: $OPENAI_KEY" \ -d '{ "model": "gpt-4o-mini", "messages": [{ "role": "user", "content": "What deals do we have with TechCorp?" }], "mnx": { "subject_id": "user_123", "records": { "recall": true, "learn": "auto", "tables": ["account", "deal"] } } }'When records.recall: true, relevant records are injected into the LLM context. Set records.learn to "auto", "force", or false. When using "force", records.tables is required. Set records.sync to true to block the response until writes complete. For dependency graphs (for example, fields typed as ref:<type>), partial writes fail the request.
How mnx.records Expands
In chat requests, mnx.records controls two independent runtime steps: record recall before generation, and structured extraction after generation.
{
"mnx": {
"subject_id": "user_123",
"records": {
"recall": true,
"learn": "force",
"sync": true,
"tables": ["account", "deal"]
}
}
}recall: true → injects relevant records from selected schemas into model context.learn: "auto" → runs async selective extraction by default; for streaming requests with explicit write intent and scoped tables, Mnexium attempts a pre-stream write first.learn: "force" → higher-intent extraction with required table allowlist.sync: true → response waits for writes; if a dependency graph write is partial, the request fails.tables → scopes recall/extraction to specific schemas.ref:<type> fields → extraction plans can link operations using {"$ref":"op_id"} (or @ref:op_id) and Mnexium resolves DB-generated record IDs in dependency order.Extraction Classifier Timeout
Classification timeout is configurable via MNX_EXTRACT_CLASSIFY_TIMEOUT_MS. Values are clamped to 250..15000 ms. Invalid values fall back to 2000 ms.
both_unclassified.