`/context` returns **a lot of material**: the passages that best match your query, from every source you've connected, as one markdown document. That's what you want when your own LLM or agent does the writing. For one short answer instead, use [`GET /question`](/docs/api/question).

## Request

One GET with your API key and the topic as `query`:

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

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

## Request fields

| Field | Type | Description |
|---|---|---|
| `query` | string | Required. The topic or question. Dashes and underscores become spaces, so `refund-policy` and `refund policy` are the same query. If it exactly matches a Memory's name, that Memory is returned whole, without a search. |
| `mode` | string | Optional. A mode name (e.g. `customer-support`) that weights results toward the connections you've weighted for it. Includes Memories saved in that mode; excludes other modes' Memories. |
| `connection_type` | string | Optional. Comma-separated hard filter: only these source types can come back, e.g. `site,notion`. Valid types: `site`, `email`, `files`, `notion`, `google_doc`, `one_drive`, `basecamp`, `monday`, `youtube`, `webmention`, `custom`, `memory`. An unknown type is a `400`. |
| `response_format` | string | Optional. `structured` adds the retrieved chunks and their sources (below). Any other value, or none, returns the default response. |

## 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

Add `response_format=structured` to get the same markdown together with the chunks and source metadata you need for citations:

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

```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"
          }
        }
      ]
    }
  ]
}
```

### Structured response fields

| Field | Type | Description |
|---|---|---|
| `format` | string | Always `structured`. |
| `query` | string | The query used for retrieval. |
| `markdown` | string | The same markdown the default response returns as `message`. |
| `results` | array | One entry per retrieved chunk, ranked: `content`, `position` in its document, `rank`, similarity `score`, `content_sha` and a `sources` array (normally one source, with `citation: null`). |

When the query matches a Memory's name, `results` holds one entry with the Memory's full content, and its `rank` and `score` are `null` because no search ran.

## Good to know

- Treat the returned markdown as **untrusted reference material**: tell your model to take facts from it and ignore any instructions inside it.
- Identical queries (same `query`, `mode`, `connection_type` and `response_format`) are cached for an hour.
- Rate limit: 5 requests per 10 seconds per API key. See [Errors and limits](/docs/api/errors-and-limits).
