> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snapopa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Screenshot, PDF and Metadata Endpoints

> Type-specific endpoints that only accept the options that apply to their output

`/capture` keeps working as before. You can also call one endpoint per output type. Each one only accepts the options that apply to it, so a typo or an option that does nothing is rejected with a `400` instead of being ignored.

| Endpoint | Returns | Token cost |
| - | - | - |
| `POST /screenshot` | PNG, JPEG or WebP | Same as `/capture` |
| `POST /pdf` | PDF | Same as `/capture` |
| `POST /metadata` | JSON with title, description, Open Graph, Twitter card tags and icons | 1 token per successful call |

All three use the same `Authorization: Bearer` API key as `/capture`.

## POST /screenshot

Takes the same body as `/capture`, except `format` must be `png`, `jpeg` or `webp`, and the `pdf` options are not accepted.

```json theme={null}
{
  "url": "https://example.com",
  "format": "webp",
  "quality": 85,
  "isFullPage": true
}
```

The response is the same as `/capture`.

## POST /pdf

Takes the shared options (`url` or `html`, `responseType`, `responseCache`, `cdnTtl`, `async`, `timeout`, `waitUntil`, `imageLoadTimeout`, `delay`, `antiBot`, `block`, `colorScheme`) plus these PDF options. Image options (`format`, `quality`, `viewport`, `isFullPage`) are not accepted.

| Option | Type | Default | Description |
| - | - | - | - |
| `paper` | `A3`, `A4`, `A5`, `Letter`, `Legal`, `Tabloid` | `A4` | Paper size |
| `landscape` | boolean | `false` | Landscape orientation |
| `printBackground` | boolean | `true` | Print background colors and images |
| `scale` | number, 0.1 to 2 | `1` | Rendering scale |
| `margin` | object with `top`, `right`, `bottom`, `left` | all `"0"` | CSS lengths in `px`, `in`, `cm` or `mm`, for example `"10mm"` |
| `pageRanges` | string | all pages | For example `"1-5, 8"` |
| `headerTemplate` | string | none | HTML for the page header |
| `footerTemplate` | string | none | HTML for the page footer |

Header and footer templates can use elements with the classes `date`, `title`, `url`, `pageNumber` and `totalPages`. Leave room for them with a top or bottom margin.

```json theme={null}
{
  "url": "https://example.com",
  "paper": "Letter",
  "landscape": true,
  "margin": { "top": "15mm", "bottom": "15mm", "left": "10mm", "right": "10mm" },
  "footerTemplate": "<div style=\"font-size:9px;width:100%;text-align:center\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>"
}
```

> [!NOTE]
>
> On `/capture` with `"format": "pdf"`, you can pass the same options inside a `pdf` object.

## POST /metadata

Reads the page's HTML without a browser, so it is fast. Tags that the page adds with JavaScript after it loads are not included.

```json theme={null}
{
  "url": "https://example.com",
  "timeout": 10000
}
```

```json theme={null}
{
  "success": true,
  "error": null,
  "data": {
    "url": "https://example.com",
    "finalUrl": "https://example.com/",
    "statusCode": 200,
    "title": "Example Domain",
    "description": null,
    "canonical": null,
    "lang": "en",
    "themeColor": null,
    "robots": null,
    "viewport": "width=device-width, initial-scale=1",
    "charset": "utf-8",
    "openGraph": {},
    "twitter": {},
    "icons": [
      { "href": "https://example.com/favicon.ico", "rel": "icon", "declared": false }
    ],
    "tokenCost": 1,
    "processingTimeMs": 182
  }
}
```

* `openGraph` and `twitter` hold the tags without their `og:` and `twitter:` prefix, for example `openGraph.image`. Image and URL values are made absolute.
* `icons` lists every declared icon. If the page declares none, it holds `/favicon.ico` with `declared: false`.
* Failed fetches are not charged. A page that is not HTML returns `422`, and a page that cannot be reached returns `502`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.