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

# Scrape a page

> Load one page in a browser that is already running and return it in the requested formats. The browser runs behind a residential proxy of your region with a desktop fingerprint, solves the challenge of a blocked page and keeps no cookies or storage between requests. One URL per request; on-demand plans only. A request is one session billed in 30-second steps. See [Scraping API](/quickstart/scraping_api).



## OpenAPI

````yaml /api-reference/openapi.json post /scrape
openapi: 3.1.0
info:
  title: Surfsky API
  version: 0.1.0
  description: >-
    Start cloud browsers, control them through CDP, and manage the profiles,
    proxies, and fingerprints they run with.
servers:
  - url: '{baseUrl}'
    variables:
      baseUrl:
        default: https://YOUR_API_HOST
        description: API base URL from your Surfsky dashboard, including https://.
security:
  - ApiToken: []
tags:
  - name: scrape
    description: >-
      Fetch one page through a browser that is already running: a residential
      proxy and a desktop fingerprint, nothing kept between requests.
  - name: profiles
    description: >-
      Start, stop, and manage browsers. A one-time profile is discarded when it
      stops; a persistent profile keeps its cookies, storage, and fingerprint
      according to its storage settings.
  - name: proxies
    description: >-
      Look up available proxy locations and check traffic quotas for the premium
      and shared pools.
  - name: fingerprints
    description: >-
      Look up accepted renderer, screen, and device model values before
      configuring a fingerprint.
  - name: extensions
    description: Upload Chrome extensions once and load them into any browser you start.
  - name: site-reports
    description: Tell the Surfsky team about a website that keeps blocking your browsers.
