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 byDocumentation Index
Fetch the complete documentation index at: https://docs.graphorlm.com/llms.txt
Use this file to discover all available pages before exploring further.
/ask-sources without paying the payload cost of inlining base64 in the answer.
Endpoint overview
HTTP Method
GET
Authentication
This endpoint requires authentication using an API token. Include your API token as a Bearer token in theAuthorization 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-sourcesresponse does not includeimage_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 aCache-Control: public, max-age=3600hint so browsers and CDNs can cache the image bytes. - Prefer this endpoint over passing
include_citation_images=trueto/ask-sourceswhenever the answer may cite many pages, or when latency / payload size matters.
Request format
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer YOUR_API_TOKEN | Yes |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | UUID of the source file. Same value returned in citations[].file_id from /ask-sources. |
page_number | integer | Yes | 1-based page number. For image-type files, must be 1. |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
max_width | integer | No | Pixel width cap for the rendered image. Clamped to 300-1600. Default: 900. |
Supported file types
| Type | Extensions | Notes |
|---|---|---|
| PDFs | pdf | Any 1-based page number. |
| Images | png, jpg, jpeg, webp, gif, etc. | page_number must be 1. |
| Office documents | doc, docx, ppt, pptx, odt | Rendered from the auto-converted PDF. |
404.
Response format
Success response (200 OK)
| Field | Type | Description |
|---|---|---|
file_id | string | UUID of the source file. |
file_name | string | Display name of the source file. May be null. |
page_number | integer | 1-based page number that was rendered. |
mime_type | string | MIME type of the encoded image (always "image/png"). |
width | integer | Pixel width of the rendered image. |
height | integer | Pixel height of the rendered image. |
image_base64 | string | Base64-encoded PNG image bytes. |
Error responses
| Status | Description |
|---|---|
401 | Unauthorized — invalid or missing API token. |
404 | File not found, unsupported file type, or invalid page number. |
500 | Unexpected internal error while rendering. |
Examples
cURL
Python (rendering and saving a citation)
JavaScript (decoding and rendering inline)
Best practices
- Lazy-load on user interaction — call this endpoint only when the user hovers, clicks, or expands a citation. Most citations are never inspected.
- Cache by
(file_id, page_number)— the response is deterministic for a given key. The endpoint returnsCache-Control: public, max-age=3600; respect it on the client to avoid re-rendering the same page. - Pick
max_widthfor the surface you’re rendering —500for tooltips/popovers,900(default) for inline cards,1200+ only when the user opens a full preview. - Combine with
/ask-sourcescitations — pair this endpoint with the structuredcitationsarray from/ask-sourcesrather than parsing the inline[N]markup.
Related
Chat API
Ask questions and receive grounded answers with citations
List Sources
Discover the
file_id values you can pass here
