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

# Scrape a URL asynchronously

> Queue a scrape and receive the result through a webhook.



## OpenAPI

````yaml POST /v1/api/scrape/async
openapi: 3.1.0
info:
  title: PagePith API
  version: 0.1.0
  description: >-
    Turn any web page into clean, structured content. The API handles
    JavaScript-rendered sites, PDFs, and most bot-protected pages, returning
    readable markdown. Authenticate with your API key as a Bearer token. Usage
    is billed per successful scrape.
servers:
  - url: https://api.pagepith.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Scrape
    description: Fetch and convert web pages
  - name: Video
    description: Transcribe public YouTube, Instagram, and TikTok videos
  - name: Monitoring
    description: Watch public pages for content changes
  - name: Blog
    description: Read published PagePith engineering articles
paths:
  /v1/api/scrape/async:
    post:
      tags:
        - Scrape
      summary: Scrape a URL (asynchronous)
      description: >-
        Enqueue a scrape and receive the result via a webhook callback. Best for
        batch ingestion. Billed once per successful scrape when the job
        completes.
      operationId: scrapeAsync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsyncScrapeRequest'
            example:
              url: https://example.com
              callbackUrl: https://your-app.com/webhooks/scrape
      responses:
        '202':
          description: Job accepted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jobId:
                    type: string
                  status:
                    type: string
                    enum:
                      - queued
                required:
                  - jobId
                  - status
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
components:
  schemas:
    AsyncScrapeRequest:
      allOf:
        - $ref: '#/components/schemas/ScrapeRequest'
        - type: object
          required:
            - callbackUrl
          properties:
            callbackUrl:
              type: string
              format: uri
              description: URL the worker POSTs the result to when done.
            callbackToken:
              type: string
              maxLength: 256
              description: Opaque token echoed back as the x-callback-token header.
    ScrapeRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: The URL to scrape.
        forceFresh:
          type: boolean
          description: Bypass the cache and fetch a fresh copy.
        timeoutMs:
          type: integer
          minimum: 1000
          maximum: 120000
          description: Per-request timeout in milliseconds.
        waitForSelector:
          type: string
          description: Wait for this CSS selector before extracting dynamic content.
        extraWaitMs:
          type: integer
          minimum: 0
          maximum: 10000
          description: Additional settle time for dynamic content, in milliseconds.
  responses:
    InvalidRequest:
      description: The request body failed validation.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                enum:
                  - invalid_request
              details:
                type: object
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                enum:
                  - unauthorized
              message:
                type: string
    PaymentRequired:
      description: No active subscription or usage allowance remaining.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                enum:
                  - payment_required
              message:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key as a Bearer token: `Authorization: Bearer <api-key>`.'

````