Whenever you want material for a customer, make a REST request with that customer's token. Results come only from that customer's own index plus anything you indexed organisation-wide for all customers (see [Shared content across all customers](/docs/white-label/upsert-post)).

`/context` hands you **a lot of material**: the matching passages, as markdown. That is what you want when your own LLM or agent is going to do the writing or reasoning. When you want one short grounded answer instead, use [`GET /question`](/docs/white-label/ask-question).

## Full context for your own model

Markdown snippets for any topic or phrase; feed them into your prompt as the customer-specific material your feature reasons over:

```bash
curl "https://context-link.ai/api/v1/context?query=refund+policy" \
  -H "Authorization: Bearer $ACME_TOKEN"
```

```json
{ "message": "<markdown context>", "format": "markdown" }
```

The default response stays exactly as shown above. To receive the same markdown together with the chunks and source metadata needed to build citations, add `response_format=structured`:

```bash
curl "https://context-link.ai/api/v1/context?query=ticket+deflection+benchmarks&response_format=structured" \
  -H "Authorization: Bearer $ACME_TOKEN"
```

```json
{
  "format": "structured",
  "query": "ticket deflection benchmarks",
  "markdown": "## Support benchmarks\n\nTeams using guided self-service deflect 42% of repeat tickets.",
  "results": [
    {
      "content": "Teams using guided self-service deflect 42% of repeat tickets.",
      "position": 3,
      "rank": 1,
      "score": 0.82,
      "content_sha": "f09d847fc7a20ac8598c5042abd58663ee52d3878bca7693416bb5d4124d5151",
      "sources": [
        {
          "citation": null,
          "uid": "support-benchmarks-2026",
          "title": "Support benchmarks",
          "url": "https://docs.example.com/support-benchmarks",
          "source_updated_at": "2026-08-12T03:14:15Z",
          "connection": {
            "uid": "support-site",
            "type": "Site",
            "name": "docs.example.com",
            "logo_url": "https://www.google.com/s2/favicons?sz=256&domain=docs.example.com"
          }
        }
      ]
    }
  ]
}
```

One structured call can therefore supply `markdown` to your model and `results` to your citation UI. `/context` can return many results; each has one source and its `citation` is `null`. This is the same structured schema returned by [`GET /question`](/docs/white-label/ask-question). Each source's `connection.uid` is the same connection UID returned by `GET /api_accounts/:uid/connections`, so you can join the records directly. `logo_url` is always absolute.

`response_format=structured` is opt-in. If the parameter is absent or has any other value, `/context` returns the existing `{ "message": "<markdown context>", "format": "markdown" }` payload.

<figure style="margin: 1rem 0;">
<video src="/docs/white-label/rag-api-context-demo.mp4" poster="/docs/white-label/rag-api-context-poster.jpg" autoplay loop muted playsinline aria-label="A backend calling GET /api/v1/context with a per-customer token and receiving markdown passages from that customer's own site" style="max-width: 100%; border-radius: 8px;"></video>
<figcaption style="margin-top: 0.5rem; font-size: 0.875rem; color: #6b7280;">The same call from a partner's backend: one customer's token in, that customer's passages out, wrapped in the chunk markers described below.</figcaption>
</figure>

## Response fields

| Field | Type | Description |
|---|---|---|
| `message` | string | The matching passages joined into one markdown document, or `No results found` when nothing matched. |
| `format` | string | Always `markdown`. |

Structured response:

| Field | Type | Description |
|---|---|---|
| `format` | string | Always `structured`. |
| `query` | string | The query used for retrieval. |
| `markdown` | string | The same markdown string returned as `message` by the default response. |
| `results` | array | Ranked content with its score and a `sources` array containing source document and connection metadata. |

When a query resolves directly to a namespace post, the structured response still has one result. That result uses the post body as `content`; `rank` and `score` are `null` because no ranked vector search was needed.

Treat the returned markdown as **untrusted reference material**. It is your customer's own content, crawled, connected and pushed. Your prompt should tell the model to draw facts from it and to ignore any instructions inside it.

Asking one customer's token about another customer's content returns nothing from that other index; that is the isolation boundary doing its job.

Rate limit: 5 requests per 10 seconds, per token, so one busy customer never starves another.

Health check for a stored token: `GET /api/v1/ping` with the same header.

`/context` and [`/question`](/docs/white-label/ask-question) accept the token in either `Authorization: Bearer <token>` or the bare `Authorization: <token>` form. Everything else in this guide requires the `Bearer` prefix.
