Memory Endpoints
REST API endpoints for storing, retrieving, and searching knowledge in the Memory Layer.
POST
/v1/memory/store
Store new knowledge with automatic embedding generation.
Request Body
json
{
"content": "Your knowledge content here",
"tags": ["optional", "tags"],
"metadata": {
"category": "custom",
"version": "1.0"
}
}Response
json
{
"success": true,
"data": {
"id": "mem_abc123xyz",
"embedding": [0.123, 0.456, ...],
"createdAt": "2024-01-15T10:30:00Z"
}
}Example
bash
curl -X POST https://api.cognitivex.ai/v1/memory/store \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "CognitiveX provides multi-LLM support",
"tags": ["features"]
}'GET
/v1/memory/search
Search stored knowledge using semantic similarity.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Search query |
| limit | number | No | Max results (default: 10) |
| tags | string | No | Comma-separated tags |
Response
json
{
"success": true,
"data": [
{
"id": "mem_abc123",
"content": "Matching content...",
"score": 0.95,
"tags": ["features"],
"createdAt": "2024-01-15T10:30:00Z"
}
],
"meta": {
"total": 1,
"limit": 10
}
}Example
bash
curl -X GET "https://api.cognitivex.ai/v1/memory/search?query=multi-LLM&limit=5" \
-H "Authorization: Bearer YOUR_API_KEY"GET
/v1/memory/:id
Retrieve specific knowledge by ID.
Example
bash
curl -X GET https://api.cognitivex.ai/v1/memory/mem_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"DELETE
/v1/memory/:id
Delete knowledge from the Memory Layer.
Example
bash
curl -X DELETE https://api.cognitivex.ai/v1/memory/mem_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"Error Codes
400Bad Request - Invalid parameters401Unauthorized - Invalid API key404Not Found - Memory ID doesn't exist429Rate Limit Exceeded