openapi: 3.1.0
info:
  title: Webcrawl API
  version: 1.2.0
  summary: Turn any website, document or search into clean, structured data.
  description: |
    The Webcrawl API reads web pages and files and returns clean Markdown and structured data.

    **Authentication.** Send your API key as `Authorization: Bearer <key>` or `X-API-Key: <key>`.
    Create keys in the dashboard or with `POST /v1/account/keys`.

    **Credits.** Every request that does work uses credits. Each response includes a `credits`
    object and `X-Credits-*` headers so you can track usage. A request that cannot be afforded
    returns `402` before any work is done.

    **Versions.** `/v2/*` paths are aliases of `/v1/*` for scrape, crawl, map, extract, search,
    rerank, parse and interact. Requests under `/api/v1/*` behave the same.
  license:
    name: Proprietary
servers:
  - url: https://webcrawl.app
    description: Production
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Scrape
    description: Read a single page.
  - name: Crawl
    description: Find and read many pages of a site.
  - name: Search
    description: Search the web and extract structured results.
  - name: Documents
    description: Parse files and images.
  - name: Interact
    description: Drive a real browser session.
  - name: Monitors
    description: Watch pages for changes.
  - name: Runs
    description: Check long-running jobs.
  - name: Account
    description: Keys, usage and settings.
  - name: Auth
    description: Sign in with an email code.
  - name: System
    description: Service status.
