Multi-output extraction
Extract multiple output types from a single page load
Multi-output extraction
Extract screenshots, PDFs, HTML, markdown, and structured JSON data from a single page load using the outputs array. This eliminates redundant browser sessions when you need multiple formats from the same URL.
The outputs array
Add an outputs array to any screenshot request (sync, async, or bulk) to specify multiple output types:
{
"url": "https://example.com",
"outputs": [
{ "type": "screenshot", "format": "png", "fullPage": true },
{ "type": "pdf", "printBackground": true },
{ "type": "markdown", "mainContentOnly": true }
]
}When outputs is omitted, the API behaves exactly as before (backward compatible).
Output types
| Type | Description | Binary? | Content type |
|---|---|---|---|
screenshot | Image capture (PNG, JPEG, WebP) | Yes | image/png, image/jpeg, image/webp |
pdf | PDF document generation | Yes | application/pdf |
html | Raw HTML of the rendered page | No | text/html |
markdown | Markdown conversion of the page | No | text/markdown |
json | Structured data extraction via CSS selectors | No | application/json |
Output-specific options
Screenshot
| Option | Type | Default | Description |
|---|---|---|---|
format | string | "png" | Image format: png, jpeg, webp |
quality | integer | 80 | Quality for JPEG/WebP (1-100) |
fullPage | boolean | false | Capture the full scrollable page |
selector | string | - | CSS selector to capture a specific element |
| Option | Type | Default | Description |
|---|---|---|---|
printBackground | boolean | true | Include background graphics |
format | string | - | Paper format (e.g. "A4", "Letter") |
landscape | boolean | false | Landscape orientation |
Markdown
| Option | Type | Default | Description |
|---|---|---|---|
mainContentOnly | boolean | false | Extract only main content (strips nav, footer, etc.) |
JSON (structured extraction)
Extract specific data from the page using CSS selectors:
| Option | Type | Required | Description |
|---|---|---|---|
schema | object | Yes | Map of field names to extraction rules |
Each field in the schema has:
| Option | Type | Default | Description |
|---|---|---|---|
selector | string | required | CSS selector to target |
type | string | "text" | Extraction type: text, html, or attribute |
attribute | string | - | Attribute name (required when type is attribute) |
multiple | boolean | false | Return array of all matches instead of first match |
Output IDs
Each output is identified by its type name (e.g., "screenshot", "markdown"). If you include two outputs of the same type, you must provide an id field to distinguish them:
{
"url": "https://example.com",
"outputs": [
{ "type": "screenshot", "id": "desktop", "format": "png" },
{ "type": "screenshot", "id": "element", "selector": ".hero" }
]
}Sync response
With a single output (or no outputs field), the response format depends on the responseType parameter. With multiple outputs, the response is always JSON.
By default (or with responseType: "base64"), binary outputs are base64-encoded inline:
{
"url": "https://example.com",
"outputs": {
"screenshot": {
"type": "screenshot",
"format": "PNG",
"contentType": "image/png",
"encoding": "base64",
"data": "iVBOR...",
"size": 245000
},
"markdown": {
"type": "markdown",
"contentType": "text/markdown",
"data": "# Example Domain\n\nThis domain is for use in illustrative examples...",
"size": 1200
}
},
"renderTimeMs": 1250
}Binary outputs (screenshot, PDF) are base64-encoded. Text outputs (HTML, markdown, JSON) are inline strings.
With responseType: "url", each output is stored on the CDN and the response contains URLs instead of inline data:
{
"url": "https://example.com",
"outputs": {
"screenshot": {
"type": "screenshot",
"contentType": "image/png",
"size": 245000,
"storageUrl": "https://storage.allscreenshots.com/abc123/screenshot.png",
"expiresAt": "2025-01-30T12:00:00Z"
},
"markdown": {
"type": "markdown",
"contentType": "text/markdown",
"size": 1200,
"storageUrl": "https://storage.allscreenshots.com/abc123/markdown.md",
"expiresAt": "2025-01-30T12:00:00Z"
}
},
"renderTimeMs": 1250
}Async response
Job creation is unchanged. The job status response includes an outputs map when the job used multi-output:
{
"id": "abc123",
"status": "COMPLETED",
"url": "https://example.com",
"resultUrl": "https://api.allscreenshots.com/v1/screenshots/jobs/abc123/result",
"outputs": {
"screenshot": {
"type": "screenshot",
"contentType": "image/png",
"size": 245000,
"resultUrl": "https://api.allscreenshots.com/v1/screenshots/jobs/abc123/result/screenshot",
"storageUrl": "https://r2.example.com/abc123/screenshot.png"
},
"markdown": {
"type": "markdown",
"contentType": "text/markdown",
"size": 1200,
"resultUrl": "https://api.allscreenshots.com/v1/screenshots/jobs/abc123/result/markdown",
"storageUrl": "https://r2.example.com/abc123/content.md"
}
}
}Retrieve a specific output
GET /v1/screenshots/jobs/{jobId}/result/{outputId}Returns the binary data for a specific output with the appropriate content type.
# Get the screenshot
curl 'https://api.allscreenshots.com/v1/screenshots/jobs/abc123/result/screenshot' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--output screenshot.png
# Get the markdown
curl 'https://api.allscreenshots.com/v1/screenshots/jobs/abc123/result/markdown' \
-H 'Authorization: Bearer YOUR_API_KEY'Examples
Screenshot + markdown
curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/blog/post",
"outputs": [
{ "type": "screenshot", "fullPage": true },
{ "type": "markdown", "mainContentOnly": true }
]
}'Structured data extraction
curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/product",
"outputs": [
{ "type": "json", "schema": {
"title": { "selector": "h1", "type": "text" },
"price": { "selector": ".price", "type": "text" },
"images": { "selector": "img.product", "type": "attribute", "attribute": "src", "multiple": true },
"description": { "selector": ".description", "type": "html" }
}}
]
}'Response:
{
"url": "https://example.com/product",
"outputs": {
"json": {
"type": "json",
"contentType": "application/json",
"data": {
"title": "Amazing Widget",
"price": "$29.99",
"images": ["/img/widget-1.jpg", "/img/widget-2.jpg"],
"description": "<p>The best widget you'll ever own.</p>"
},
"size": 234
}
},
"renderTimeMs": 850
}Full extraction combo (async)
curl -X POST 'https://api.allscreenshots.com/v1/screenshots/async' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com",
"outputs": [
{ "type": "screenshot", "format": "png" },
{ "type": "pdf", "printBackground": true },
{ "type": "html" },
{ "type": "markdown", "mainContentOnly": true },
{ "type": "json", "schema": {
"title": { "selector": "title", "type": "text" },
"links": { "selector": "a", "type": "attribute", "attribute": "href", "multiple": true }
}}
],
"webhookUrl": "https://your-server.com/webhooks"
}'Capture order
Outputs are processed in this order to prevent page state mutations from affecting earlier captures:
- Screenshot (captured first to preserve visual state)
- HTML
- Markdown
- JSON
Billing
A multi-output request counts as 1 screenshot toward your monthly quota, regardless of how many outputs are requested.
Missing CSS selectors in JSON extraction return null rather than failing the request.