paths:
  /scrape:
    post:
      tags:
        - scrape
      summary: Scrape a page
      description: >-
        Load one page in a browser that is already running and return it in the
        requested formats. The browser runs behind a residential proxy of your
        region with a desktop fingerprint, solves the challenge of a blocked
        page and keeps no cookies or storage between requests. One URL per
        request; on-demand plans only. A request is one session billed in
        30-second steps. See [Scraping API](/quickstart/scraping_api).
      operationId: scrape_scrape_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScrapeRequest'
            examples:
              markdown:
                summary: Markdown of the main content
                value:
                  url: https://example.com
                  formats:
                    - markdown
              actions:
                summary: A search typed into the page
                value:
                  url: https://duckduckgo.com/
                  formats:
                    - links
                  actions:
                    - type: click
                      selector: textarea[name=q]
                    - type: type
                      selector: textarea[name=q]
                      text: surfsky
                    - type: press
                      key: Enter
                    - type: wait
                      selector: article
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScrapeResponse'
        '400':
          description: >-
            The page could not be fetched; code names the cause and data carries
            the page the browser was left on
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing or invalid API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '402':
          description: Empty balance (insufficient_balance)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: The plan is not on-demand (on_demand_plan_required)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: >-
            Request rate or browser slots exhausted (rate_limits_reached,
            parallel_browsers_limit_reached)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    ScrapeRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Page URL to visit.
        formats:
          type: array
          items:
            type: string
            enum:
              - html
              - raw_html
              - markdown
              - links
              - screenshot
              - cookies
          default:
            - html
          description: >-
            What to return. html is cleaned, raw_html is the full rendered DOM,
            cookies is the jar after the scrape.
        only_main_content:
          type: boolean
          default: true
          description: Strip navigation, footers and sidebars from html and markdown.
        screenshot:
          type: boolean
          default: false
          description: Shorthand for adding screenshot to formats.
        screenshot_options:
          $ref: '#/components/schemas/ScreenshotOptions'
        block_resources:
          type: array
          items:
            type: string
            enum:
              - image
              - media
              - font
              - stylesheet
          description: >-
            Resource types not downloaded. Omitted: image, media and font, or
            nothing when a screenshot is requested. An empty list blocks
            nothing.
        cookies:
          anyOf:
            - type: string
            - type: array
              items:
                additionalProperties: true
                type: object
          description: >-
            Cookies set before navigation: the JSON shape the cookies format
            returns, or Netscape text.
        wait:
          type: number
          minimum: 0
          maximum: 60
          default: 0
          description: Extra wait in seconds after navigation.
        wait_until:
          type: string
          enum:
            - domcontentloaded
            - load
            - networkidle
            - commit
          default: domcontentloaded
        wait_for:
          type: string
          description: CSS or XPath selector to wait for after navigation.
        timeout:
          type: integer
          exclusiveMinimum: 0
          default: 30000
          description: Navigation and selector timeout in milliseconds.
        auto_captcha_solve:
          type: boolean
          default: true
          description: >-
            Solve the challenge of a page that answers 403, 405, 429 or 503. A
            solve adds 10 to 60 seconds and is charged at the plan's CAPTCHA
            price.
        actions:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/ClickAction'
              - $ref: '#/components/schemas/TypeAction'
              - $ref: '#/components/schemas/PressAction'
              - $ref: '#/components/schemas/ScrollAction'
              - $ref: '#/components/schemas/WaitAction'
          maxItems: 10
          description: >-
            Steps run on the loaded page with human emulation, in order. The
            first failure ends the request with action_failed.
      required:
        - url
    ScrapeResponse:
      type: object
      properties:
        success:
          type: boolean
        msg:
          type: string
        data:
          $ref: '#/components/schemas/ScrapedPage'
      required:
        - success
        - data
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          const: false
        msg:
          type: string
        code:
          type: string
        data: {}
        detail: {}
        error: {}
      description: >-
        Error fields vary for forwarded responses. Check HTTP status and code
        when present.
    ScreenshotOptions:
      properties:
        full_page:
          type: boolean
          title: Full Page
          default: true
        format:
          type: string
          enum:
            - png
            - jpeg
          title: Format
          default: png
        quality:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 1
            - type: 'null'
          title: Quality
          description: jpeg only
      additionalProperties: false
      type: object
      title: ScreenshotOptions
    ClickAction:
      properties:
        type:
          type: string
          const: click
          title: Type
        selector:
          type: string
          title: Selector
      additionalProperties: false
      type: object
      required:
        - type
        - selector
      title: ClickAction
      description: Move the mouse to the element and click it.
    TypeAction:
      properties:
        type:
          type: string
          const: type
          title: Type
        selector:
          type: string
          title: Selector
        text:
          type: string
          title: Text
      additionalProperties: false
      type: object
      required:
        - type
        - selector
        - text
      title: TypeAction
      description: Click the element and type the text key by key.
    PressAction:
      properties:
        type:
          type: string
          const: press
          title: Type
        key:
          type: string
          title: Key
      additionalProperties: false
      type: object
      required:
        - type
        - key
      title: PressAction
      description: Press one key, such as Enter or Tab.
    ScrollAction:
      properties:
        type:
          type: string
          const: scroll
          title: Type
        selector:
          anyOf:
            - type: string
            - type: 'null'
          title: Selector
        direction:
          anyOf:
            - type: string
              enum:
                - up
                - down
            - type: 'null'
          title: Direction
      additionalProperties: false
      type: object
      required:
        - type
      title: ScrollAction
      description: Scroll the element into view, or one screen up or down.
    WaitAction:
      properties:
        type:
          type: string
          const: wait
          title: Type
        ms:
          anyOf:
            - type: integer
              maximum: 60000
              minimum: 0
            - type: 'null'
          title: Ms
        selector:
          anyOf:
            - type: string
            - type: 'null'
          title: Selector
      additionalProperties: false
      type: object
      required:
        - type
      title: WaitAction
      description: Wait for an element, or for a pause in milliseconds.
    ScrapedPage:
      type: object
      properties:
        url:
          type: string
        final_url:
          type: string
          description: URL after redirects and solves.
        status:
          type: integer
          description: >-
            Target website HTTP status after redirects and solves; 0 when
            navigation has no response.
        status_text:
          type: string
        title:
          type: string
        content_type:
          type: string
        metadata:
          type: object
          properties:
            description:
              type:
                - string
                - 'null'
            language:
              type:
                - string
                - 'null'
            canonical_url:
              type:
                - string
                - 'null'
            og_title:
              type:
                - string
                - 'null'
            og_description:
              type:
                - string
                - 'null'
            og_image:
              type:
                - string
                - 'null'
        content:
          type: string
          description: Cleaned HTML, with the html format.
        raw_html:
          type: string
          description: The full rendered DOM, with the raw_html format.
        markdown:
          type: string
        links:
          type: array
          items:
            type: string
          description: Absolute URLs, deduplicated, with the links format.
        screenshot:
          type: string
          contentEncoding: base64
          description: Image data, with the screenshot format; omitted when capture fails.
        cookies:
          type: array
          items:
            additionalProperties: true
            type: object
          description: The jar after the scrape, with the cookies format.
      required:
        - url
        - final_url
        - status
        - status_text
        - title
        - content_type
        - metadata
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: X-Cloud-Api-Token
      description: API token from your dashboard.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.