paths:
  /health:
    get:
      tags: [System]
      operationId: getHealth
      summary: Service status
      description: Also available at `/v1/health` and `/v1`. Needs no authentication.
      security: []
      responses:
        "200":
          description: Service is running.
          content:
            application/json:
              schema:
                type: object
                properties:
                  name: { type: string, example: webcrawl }
                  version: { type: string, example: 1.2.0 }
                  status: { type: string, example: ok }
                  creditSchedule: { $ref: "#/components/schemas/CreditSchedule" }
                  endpoints:
                    type: array
                    items: { type: string }
  /v1/scrape:
    post:
      tags: [Scrape]
      operationId: scrape
      summary: Scrape a page
      description: |
        Fetch a page and return its main content as Markdown. Sites that block plain requests are
        retried automatically. Costs 1 credit per page, plus 2 when structured extraction is requested.
        Send `X-No-Cache: true` or `Cache-Control: no-cache` to bypass cached results.
      parameters:
        - $ref: "#/components/parameters/XNoCache"
        - name: X-Retain-Images
          in: header
          description: Set to `none` to strip images from the Markdown.
          schema: { type: string, enum: [all, none] }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ScrapeRequest" }
            example:
              url: https://example.com/blog/hello
              onlyMainContent: false
              excludeTags: [nav, footer]
      responses:
        "200":
          description: The page content.
          headers:
            X-Credits-Charged: { $ref: "#/components/headers/XCreditsCharged" }
            X-Credits-Remaining: { $ref: "#/components/headers/XCreditsRemaining" }
          content:
            application/json:
              schema: { $ref: "#/components/schemas/ScrapeResponse" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/crawl:
    post:
      tags: [Crawl]
      operationId: crawl
      summary: Crawl a site
      description: |
        Find the pages of a site and read them. Costs 1 credit per page read. Pass `async: true`
        to return immediately with a run id; a request that runs longer than the response window
        also returns `202` with a run id. Poll `GET /v1/runs/{id}` for the result.
        With no `includePaths`, a start URL that has a path stays under that path.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/CrawlRequest" }
            example:
              url: https://docs.example.com/guides
              maxPages: 25
              excludePaths: [/guides/archive]
      responses:
        "200":
          description: Crawl finished.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/CrawlResponse" }
        "202": { $ref: "#/components/responses/RunAccepted" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
        "502":
          description: The crawl failed.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
  /v1/map:
    post:
      tags: [Crawl]
      operationId: mapSite
      summary: List a site's pages
      description: Returns page URLs for a site without reading them. Costs 1 credit.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/MapRequest" }
            example:
              url: https://example.com
              limit: 200
              includePaths: [/docs/*]
      responses:
        "200":
          description: The pages found.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/MapResponse" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/status-batch:
    post:
      tags: [Crawl]
      operationId: statusBatch
      summary: Check the status of many URLs
      description: Returns the HTTP status for each URL. Costs 1 credit.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [urls]
              properties:
                urls:
                  type: array
                  items: { type: string, format: uri }
                timeout:
                  type: integer
                  description: Per-URL timeout in milliseconds.
                  default: 8000
      responses:
        "200":
          description: One result per URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        url: { type: string }
                        statusCode: { type: integer }
                        ok: { type: boolean }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/extract:
    post:
      tags: [Scrape]
      operationId: extract
      summary: Extract structured data from a page
      description: |
        Read a page and return data shaped by your `prompt` and JSON `schema`.
        Costs 3 credits (1 page + 2 extraction).
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ExtractRequest" }
            example:
              url: https://example.com/pricing
              prompt: List each plan with its monthly price.
      responses:
        "200":
          description: The extracted data.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  success: { type: boolean }
                  credits: { $ref: "#/components/schemas/Credits" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/search:
    post:
      tags: [Search]
      operationId: search
      summary: Search the web
      description: |
        Search and rank results, optionally reading each result page. Costs 1 credit, plus 2 when
        a structured category (offers, listings, flights, hotels, businesses) returns results.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/SearchRequest" }
            example:
              query: best espresso machines under 500
              limit: 5
      responses:
        "200":
          description: Ranked results.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/SearchResponse" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/search/categories:
    get:
      tags: [Search]
      operationId: listSearchCategories
      summary: List search categories
      description: The categories and subcategories you can pass to `/v1/search`.
      responses:
        "200":
          description: The category catalog.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  success: { type: boolean }
  /v1/rerank:
    post:
      tags: [Search]
      operationId: rerank
      summary: Rank documents against a query
      description: Costs 1 credit.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [query, documents]
              properties:
                query: { type: string }
                documents:
                  type: array
                  description: Plain strings, or objects with `title`, `url`, `description` and `markdown`.
                  items:
                    oneOf:
                      - type: string
                      - type: object
                        properties:
                          title: { type: string }
                          url: { type: string }
                          description: { type: string }
                          markdown: { type: string }
                topK: { type: integer, minimum: 1 }
      responses:
        "200":
          description: Documents in ranked order.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  success: { type: boolean }
                  credits: { $ref: "#/components/schemas/Credits" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/parse:
    post:
      tags: [Documents]
      operationId: parse
      summary: Parse a file
      description: |
        Turn a file into Markdown and tables. Send a `url`, inline `content`, base64 data, or a
        multipart upload. Cost depends on the file: text PDFs and Office files use 1 credit per 10
        pages, pages that need OCR use 1 credit each, images use 2, audio and video use 1 per
        minute (plus 2 to describe video). Pass `async: true` with a `url` for large files.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ParseRequest" }
          multipart/form-data:
            schema:
              type: object
              properties:
                file: { type: string, format: binary }
      responses:
        "200":
          description: The parsed file.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  success: { type: boolean }
                  credits: { $ref: "#/components/schemas/Credits" }
        "202": { $ref: "#/components/responses/RunAccepted" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
        "413":
          description: The file is larger than the size limit.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
  /v1/interact:
    post:
      tags: [Interact]
      operationId: interact
      summary: Interact with a page
      description: |
        Open a page in a real browser, run up to 20 actions, and return the final page. Costs 3
        credits. Nothing is charged if the browser could not start. Pass `async: true` to return a
        run id immediately.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/InteractRequest" }
            example:
              url: https://example.com/login
              actions:
                - { type: fill, selector: "#email", text: me@example.com }
                - { type: click, selector: "button[type=submit]" }
                - { type: wait, ms: 1000 }
      responses:
        "200":
          description: All actions ran.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/InteractResponse" }
        "202": { $ref: "#/components/responses/RunAccepted" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
        "422":
          description: An action did not match the page. The response lists each step and which one failed.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/InteractResponse" }
        "503":
          description: No browser was available. Nothing was charged.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
  /v1/runs/{id}:
    get:
      tags: [Runs]
      operationId: getRun
      summary: Get a run
      description: Status, steps and result of a crawl, interact or parse run.
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
        - name: stream
          in: query
          description: Set to `1` to stream events as newline-delimited JSON.
          schema: { type: string, enum: ["1"] }
        - name: startIndex
          in: query
          description: With `stream=1`, the first event to send.
          schema: { type: integer, minimum: 0, default: 0 }
      responses:
        "200":
          description: The run.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  success: { type: boolean }
                  id: { type: string }
                  status: { type: string }
            application/x-ndjson:
              schema: { type: string }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "404":
          description: No run with that id.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
  /v1/monitors:
    get:
      tags: [Monitors]
      operationId: listMonitors
      summary: List monitors
      responses:
        "200":
          description: Your monitors. Empty when not signed in.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  monitors:
                    type: array
                    items: { $ref: "#/components/schemas/Monitor" }
    post:
      tags: [Monitors]
      operationId: createMonitor
      summary: Watch a page
      description: Creates a monitor and takes a first snapshot. Costs 1 credit per check.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url]
              properties:
                url: { type: string, format: uri }
                intervalMinutes: { type: integer, default: 60 }
                webhookUrl:
                  type: [string, "null"]
                  format: uri
                  description: Called when the page changes.
      responses:
        "200":
          description: The monitor and its first snapshot.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  monitor: { $ref: "#/components/schemas/Monitor" }
                  snapshot:
                    type: object
                    properties:
                      title: { type: string }
                      contentHash: { type: string }
                      markdownPreview: { type: string }
                      cached: { type: boolean }
                  credits: { $ref: "#/components/schemas/Credits" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "402": { $ref: "#/components/responses/InsufficientCredits" }
  /v1/monitors/{id}:
    delete:
      tags: [Monitors]
      operationId: deleteMonitor
      summary: Delete a monitor
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
      responses:
        "200":
          description: Whether the monitor was deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
        "401": { $ref: "#/components/responses/Unauthorized" }
  /v1/account/usage:
    get:
      tags: [Account]
      operationId: getUsage
      summary: Credit usage
      responses:
        "200":
          description: Credits used and remaining, with the price schedule.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  success: { type: boolean }
                  creditSchedule: { $ref: "#/components/schemas/CreditSchedule" }
        "401": { $ref: "#/components/responses/Unauthorized" }
  /v1/account/activity:
    get:
      tags: [Account]
      operationId: listActivity
      summary: Recent requests
      parameters:
        - name: limit
          in: query
          schema: { type: integer, minimum: 1, maximum: 200, default: 50 }
        - name: offset
          in: query
          schema: { type: integer, minimum: 0, default: 0 }
      responses:
        "200":
          description: A page of activity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  logs:
                    type: array
                    items: { type: object, additionalProperties: true }
                  offset: { type: integer }
                  limit: { type: integer }
                  hasMore: { type: boolean }
        "401": { $ref: "#/components/responses/Unauthorized" }
  /v1/account/keys:
    get:
      tags: [Account]
      operationId: listApiKeys
      summary: List API keys
      description: Key secrets are never returned after creation.
      responses:
        "200":
          description: Your keys.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  keys:
                    type: array
                    items: { $ref: "#/components/schemas/ApiKey" }
        "401": { $ref: "#/components/responses/Unauthorized" }
    post:
      tags: [Account]
      operationId: createApiKey
      summary: Create an API key
      description: The full key is shown once in `apiKey`. Store it somewhere safe.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name: { type: string, default: API Key }
                scopes:
                  type: array
                  items: { type: string }
      responses:
        "200":
          description: The new key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  apiKey: { type: string, description: "The full key. Shown once." }
                  key: { $ref: "#/components/schemas/ApiKey" }
        "401": { $ref: "#/components/responses/Unauthorized" }
  /v1/account/keys/{id}:
    delete:
      tags: [Account]
      operationId: revokeApiKey
      summary: Revoke an API key
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
      responses:
        "200":
          description: Whether the key was revoked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
  /v1/account/settings:
    patch:
      tags: [Account]
      operationId: updateSettings
      summary: Update account settings
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name: { type: string }
                webhookUrl: { type: [string, "null"], format: uri }
      responses:
        "200":
          description: The updated account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  user: { $ref: "#/components/schemas/User" }
        "401": { $ref: "#/components/responses/Unauthorized" }
  /v1/auth/otp/send:
    post:
      tags: [Auth]
      operationId: sendOtp
      summary: Email a sign-in code
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [email]
              properties:
                email: { type: string, format: email }
      responses:
        "200":
          description: The code was sent.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
        "400": { $ref: "#/components/responses/BadRequest" }
  /v1/auth/otp/verify:
    post:
      tags: [Auth]
      operationId: verifyOtp
      summary: Sign in with the emailed code
      description: Sets a `wc_session` cookie and returns a session token. New accounts also receive a first API key.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [email, code]
              properties:
                email: { type: string, format: email }
                code: { type: string }
                name: { type: string }
      responses:
        "200":
          description: Signed in.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  user: { $ref: "#/components/schemas/User" }
                  sessionToken: { type: string }
                  apiKey:
                    type: string
                    description: Present for new accounts.
                  isNewUser: { type: boolean }
        "400": { $ref: "#/components/responses/BadRequest" }
  /v1/auth/me:
    get:
      tags: [Auth]
      operationId: getMe
      summary: Current account
      description: "Returns `authenticated: false` when no valid credentials are sent."
      responses:
        "200":
          description: Who you are signed in as.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  authenticated: { type: boolean }
                  user: { $ref: "#/components/schemas/User" }
                  apiKeys:
                    type: array
                    items: { $ref: "#/components/schemas/ApiKey" }
  /v1/auth/logout:
    post:
      tags: [Auth]
      operationId: logout
      summary: Sign out
      responses:
        "200":
          description: Signed out.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your API key, or a session token from sign-in.
    apiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your API key.
  parameters:
    XNoCache:
      name: X-No-Cache
      in: header
      description: Set to `true` to skip cached results.
      schema: { type: string }
  headers:
    XCreditsCharged:
      description: Credits used by this request.
      schema: { type: integer }
    XCreditsRemaining:
      description: Credits left this period.
      schema: { type: integer }
  responses:
    BadRequest:
      description: The request is missing something or is invalid.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    Unauthorized:
      description: Sign in or send a valid API key.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    InsufficientCredits:
      description: Not enough credits. Nothing was done or charged.
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/Error"
              - type: object
                properties:
                  credits: { type: object, additionalProperties: true }
    RunAccepted:
      description: The job is still running. Poll the run for the result.
      headers:
        Location:
          description: Where to check the run.
          schema: { type: string, example: /v1/runs/abc123 }
      content:
        application/json:
          schema:
            type: object
            properties:
              success: { type: boolean }
              id: { type: string }
              kind: { type: string }
              status: { type: string, example: running }
              statusUrl: { type: string, example: /v1/runs/abc123 }
  schemas:
    Error:
      type: object
      properties:
        success: { type: boolean, const: false }
        error: { type: string }
        code: { type: string }
    Credits:
      type: object
      properties:
        charged: { type: integer }
        used: { type: integer }
        remaining: { type: integer }
        limit: { type: integer }
    CreditSchedule:
      type: object
      description: What each action costs, in credits.
      additionalProperties: true
    User:
      type: object
      properties:
        id: { type: string }
        email: { type: string, format: email }
        name: { type: [string, "null"] }
        creditsUsed: { type: integer }
        creditsLimit: { type: integer }
        creditsRemaining: { type: integer }
    ApiKey:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        scopes:
          type: array
          items: { type: string }
        createdAt: { type: string, format: date-time }
    Monitor:
      type: object
      additionalProperties: true
      properties:
        id: { type: string }
        url: { type: string, format: uri }
        intervalMinutes: { type: integer }
        webhookUrl: { type: [string, "null"] }
    ScrapeRequest:
      type: object
      required: [url]
      properties:
        url: { type: string, format: uri }
        onlyMainContent:
          type: boolean
          default: false
          description: Default `false` returns the full page. Set to `true` to keep only the main content and drop navigation, headers and footers.
        includeTags:
          type: array
          maxItems: 50
          description: Keep only elements matching these CSS selectors.
          items: { type: string }
        excludeTags:
          type: array
          maxItems: 50
          description: Remove elements matching these CSS selectors.
          items: { type: string }
        retainImages:
          type: string
          enum: [all, none]
          default: all
        timeout:
          type: integer
          description: Milliseconds.
          default: 15000
        extract:
          description: Ask for structured data. Adds 2 credits.
          type: object
          additionalProperties: true
        schema:
          type: object
          additionalProperties: true
          description: JSON Schema for structured data. Adds 2 credits.
        prompt:
          type: string
          description: What to extract.
    ScrapeResponse:
      type: object
      properties:
        success: { type: boolean }
        url: { type: string }
        title: { type: string }
        markdown: { type: string }
        links:
          type: array
          items: { type: string }
        structuredData:
          type: [object, "null"]
          additionalProperties: true
        cached: { type: boolean }
        credits: { $ref: "#/components/schemas/Credits" }
        latencyMs: { type: integer }
    PathScope:
      type: object
      properties:
        includePaths:
          type: array
          maxItems: 100
          description: |
            Keep only URLs whose path matches. A plain value like `/docs` matches that path and
            everything under it. `*` matches any characters. A trailing `$` anchors the end.
          items: { type: string }
          examples: [["/docs", "/blog/*"]]
        excludePaths:
          type: array
          maxItems: 100
          description: Drop URLs whose path matches. Wins over `includePaths`.
          items: { type: string }
        restrictToSubpath:
          type: boolean
          default: true
          description: With no `includePaths`, stay under the start URL's path. Set to `false` to cover the whole site.
    CrawlRequest:
      allOf:
        - $ref: "#/components/schemas/PathScope"
        - type: object
          required: [url]
          properties:
            url: { type: string, format: uri }
            maxPages:
              type: integer
              description: Most pages to read. `limit` is accepted as an alias.
            includeSubdomains: { type: boolean, default: false }
            onlyRootDomain: { type: boolean }
            extractStructured:
              type: boolean
              description: Also extract structured data from each page. Adds credits per page.
            async:
              type: boolean
              description: Return a run id immediately.
            stealth:
              type: boolean
              default: true
              description: Retry blocked pages through a real browser.
            timeout:
              type: integer
              description: Milliseconds per page.
              default: 20000
    CrawlResponse:
      type: object
      additionalProperties: true
      properties:
        success: { type: boolean }
        id: { type: string }
        status: { type: string }
        credits: { type: object, additionalProperties: true }
    MapRequest:
      allOf:
        - $ref: "#/components/schemas/PathScope"
        - type: object
          required: [url]
          properties:
            url: { type: string, format: uri }
            limit:
              type: integer
              default: 5000
              description: Most URLs to return.
            maxCrawlPages:
              type: integer
              default: 250
              description: Most pages to read when the site has no sitemap.
            maxDepth: { type: integer, default: 8 }
            includeSubdomains: { type: boolean, default: false }
            onlyRootDomain: { type: boolean }
            selectedDomains:
              type: array
              description: Only these hosts. Supports `*.example.com`.
              items: { type: string }
            stealth: { type: boolean, default: true }
            timeout:
              type: integer
              description: Milliseconds.
    MapResponse:
      type: object
      properties:
        success: { type: boolean }
        links:
          type: array
          items: { type: string }
        source: { type: string }
        cached: { type: boolean }
        pagesCrawled: { type: integer }
        blocked:
          type: boolean
          description: The site answered plain requests with a bot check.
        scope:
          type: object
          additionalProperties: true
        credits: { $ref: "#/components/schemas/Credits" }
    ExtractRequest:
      type: object
      properties:
        url: { type: string, format: uri }
        urls:
          type: array
          description: The first URL is used.
          items: { type: string, format: uri }
        prompt: { type: string }
        schema:
          type: object
          additionalProperties: true
    SearchRequest:
      type: object
      required: [query]
      properties:
        query: { type: string }
        limit: { type: integer, default: 5 }
        category:
          type: string
          description: A category from `/v1/search/categories`.
        subcategory: { type: string }
        lang: { type: string }
        tbs:
          type: string
          description: Time filter, such as `qdr:w` for the past week.
        includeDomains:
          type: array
          items: { type: string }
        excludeDomains:
          type: array
          items: { type: string }
        filters:
          type: object
          additionalProperties: true
        scrapeOptions:
          type: object
          description: Also read each result page.
          properties:
            formats:
              type: array
              items: { type: string, enum: [markdown, links, html] }
            retainImages: { type: string, enum: [all, none] }
            scrapeTimeoutMs: { type: integer }
    SearchResponse:
      type: object
      additionalProperties: true
      properties:
        success: { type: boolean }
        results:
          type: array
          items: { type: object, additionalProperties: true }
        credits: { $ref: "#/components/schemas/Credits" }
    ParseRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: A file to download and parse.
        content:
          type: string
          description: Inline text, HTML, CSV, JSON or Markdown.
        base64:
          type: string
          description: Base64 file data. A `data:` URL is accepted.
        fileName: { type: string }
        contentType: { type: string }
        async:
          type: boolean
          description: With `url`, return a run id immediately.
    InteractAction:
      type: object
      required: [type]
      properties:
        type:
          type: string
          enum: [click, fill, type, hover, select, press, wait, scroll, evaluate, extract]
        selector:
          type: string
          description: CSS selector. Required for `click`, `fill`, `type`, `hover` and `select`.
        text:
          type: string
          description: Text for `fill` and `type`.
        key:
          type: string
          description: Key for `press`. Defaults to `Enter`.
        ms:
          type: integer
          description: Milliseconds for `wait` with no selector.
        y:
          type: integer
          description: Pixels for `scroll` with no selector.
    InteractRequest:
      type: object
      required: [url, actions]
      properties:
        url: { type: string, format: uri }
        actions:
          type: array
          maxItems: 20
          items: { $ref: "#/components/schemas/InteractAction" }
        async: { type: boolean }
    InteractResponse:
      type: object
      properties:
        success: { type: boolean }
        id: { type: string }
        status: { type: string }
        url: { type: string }
        finalUrl: { type: string }
        title: { type: string }
        markdown: { type: string }
        links:
          type: array
          items: { type: string }
        statusCode: { type: integer }
        actionsExecuted:
          type: array
          items:
            type: object
            additionalProperties: true
        failedStep: { type: integer }
        error: { type: string }
        credits: { type: object, additionalProperties: true }
        latencyMs: { type: integer }
