Browse docs

Getting Started
Tap to expand
StartUpdated 2026-05-30

Raw HTTP Quickstart

Use RetainDB over HTTP for memory, company brain queries, and sources.

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

Environment

bash
export RETAINDB_API_KEY="rdb_..."
export RETAINDB_API_URL="https://api.retaindb.com"
export RETAINDB_PROJECT="quickstart"

1. Write One Memory

bash
curl -X POST "$RETAINDB_API_URL/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"
  }'

2. Search Memory

bash
curl -X POST "$RETAINDB_API_URL/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
  }'

3. Add A Company Brain Source

bash
curl -X POST "$RETAINDB_API_URL/v1/sources" \
  -H "Authorization: Bearer $RETAINDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "quickstart",
    "type": "text",
    "name": "Billing Runbook",
    "config": {
      "content": "Billing retries happen automatically for 3 days before escalation."
    }
  }'

4. Check Source Status

bash
curl "$RETAINDB_API_URL/v1/sources?project=quickstart" \
  -H "Authorization: Bearer $RETAINDB_API_KEY"

Wait until the source is ready or indexed.

5. Ask The Company Brain

bash
curl -X POST "$RETAINDB_API_URL/v1/context" \
  -H "Authorization: Bearer $RETAINDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "quickstart",
    "query": "What happens after billing retries fail?",
    "max_results": 8
  }'

Common Checks

  • Use the same project across memory, sources, and company brain queries.
  • Use the same user_id and session_id across memory write/search.
  • Include include_pending: true immediately after async memory writes.
  • Do not rely on a source until it is ready or indexed.
  • Log trace_id when reporting support issues.

Next: Company Brain API, Sources API, or Memory API.

Was this page useful?

Your feedback helps us make the product easier to ship with.