Skip to main content
The Get Page Screenshot endpoint renders one page of a source file (PDF, image, or Office document) as a base64-encoded PNG. Use it to lazily fetch the visual preview of a citation returned by /ask-sources without paying the payload cost of inlining base64 in the answer.

Endpoint overview

Authentication

This endpoint requires authentication using an API token. Include your API token as a Bearer token in the Authorization header.
Learn how to create and manage API tokens in the API Tokens guide.

When to use this endpoint

This is the recommended way to display page previews for citations returned by /ask-sources.
  • The default /ask-sources response does not include image_base64 — clients should call this endpoint per citation, only when the user actually needs to see the page (e.g. on hover, on click, or when rendering a side panel).
  • Each render is keyed by (file_id, page_number) and returns a Cache-Control: public, max-age=3600 hint so browsers and CDNs can cache the image bytes.
  • Prefer this endpoint over passing include_citation_images=true to /ask-sources whenever the answer may cite many pages, or when latency / payload size matters.

Request format

Headers

Path parameters

Query parameters

Supported file types

Plain-text and other non-visual formats are not supported and will return 404.

Response format

Success response (200 OK)

Error responses

Examples

cURL

Python (rendering and saving a citation)

JavaScript (decoding and rendering inline)

Best practices

  1. Lazy-load on user interaction — call this endpoint only when the user hovers, clicks, or expands a citation. Most citations are never inspected.
  2. Cache by (file_id, page_number) — the response is deterministic for a given key. The endpoint returns Cache-Control: public, max-age=3600; respect it on the client to avoid re-rendering the same page.
  3. Pick max_width for the surface you’re rendering500 for tooltips/popovers, 900 (default) for inline cards, 1200+ only when the user opens a full preview.
  4. Combine with /ask-sources citations — pair this endpoint with the structured citations array from /ask-sources rather than parsing the inline [N] markup.

Chat API

Ask questions and receive grounded answers with citations

List Sources

Discover the file_id values you can pass here