Allscreenshots Docs
API reference

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

TypeDescriptionBinary?Content type
screenshotImage capture (PNG, JPEG, WebP)Yesimage/png, image/jpeg, image/webp
pdfPDF document generationYesapplication/pdf
htmlRaw HTML of the rendered pageNotext/html
markdownMarkdown conversion of the pageNotext/markdown
jsonStructured data extraction via CSS selectorsNoapplication/json

Output-specific options

Screenshot

OptionTypeDefaultDescription
formatstring"png"Image format: png, jpeg, webp
qualityinteger80Quality for JPEG/WebP (1-100)
fullPagebooleanfalseCapture the full scrollable page
selectorstring-CSS selector to capture a specific element

PDF

OptionTypeDefaultDescription
printBackgroundbooleantrueInclude background graphics
formatstring-Paper format (e.g. "A4", "Letter")
landscapebooleanfalseLandscape orientation

Markdown

OptionTypeDefaultDescription
mainContentOnlybooleanfalseExtract only main content (strips nav, footer, etc.)

JSON (structured extraction)

Extract specific data from the page using CSS selectors:

OptionTypeRequiredDescription
schemaobjectYesMap of field names to extraction rules

Each field in the schema has:

OptionTypeDefaultDescription
selectorstringrequiredCSS selector to target
typestring"text"Extraction type: text, html, or attribute
attributestring-Attribute name (required when type is attribute)
multiplebooleanfalseReturn 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:

  1. Screenshot (captured first to preserve visual state)
  2. PDF
  3. HTML
  4. Markdown
  5. 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.

On this page