Browse docs

Getting Started

Tap to expand
StartUpdated 2026-05-25

Raw HTTP Quickstart

Write and search memory with curl against the RetainDB API.

Use raw HTTP when you are not using the TypeScript SDK or when you want to verify the API directly.

Write one memory

bash
curl -X POST "https://api.retaindb.com/v1/memory" \
  -H "Authorization: Bearer $RETAINDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "quickstart",
    "user_id": "user_123",
    "session_id": "session_001",
    "content": "User prefers concise technical answers.",
    "memory_type": "preference",
    "write_mode": "async"
  }'

Search memory

bash
curl -X POST "https://api.retaindb.com/v1/memory/search" \
  -H "Authorization: Bearer $RETAINDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "quickstart",
    "user_id": "user_123",
    "query": "How should I answer this user?",
    "include_pending": true,
    "top_k": 5
  }'

Common checks

  • Use the same project, user_id, and session_id across write and search.
  • Include include_pending: true immediately after async writes.
  • Log trace_id when reporting support issues.

Next: Memory API reference.

Was this page helpful?

Your feedback helps us prioritize docs improvements weekly.