# Cite an answer with TokenPath

Use TokenPath when you have a draft answer and the sources it draws on. Send them to `POST /v1/cite` to get the draft back with numbered citations, source quotes, and page numbers when available. For a PDF, you can also show the reader an image of the highlighted passage.

## Connect via MCP

Add `https://api.tokenpath.ai/mcp` to your MCP client as a remote Streamable HTTP server. Small calls work without credentials. To use an account key, configure the client to send an `Authorization: Bearer` header with the key. [Client setup examples](https://tokenpath.ai/citations.md#use-it-as-an-mcp-server)

Discover the tools with `tools/list`. Call `cite` with the following arguments:

```json
{
  "draft": "The annual base pay is $750,000.",
  "question": "How much is the annual base pay?",
  "sources": [{"id":"caldwell","title":"Caldwell MOU","url":"https://tokenpath.ai/demo-assets/caldwell-mou/caldwell-mou.pdf"}]
}
```

Return the numbered draft and the source quote. For an image, call `show_evidence` with the returned `citation_id` from a PDF citation with `source.image_available`. The tool returns the highlighted crop as MCP image content. Set `page` to a cited physical page number to see that whole page. Keep the receipt private.

## Make your first HTTP call

This example uses a [public contract](https://tokenpath.ai/demo-assets/caldwell-mou/caldwell-mou.pdf). Small requests work without an account or API key. Run the examples in the same shell with curl and jq.

```sh
umask 077
work=$(mktemp -d)
curl --fail-with-body -sS https://api.tokenpath.ai/v1/cite --json '{
  "question": "How much is the annual base pay?",
  "draft": "The annual base pay is $750,000.",
  "sources": [{
    "id": "caldwell",
    "title": "Caldwell MOU",
    "url": "https://tokenpath.ai/demo-assets/caldwell-mou/caldwell-mou.pdf"
  }]
}' -o "$work/cite.json" &&
jq -r '.cited_draft, (.citations[] | "[\(.number)] \(.source.title // .source.id) — \(.source.quote)")' "$work/cite.json"
```

For this example, the answer is “The annual base pay is $750,000 [1].” The supporting clause appears on physical page 1. For your own draft, use the returned `cited_draft` and each citation's `number`, `source.quote`, `source.pages`, and `source.original_url` when present. Review the quote in context before presenting it to the reader. Leave phrases in `unmatched` uncited. If the response has no citations, report that TokenPath returned no citation for this draft.

## Show a PDF passage

A quote and page link often suffice. When the reader needs the original layout, fetch the image for a citation with `source.image_available` and a `citation_id`. This call uses the receipt from the previous response.

```sh
jq -ce 'first(.citations[] | select(.citation_id and .source.image_available) |
  {citation_id, format:"png"}) // error("No PDF image available")' \
  "$work/cite.json" > "$work/image-request.json" &&
curl --fail -sS https://api.tokenpath.ai/v1/show_evidence \
  -H 'Content-Type: application/json' --data-binary "@$work/image-request.json" \
  -o "$work/evidence.png"
```

Attach the resulting PNG in your reply. To show a whole cited page, add `"full_page": true` and a `"page"` number from `source.pages` to the image request. Receipt IDs are private and expire. Share the quote, original source link, or downloaded image with the reader. If a receipt is missing or expired, the quote in the original response is still usable.

## Use the reader's sources

| What you can access | What to send |
| --- | --- |
| Text, retrieved passages, or the contents of a private page | A source with a unique `id` and `text`. An optional `url` gives the reader a permalink. |
| A publicly accessible PDF or webpage | A source with `id` and `url`. TokenPath fetches the document. |
| A local PDF or an attachment your tool can read as bytes | Send one file as multipart `file` with a `draft`, or supply standard base64 PDF bytes in `sources[].pdf_base64` for a JSON request. |
| An attachment your tool cannot read | Ask for an accessible PDF link or the relevant text. A filename or private chat attachment link does not supply PDF bytes. |

A PDF needs extractable text. Pasted text produces quote citations. To get an original-page image, send the PDF itself or its accessible URL. See [citation input examples and receipt details](https://tokenpath.ai/citations.md).

## Limits and access

A keyless call accepts 1–8 sources, up to 20,000 combined source characters (including two separator characters between sources), and up to 2,000 characters each for draft and question. PDF limits include 200 pages per file and 8 MiB combined PDF bytes per request. If the request exceeds a limit, narrow it to the relevant material or use [account access](https://tokenpath.ai/auth.md) for higher character limits. On HTTP 429, respect `Retry-After`.

Free accounts include 100 requests per month. Pro includes 2,000 requests for $10 per month. One citation request covers up to 10,000 tokens across sources, question, and draft. Larger calls round up. Opening evidence is free. See [pricing](https://tokenpath.ai/#pricing).
