Authentication
API keys, JWT tokens, and authentication methods
Authentication
Every request to the Engram API requires authentication. Engram uses API keys for server-to-server communication and JWT tokens for dashboard access.
Base URL
https://api.engrammemory.ai/v1
API Key Format
Engram issues two types of API keys:
| Prefix | Environment | Purpose |
|---|---|---|
pr_live_* | Production | Live traffic, usage counted against quota |
pr_test_* | Test | Development and testing, relaxed rate limits |
Authentication Header
Include your API key as a Bearer token in the Authorization header:
Authorization: Bearer pr_live_xxxxx
All requests must also include:
Content-Type: application/json
Create API Key
<div class="method-badge post">POST</div> `/v1/keys`Creates a new API key. This is the signup endpoint — no prior authentication required.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Account email address |
name | string | No | Display name for the account |
vector_db_url | string | No | Your vector database instance URL. If omitted, overflow storage is available. |
Code Examples
cURL
curl -X POST https://api.engrammemory.ai/v1/keys \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"name": "My App",
"vector_db_url": "https://my-vectordb.example.com:6333"
}'
Python
import requests
response = requests.post(
"https://api.engrammemory.ai/v1/keys",
json={
"email": "[email protected]",
"name": "My App",
"vector_db_url": "https://my-vectordb.example.com:6333"
}
)
data = response.json()
api_key = data["api_key"]
JavaScript
const response = await fetch("https://api.engrammemory.ai/v1/keys", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "[email protected]",
name: "My App",
vector_db_url: "https://my-vectordb.example.com:6333"
})
});
const data = await response.json();
const apiKey = data.api_key;
Response — 201 Created
{
"api_key": "pr_live_a1b2c3d4e5f6...",
"tier": "free",
"vector_db_url": "https://my-vectordb.example.com:6333",
"message": "API key created. Store this key securely — it cannot be retrieved again."
}
Errors
| Status | Code | Description |
|---|---|---|
409 | EMAIL_EXISTS | An account with this email already exists |
422 | VALIDATION_ERROR | Missing or invalid fields |
Check Usage
<div class="method-badge get">GET</div> `/v1/keys/usage`Returns current usage metrics for the authenticated API key.
Authentication required.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
detailed | boolean | No | Return per-endpoint breakdown. Default: false |
Code Examples
cURL
curl -X GET "https://api.engrammemory.ai/v1/keys/usage?detailed=true" \
-H "Authorization: Bearer pr_live_xxxxx"
Python
import requests
response = requests.get(
"https://api.engrammemory.ai/v1/keys/usage",
headers={"Authorization": "Bearer pr_live_xxxxx"},
params={"detailed": "true"}
)
usage = response.json()
print(f"Used: {usage['requests_used']} / {usage['requests_limit']}")
JavaScript
const response = await fetch(
"https://api.engrammemory.ai/v1/keys/usage?detailed=true",
{ headers: { "Authorization": "Bearer pr_live_xxxxx" } }
);
const usage = await response.json();
console.log(`Used: ${usage.requests_used} / ${usage.requests_limit}`);
Response — 200 OK
{
"tier": "builder",
"requests_used": 4821,
"requests_limit": 50000,
"memories_stored": 1200,
"memories_limit": 100000,
"reset_date": "2026-05-01T00:00:00Z",
"detailed": {
"intelligence": 3100,
"store": 890,
"search": 620,
"embed": 211
}
}
Errors
| Status | Code | Description |
|---|---|---|
401 | UNAUTHORIZED | Missing or invalid API key |
Login (JWT)
<div class="method-badge post">POST</div> `/v1/auth/login`Exchange an API key for a short-lived JWT token. Used by the Engram dashboard and client applications that need session-based authentication.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | Yes | Your Engram API key |
Code Examples
cURL
curl -X POST https://api.engrammemory.ai/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"api_key": "pr_live_xxxxx"
}'
Python
import requests
response = requests.post(
"https://api.engrammemory.ai/v1/auth/login",
json={"api_key": "pr_live_xxxxx"}
)
data = response.json()
jwt_token = data["access_token"]
# Use JWT for subsequent dashboard requests
headers = {"Authorization": f"Bearer {jwt_token}"}
JavaScript
const response = await fetch("https://api.engrammemory.ai/v1/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ api_key: "pr_live_xxxxx" })
});
const data = await response.json();
const jwtToken = data.access_token;
Response — 200 OK
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600,
"user": {
"email": "[email protected]",
"name": "My App",
"tier": "builder",
"created_at": "2026-03-15T08:30:00Z"
}
}
Errors
| Status | Code | Description |
|---|---|---|
401 | INVALID_API_KEY | API key is invalid or revoked |
422 | VALIDATION_ERROR | Missing api_key field |
Tier System
Engram offers four tiers with progressive limits:
| Free | Builder | Scale | Enterprise | |
|---|---|---|---|---|
| Price | $0/mo | $29/mo | $99/mo | Custom |
| Tokens / month | 100K | 2M | 25M | Unlimited |
| Queries / month | 1K | 20K | 250K | Unlimited |
| Compression vectors / month | 10K | 500K | 10M | Unlimited |
| Collections | 1 | 3 | 25 | Unlimited |
| Webhooks | 1 | 5 | 25 | Unlimited |
| Deduplication | -- | Yes | Yes | Yes |
| Embedding dimensions | 768 | 768 | 768 | 768 |
| Compression | Advanced | Advanced | Advanced | Advanced |
| Support | Community | Priority | Dedicated |
All tiers include the full intelligence pipeline: embedding, classification, deduplication, and compression. There are no feature gates — only volume limits.
Upgrading
Tier upgrades take effect immediately. Contact [email protected] for Enterprise pricing or to discuss custom limits.