Skip to main content

Quickstart

Get your first memory stored and recalled in under 5 minutes.

1. Get Your API Key

Sign up at portal.lawmem.ai. Your API key is available immediately on the free tier (1,000 lifetime calls). No credit card required.

2. Store a Memory

curl -X POST https://api.lawmem.ai/store \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Client Acme Corp is negotiating a SaaS agreement. Key issue: EU data residency.",
"namespace": "acme-corp",
"metadata": {"matter": "saas-2026", "author": "agent-1"}
}'

Response:

{
"id": "mem_a1b2c3d4",
"namespace": "acme-corp",
"tokens": 22,
"created_at": "2026-03-21T12:00:00Z"
}

3. Recall Memories

curl -X POST https://api.lawmem.ai/recall \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the data residency requirements for Acme Corp?",
"namespace": "acme-corp",
"top_k": 5
}'

Response:

{
"results": [
{
"id": "mem_a1b2c3d4",
"text": "Client Acme Corp is negotiating a SaaS agreement. Key issue: EU data residency.",
"score": 0.94,
"metadata": {"matter": "saas-2026", "author": "agent-1"},
"created_at": "2026-03-21T12:00:00Z"
}
],
"namespace": "acme-corp",
"query_tokens": 12
}

4. Python Example

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://api.lawmem.ai"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}

# Store a memory
res = requests.post(f"{BASE_URL}/store", headers=HEADERS, json={
"text": "Client prefers arbitration over litigation for all disputes.",
"namespace": "client-123",
"metadata": {"type": "preference"}
})
print(f"Stored: {res.json()['id']}")

# Recall memories
res = requests.post(f"{BASE_URL}/recall", headers=HEADERS, json={
"query": "How does this client want to resolve disputes?",
"namespace": "client-123",
"top_k": 3
})
for r in res.json()["results"]:
print(f"Score {r['score']:.2f}: {r['text']}")

5. JavaScript Example

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://api.lawmem.ai';
const headers = {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
};

// Store a memory
const storeRes = await fetch(`${BASE_URL}/store`, {
method: 'POST', headers,
body: JSON.stringify({
text: 'Opposing counsel is Miller and Associates. Lead: James Miller.',
namespace: 'matter-456',
metadata: { type: 'opposing-counsel' }
})
});
const memory = await storeRes.json();
console.log('Stored:', memory.id);

// Recall memories
const recallRes = await fetch(`${BASE_URL}/recall`, {
method: 'POST', headers,
body: JSON.stringify({
query: 'Who is opposing counsel on this matter?',
namespace: 'matter-456',
top_k: 3
})
});
const results = await recallRes.json();
results.results.forEach(r =>
console.log(`Score ${r.score.toFixed(2)}: ${r.text}`)
);

Next Steps