REST API
Direct HTTP integration. Any language, any framework. Add persistent memory to any AI agent in minutes.
Authentication
All requests require your API key via the X-API-Key header:
Base URL: https://api.0latency.ai
Headers:
X-API-Key: zl_live_xxxxxxxxxxxxx
Content-Type: application/json
Core Endpoints
1. Store a Memory
POST /memories/extract — Add a memory from conversation or raw text
Request:
{
"agent_id": "my-agent",
"content": "User prefers dark mode"
}
Python:
import requests
response = requests.post(
'https://api.0latency.ai/memories/extract',
headers={'X-API-Key': 'zl_live_xxx'},
json={'agent_id': 'my-agent', 'content': 'User prefers dark mode'}
)
JavaScript:
const response = await fetch('https://api.0latency.ai/memories/extract', {
method: 'POST',
headers: {
'X-API-Key': 'zl_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
agent_id: 'my-agent',
content: 'User prefers dark mode'
})
});
2. Recall Memories
POST /recall — Retrieve the most relevant memories for a query
Request:
{
"agent_id": "my-agent",
"query": "user preferences",
"limit": 10
}
Python:
response = requests.post(
'https://api.0latency.ai/recall',
headers={'X-API-Key': 'zl_live_xxx'},
json={
'agent_id': 'my-agent',
'query': 'user preferences',
'limit': 10
}
)
memories = response.json()
JavaScript:
const response = await fetch('https://api.0latency.ai/recall', {
method: 'POST',
headers: {
'X-API-Key': 'zl_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
agent_id: 'my-agent',
query: 'user preferences',
limit: 10
})
});
const memories = await response.json();
3. Search Memories
POST /memories/search — Semantic search across stored memories
Request:
{
"agent_id": "my-agent",
"q": "dark mode"
}
Python:
response = requests.post(
'https://api.0latency.ai/memories/search',
headers={'X-API-Key': 'zl_live_xxx'},
json={'agent_id': 'my-agent', 'q': 'dark mode'}
)
JavaScript:
const response = await fetch('https://api.0latency.ai/memories/search', {
method: 'POST',
headers: {
'X-API-Key': 'zl_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
agent_id: 'my-agent',
q: 'dark mode'
})
});
4. List Memories
GET /memories — List all memories for an agent
Request:
GET /memories?agent_id=my-agent
Python:
response = requests.get(
'https://api.0latency.ai/memories?agent_id=my-agent',
headers={'X-API-Key': 'zl_live_xxx'}
)
JavaScript:
const response = await fetch(
'https://api.0latency.ai/memories?agent_id=my-agent',
{
headers: {'X-API-Key': 'zl_live_xxx'}
}
);
Quick Start
Step 1: Get your API key
Sign up at 0latency.ai/login to get your free API key.
Step 2: Make your first memory store call
curl -X POST https://api.0latency.ai/memories/extract \
-H "X-API-Key: zl_live_xxx" \
-H "Content-Type: application/json" \
-d '{"agent_id":"my-agent","content":"User loves Python"}'
Step 3: Recall it back
curl -X POST https://api.0latency.ai/recall \
-H "X-API-Key: zl_live_xxx" \
-H "Content-Type: application/json" \
-d '{"agent_id":"my-agent","query":"programming language preferences"}'
Error Handling
401 Unauthorized— Invalid or missing API key. Check your X-API-Key header.429 Rate Limited— Too many requests. Upgrade your plan for higher limits.500 Server Error— Temporary server issue. Retry with exponential backoff.
💡 Pro Tip
Store memories immediately after user interactions. Recall before generating responses. This creates a fast, accurate context layer for your agent.
Start using the REST API
Get your free API key and make your first memory call in under 5 minutes.
Get API Key →