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

# Scrape a URL (ephemeral browser)



## OpenAPI

````yaml /openapi/webcompute.json post /v1/scrape
openapi: 3.0.0
info:
  title: Webcompute API
  description: >-
    Public Webcompute REST API for managed browsers, browser-control execution,
    resources, quick actions, and health checks.
  version: 0.1.0
servers:
  - url: https://api.webcompute.dev
    description: Webcompute production API
security:
  - bearer: []
tags:
  - name: Health
    description: Public liveness and readiness checks.
  - name: Browsers
    description: >-
      Managed browser lifecycle, browser control, status, blockers, and
      resources.
  - name: Quick Actions
    description: Ephemeral browser actions for scrape, screenshot, and PDF generation.
paths:
  /v1/scrape:
    post:
      tags:
        - Quick Actions
      summary: Scrape a URL (ephemeral browser)
      operationId: QuickActionController_scrape
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScrapeDto'
      responses:
        '200':
          description: >-
            Scrape result with deterministic content. Response always includes
            completeness.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuickActionScrapeResponseDto'
        '504':
          description: Quick action timed out
      security:
        - bearer: []
components:
  schemas:
    ScrapeDto:
      type: object
      properties:
        url:
          type: string
          description: Target URL to navigate to
        proxy:
          type: string
          description: Proxy URL (protocol://user:pass@host:port)
        waitFor:
          type: string
          description: CSS selector to wait for before action
        timeout:
          type: number
          default: 30000
          description: Action timeout in milliseconds (1-60000)
        policy:
          type: object
          additionalProperties: true
          description: Browser navigation policy for this action
        format:
          type: string
          enum:
            - html
            - markdown
            - text
          default: markdown
          description: Content output format
        selector:
          type: string
          description: >-
            CSS selector scoping deterministic content reads. Omit to let the
            scraper pick a semantic landmark or fall back to body with landmark
            pruning.
        iframe:
          type: string
          description: CSS selector of a specific iframe to scrape.
        solveCaptcha:
          type: boolean
          default: false
          description: >-
            Request passive Phase 1 CAPTCHA auto-resolution before extracting
            content
        mode:
          type: string
          enum:
            - summary
            - structured
            - raw
          default: structured
          description: >-
            Output shape. 'summary' emits short content (<=1200 chars) plus
            description; 'structured' emits the visible content payload with
            optional tree[] when extract='tree'; 'raw' opts out of the maxChars
            clamp.
        extract:
          type: string
          enum:
            - tree
          nullable: true
          description: >-
            Opt-in content extractor. 'tree' emits hierarchical visible content
            (comment threads, file trees, nested menus). Use runtime extract for
            repeated records.
        maxChars:
          type: integer
          minimum: 1
          maximum: 50000
          default: 20000
          description: >-
            Soft cap on response content character count. Clamps above default
            trigger truncated=true + charsOmitted in the response.
        startFromChar:
          type: integer
          minimum: 0
          maximum: 10000000
          description: Zero-based content character offset for continuing a truncated read.
        readFrom:
          type: string
          enum:
            - start
            - end
          default: start
          description: >-
            Read window direction. Use end for latest/bottom content;
            startFromChar is ignored in end-window mode.
        include:
          type: array
          description: >-
            Opt-in extras added to the lean default scrape response. When
            supplied, this exact list controls optional categories; include: []
            explicitly opts out of all extras. Security signals
            (captchaDetected/captchaState/captchaSolved), structural metadata,
            and diagnostics (truncated/etc.) are always populated regardless.
            Duplicates are collapsed.
          items:
            type: string
            enum:
              - links
              - forms
              - headings
              - captcha
        includeLinks:
          type: boolean
          default: false
          description: Include deterministic anchor links in read output.
        iframeText:
          type: boolean
          default: false
          description: When true and format is not 'html', append iframe text to content.
      required:
        - url
    QuickActionScrapeResponseDto:
      type: object
      properties:
        v:
          type: number
          enum:
            - 1
          example: 1
        url:
          type: string
          example: https://example.com/articles
        title:
          type: string
          example: Example Domain
        format:
          type: string
          enum:
            - html
            - markdown
            - text
          example: markdown
        content:
          type: string
          example: |-
            # Example Domain

            This domain is for use in illustrative examples.
        provenance:
          type: object
        diagnostics:
          type: object
        completeness:
          $ref: '#/components/schemas/ScrapeCompletenessDto'
        statusCode:
          type: number
          example: 200
        captchaSolved:
          type: boolean
          example: false
        captchaDetected:
          type: string
          nullable: true
          enum:
            - recaptcha-v2
            - recaptcha-v3
            - hcaptcha
            - cloudflare-turnstile
            - cloudflare-challenge
            - datadome-captcha
            - aws-waf-captcha
            - geetest
            - waf
            - unknown
          example: cloudflare-turnstile
        captchaState:
          type: string
          nullable: true
          enum:
            - detected
            - solving
            - solved
            - failed
            - timeout
            - cancelled
            - expired
            - interactive_required
          example: solved
        tree:
          type: array
          items:
            $ref: '#/components/schemas/ScrapeResponseTreeNodeDto'
        description:
          type: string
          example: Short summary surfaced under mode=summary.
        links:
          type: array
          items:
            $ref: '#/components/schemas/ScrapeStructuredLinkDto'
        forms:
          type: array
          items:
            $ref: '#/components/schemas/ScrapeStructuredFormFieldDto'
        headings:
          type: array
          items:
            $ref: '#/components/schemas/ScrapeHeadingDto'
        captcha:
          type: array
          items:
            $ref: '#/components/schemas/CaptchaDetectionDto'
        warnings:
          example:
            - scrape-truncated:recommendedMaxChars=30000
          type: array
          items:
            type: string
        truncated:
          type: boolean
          example: true
        charsOmitted:
          type: number
          example: 1530
        nodesOmitted:
          type: number
          example: 42
        pruningRatio:
          type: number
          example: 0.38
        elapsedMs:
          type: number
          example: 842
      required:
        - v
        - url
        - title
        - format
        - content
        - provenance
        - diagnostics
        - completeness
        - statusCode
        - captchaSolved
        - captchaDetected
        - captchaState
        - elapsedMs
    ScrapeCompletenessDto:
      type: object
      properties:
        ratio:
          type: number
          description: >-
            Fraction of available text returned in content after cap + pruning,
            rounded to two decimals.
          example: 0.97
        complete:
          type: boolean
          description: Convenience flag for ratio >= 0.95.
          example: true
        capLimited:
          type: boolean
          description: True when a returned-text cap limited the response.
          example: false
        pruningLimited:
          type: boolean
          description: True when readability pruning removed at least 10% of visible text.
          example: false
      required:
        - ratio
        - complete
        - capLimited
        - pruningLimited
    ScrapeResponseTreeNodeDto:
      type: object
      properties:
        depth:
          type: number
          example: 0
        text:
          type: string
          example: Section heading
        children:
          type: array
          items:
            $ref: '#/components/schemas/ScrapeResponseTreeNodeDto'
      required:
        - depth
        - text
        - children
    ScrapeStructuredLinkDto:
      type: object
      properties:
        text:
          type: string
          example: Pricing
        href:
          type: string
          example: https://example.com/pricing
      required:
        - text
        - href
    ScrapeStructuredFormFieldDto:
      type: object
      properties:
        name:
          type: string
          example: email
        label:
          type: string
          example: Email address
        placeholder:
          type: string
          example: you@example.com
        type:
          type: string
          example: email
        valuePresent:
          type: boolean
          example: false
      required:
        - valuePresent
    ScrapeHeadingDto:
      type: object
      properties:
        level:
          type: number
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
          example: 2
        text:
          type: string
          example: Features
      required:
        - level
        - text
    CaptchaDetectionDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - recaptcha-v2
            - recaptcha-v3
            - hcaptcha
            - cloudflare-turnstile
            - cloudflare-challenge
            - datadome-captcha
            - aws-waf-captcha
            - geetest
            - waf
            - unknown
          example: cloudflare-turnstile
        category:
          type: string
          enum:
            - blocking
            - informational
          example: blocking
        state:
          type: string
          enum:
            - detected
            - solving
            - solved
            - failed
            - timeout
            - cancelled
            - expired
            - interactive_required
          example: solved
        sitekey:
          type: object
          nullable: true
          example: '0x4AAAAAAABbbbcccc'
        pageUrl:
          type: string
          example: https://example.com/login
        frameId:
          type: object
          nullable: true
          example: 7A2A1B9DDEF4B8B9A6E99D8A7A65DCEE
        detectedAt:
          type: number
          example: 1713890000123
        resolvedAt:
          type: object
          nullable: true
          example: 1713890001456
        method:
          type: string
          nullable: true
          enum:
            - auto-wait
            - browser-native
            - manual
          example: auto-wait
        elapsedMs:
          type: object
          nullable: true
          example: 333
      required:
        - type
        - category
        - state
        - sitekey
        - pageUrl
        - frameId
        - detectedAt
        - resolvedAt
        - method
        - elapsedMs
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: API key
      type: http

````