Privilege protected
Namespace isolation ensures one firm's memories never touch another's. Every API key maps to a dedicated tenant_id — enforced at the query level, not the application level.
Namespace-isolated, audit-logged semantic memory exposed as a simple HTTP API. Pay per call in USDC on Base — or a flat monthly rate through Stripe. Designed for the standards of practice, not consumer chat.
# Recall the top 5 semantically relevant
# memories for a specific matter.
import httpx
r = httpx.post(
"https://api.lawmem.ai/recall",
headers={"Authorization": f"Bearer {KEY}"},
json={
"query": "NDA breach damages New York",
"matter_id": "case-2024-001",
"top_k": 5,
},
)
for hit in r.json()["results"]:
print(hit["score"], hit["text"][:80])
Three properties every legal workflow needs, engineered into the data layer — not bolted on at the application layer.
Namespace isolation ensures one firm's memories never touch another's. Every API key maps to a dedicated tenant_id — enforced at the query level, not the application level.
Every store and recall is logged with timestamp, wallet, agent ID, and query. A PostgreSQL audit trail designed for e-discovery and compliance review. DPA available to Legal Pro customers.
Powered by nomic-embed-text — 768-dimensional cosine similarity optimised for dense legal text: contracts, pleadings, depositions, and case notes.
Your agent issues HTTP requests. LawMem handles embeddings, vector search, namespace enforcement, audit logging, and payment — so your agent code stays about the agent.
First 1,000 calls are free — no API key purchase required. After the free tier, x402 payment on Base network handles billing automatically.
# Store a memory
curl -X POST https://api.lawmem.ai/store \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Client retained firm for M&A due
diligence. Target: Acme Corp. NDA
signed 2024-01-15. Closing Q2 2024.",
"matter_id": "matter-acme-2024",
"agent_id": "due-diligence-agent",
"source_doc": "retainer_letter.pdf"
}'
# Recall semantically relevant memories
curl -X POST https://api.lawmem.ai/recall \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "M&A due diligence NDA",
"matter_id": "matter-acme-2024",
"top_k": 5
}'
import httpx
BASE = "https://api.lawmem.ai"
KEY = "YOUR_KEY"
HDR = {"Authorization": f"Bearer {KEY}"}
def store(text, matter_id, agent_id="agent",
source_doc=None):
r = httpx.post(f"{BASE}/store",
headers=HDR,
json={
"text": text,
"matter_id": matter_id,
"agent_id": agent_id,
"source_doc": source_doc,
}
)
if r.status_code == 402:
handle_payment(r)
return
r.raise_for_status()
return r.json()["id"]
def recall(query, matter_id=None, top_k=5):
r = httpx.post(f"{BASE}/recall",
headers=HDR,
json={
"query": query,
"matter_id": matter_id,
"top_k": top_k,
}
)
if r.status_code == 402:
handle_payment(r)
return []
r.raise_for_status()
return r.json()["results"]
const BASE = "https://api.lawmem.ai";
const KEY = "YOUR_KEY";
async function store(text, matterId, agentId) {
const res = await fetch(`${BASE}/store`, {
method: "POST",
headers: {
"Authorization": `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: text,
matter_id: matterId,
agent_id: agentId,
}),
});
if (res.status === 402) {
const body = await res.json();
await handleX402Payment(body);
return;
}
return (await res.json()).id;
}
async function recall(query, matterId, topK=5) {
const res = await fetch(`${BASE}/recall`, {
method: "POST",
headers: {
"Authorization": `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: query,
matter_id: matterId,
top_k: topK,
}),
});
if (res.status === 402) {
await handleX402Payment(await res.json());
return [];
}
const { results } = await res.json();
return results;
}
Pick what fits your role — we'll send a PDF walk-through by email, and occasionally a new pattern or case study when it's worth your time.
The guide is on its way. If you don't see it in two minutes, check spam and add david@lawmem.ai to your safe senders.
Subscription plans via Stripe. Pay-as-you-go via x402 on Base. No credit card for free tier.
TLS 1.3 via Let's Encrypt. Auto-renewed. HSTS enabled.
Every API key is bound to a tenant_id. No cross-tenant data leakage — enforced at query level.
Every store, recall, and delete recorded in PostgreSQL with wallet, timestamp, and query hash.
DPA available to Legal Pro customers.
Receiver wallet: 0x5F503…1fEAD
DELETE /memory/{id} performs a hard delete from both vector store and PostgreSQL for legal compliance.