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

# Interact

> Drive a real browser with a sequence of actions — click, type, scroll, screenshot, and extract.



## OpenAPI

````yaml post /v1/interact
openapi: 3.1.0
info:
  title: Scrapio
  version: 1.0.0
  description: >-
    Turn any URL into structured data. Fetch raw HTML, crawl sites, extract
    structured content, interact with dynamic pages, and search the web through
    one API.
  contact:
    name: Scrapio Support
    url: https://scrapio.dev
  license:
    name: Proprietary
servers:
  - url: https://api.scrapio.dev
    description: Production
  - url: http://localhost:3000
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: System
  - name: Fetch
  - name: Google
  - name: Crawl
  - name: Map
  - name: Interact
  - name: Search
  - name: Jobs
  - name: YouTube
  - name: Amazon
  - name: Walmart
paths:
  /v1/interact:
    post:
      tags:
        - Interact
      summary: Interact with a page in a real browser
      description: >-
        Drives a real browser through a sequence of actions (`goto`, `click`,
        `type`, `select`, `press`, `scroll`, `wait_for`, `wait_ms`) against a
        URL and returns the resulting page content. Pass `session: { id }` to
        reuse cookies and storage state across multiple calls. Set `output` to
        include `screenshot` to capture a rendered image.
      operationId: interactWithPage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InteractRequest'
            examples:
              click_and_capture:
                summary: Click a link and capture Markdown
                value:
                  url: https://example.com
                  actions:
                    - type: click
                      selector: a
                    - type: wait_ms
                      duration_ms: 500
                  output:
                    - markdown
      responses:
        '200':
          description: >-
            Interaction completed; final page outputs and step results are
            returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InteractResponse'
        '400':
          description: Invalid request parameters, or no actions provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: The referenced session was updated concurrently.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '410':
          description: The referenced session has expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Tenant daily credit cap exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST https://api.scrapio.dev/v1/interact \
              -H "Authorization: Bearer $SCRAPIO_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{"url":"https://example.com","actions":[{"type":"click","selector":"a"}],"output":["markdown"]}'
        - lang: Python
          label: Python
          source: |-
            import os, requests
            resp = requests.post(
                "https://api.scrapio.dev/v1/interact",
                headers={"Authorization": f"Bearer {os.environ['SCRAPIO_API_KEY']}"},
                json={
                    "url": "https://example.com",
                    "actions": [{"type": "click", "selector": "a"}],
                    "output": ["markdown"],
                },
            )
            print(resp.json()["result"]["outputs"]["markdown"])
        - lang: JavaScript
          label: Node.js
          source: |-
            const resp = await fetch("https://api.scrapio.dev/v1/interact", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.SCRAPIO_API_KEY}`, "Content-Type": "application/json" },
              body: JSON.stringify({
                url: "https://example.com",
                actions: [{ type: "click", selector: "a" }],
                output: ["markdown"],
              }),
            });
            const { result } = await resp.json();
            console.log(result.outputs.markdown);
components:
  schemas:
    InteractRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
        device:
          type: string
          enum:
            - desktop
            - mobile
            - tablet
        session:
          type: object
          properties:
            id:
              type: string
              minLength: 1
          required:
            - id
          additionalProperties: false
        actions:
          minItems: 1
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - goto
                  url:
                    type: string
                    format: uri
                required:
                  - type
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - click
                  selector:
                    type: string
                    minLength: 1
                required:
                  - type
                  - selector
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - type
                  selector:
                    type: string
                    minLength: 1
                  value:
                    type: string
                required:
                  - type
                  - selector
                  - value
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - select
                  selector:
                    type: string
                    minLength: 1
                  value:
                    type: string
                required:
                  - type
                  - selector
                  - value
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - press
                  key:
                    type: string
                    minLength: 1
                  selector:
                    type: string
                    minLength: 1
                required:
                  - type
                  - key
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - scroll
                  selector:
                    type: string
                    minLength: 1
                  direction:
                    type: string
                    enum:
                      - down
                      - up
                  amount:
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 9007199254740991
                required:
                  - type
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - wait_for
                  selector:
                    type: string
                    minLength: 1
                required:
                  - type
                  - selector
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - wait_ms
                  duration_ms:
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 9007199254740991
                required:
                  - type
                  - duration_ms
                additionalProperties: false
        output:
          minItems: 1
          type: array
          items:
            type: string
            enum:
              - html
              - markdown
              - json
              - screenshot
        extract:
          anyOf:
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - page
              required:
                - mode
              additionalProperties: false
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - selectors
                fields:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: object
                    properties:
                      selector:
                        type: string
                        minLength: 1
                      type:
                        type: string
                        enum:
                          - text
                          - html
                          - attr
                      attribute:
                        type: string
                        minLength: 1
                    required:
                      - selector
                      - type
                    additionalProperties: false
              required:
                - mode
                - fields
              additionalProperties: false
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - schema
                schema:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: string
              required:
                - mode
                - schema
              additionalProperties: false
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - instruction
                instruction:
                  type: string
                  minLength: 1
              required:
                - mode
                - instruction
              additionalProperties: false
        timeout_ms:
          type: integer
          exclusiveMinimum: 0
          maximum: 300000
      required:
        - url
        - actions
      additionalProperties: false
    InteractResponse:
      type: object
      properties:
        id:
          type: string
        request_id:
          type: string
        kind:
          type: string
          enum:
            - interact
        mode:
          type: string
          enum:
            - inline
        status:
          type: string
          enum:
            - completed
            - partial
        steps:
          type: array
          items:
            type: object
            properties:
              step_id:
                type: string
              type:
                type: string
              status:
                type: string
                enum:
                  - completed
                  - failed
              started_at:
                type: string
              completed_at:
                type: string
              error:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - message
            required:
              - step_id
              - type
              - status
              - started_at
              - completed_at
        result:
          type: object
          properties:
            outputs:
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
            final_url:
              type: string
            session:
              type: object
              properties:
                id:
                  type: string
                updated:
                  type: boolean
              required:
                - id
                - updated
          required:
            - outputs
            - final_url
        diagnostics:
          type: object
          properties:
            step_errors:
              type: array
              items:
                type: object
                properties:
                  step_id:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                required:
                  - step_id
                  - code
                  - message
            output_failures:
              type: array
              items:
                type: object
                properties:
                  output:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                required:
                  - output
                  - code
                  - message
          required:
            - step_errors
            - output_failures
      required:
        - id
        - request_id
        - kind
        - mode
        - status
        - steps
        - result
        - diagnostics
    ErrorResponse:
      type: object
      properties:
        request_id:
          type: string
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
        diagnostics:
          type: object
          properties:
            outcome:
              type: string
              enum:
                - failed
            retryable:
              type: boolean
            blocked:
              type: boolean
            timed_out:
              type: boolean
          required:
            - outcome
            - retryable
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````