Quick setup examples

cURL Quickstart

Call the Unison brain directly from the terminal — recall context and persist new memory with two curl commands.

The fastest way to verify your token and explore the API. No dependencies; just curl and a terminal.

Prerequisites

Get a token at app.unisonlabs.ai and export it:

export UNISON_TOKEN=usk_live_...

Recall — fetch prompt-ready context

curl -G "https://brain.unisonlabs.ai/v1/brain/context" \
  --data-urlencode "q=payment service architecture" \
  -d "k=5" \
  -d "mode=auto" \
  -H "Authorization: Bearer $UNISON_TOKEN"

Response shape:

{
  "weakEvidence": false,
  "contextMd": "## Relevant context\n...",
  "hits": [...]
}

Inject contextMd into your prompt. When weakEvidence is true the brain has nothing confident — skip injection or prompt the model to answer without prior context.

Persist — write memory to the brain

curl -s -X POST "https://brain.unisonlabs.ai/v1/brain/ingest" \
  -H "Authorization: Bearer $UNISON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "type": "conversation",
        "turns": [
          { "role": "user",      "content": "What queue library should we use?" },
          { "role": "assistant", "content": "Switched to pgmq — simpler ops than Redis." }
        ],
        "sourceRef": "session-1",
        "visibility": "private"
      }
    ]
  }'

Response:

{
  "items": [
    { "type": "conversation", "jobId": "job_..." }
  ]
}

The jobId tracks async indexing. Recall queries will reflect the new memory within seconds.

On this page