# Capture a public webpage from n8n

This recipe uses n8n's **HTTP Request** node and stores the Latchshot key in a credential instead of the workflow JSON. You can also import immutable [workflow release v1.0.1](https://github.com/BaiqingL/latchshot-n8n/releases/tag/v1.0.1), use the accepted [Awesome n8n Templates community copy](https://github.com/enescingoz/awesome-n8n-templates/blob/main/Other_Integrations_and_Use_Cases/Latchshot%20%E2%80%94%20capture%20a%20public%20webpage.json), or review its [public source and validator](https://github.com/BaiqingL/latchshot-n8n) before selecting the credential. The community catalog is independent rather than an official n8n Marketplace listing. The [production-hosted copy](https://latchshot.fly.dev/integrations/n8n-website-screenshot.json) is byte-for-byte identical.

## Configure the credential

1. In n8n, create a new **Bearer Auth** credential.
2. Paste the actual `ls_live_...` token into the token field. n8n adds the `Authorization: Bearer` header.
3. Restrict credential sharing to the workflows that need page capture.

## Configure the HTTP Request node

| Setting | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://latchshot.fly.dev/v1/render` |
| Authentication | Generic Credential Type → Bearer Auth |
| Send Body | Enabled |
| Body Content Type | JSON |
| Response Format | File |
| Put Output in Field | `data` |
| Timeout | `45000` ms |

Use this JSON body, replacing the URL expression with the field produced by the preceding node:

```json
{
  "url": "{{ $json.url }}",
  "kind": "screenshot",
  "format": "png",
  "width": 1440,
  "height": 900,
  "fullPage": false,
  "delayMs": 250
}
```

The result is available as binary field `data`. Connect a storage, email, or upload node and select that field. For PDF output, set `kind` to `pdf`, set `format` to `pdf`, and optionally add `paper` (`A4`, `Letter`, or `Legal`) and `landscape`.

The downloadable starter uses current n8n node versions, writes the binary result to `capture`, and deliberately omits the credential reference so no key or instance-specific credential ID enters the file. The full [n8n website screenshot workflow guide](https://latchshot.fly.dev/guides/n8n-website-screenshot-workflow.html) covers import, execution, downstream file routing, PDF changes, retries, and network boundaries.

## Failure handling

- Route `400` and `401` to a permanent-error branch; changing the retry count will not fix an invalid URL or key.
- Retry `429`, `502`, `503`, and `504` at most twice with an increasing delay.
- Keep the workflow concurrency bounded. Latchshot queues work, but a large fan-out only increases latency.
- Query `GET https://latchshot.fly.dev/v1/usage` with the same credential before large batches.

Only public pages on standard web ports are supported. The n8n host's ability to reach an internal URL does not make that URL reachable by Latchshot.
