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

# Run browser automation with SSE streaming

> Execute a browser automation task with Server-Sent Events (SSE) streaming. Returns a real-time event stream with automation progress, browser streaming URL, and final results.



## OpenAPI

````yaml https://agent.tinyfish.ai/v1/openapi/main post /v1/automation/run-sse
openapi: 3.0.0
info:
  title: TinyFish Web Agent Automation API
  version: 1.0.0
  description: >-
    REST API for running AI-powered browser automations. Execute tasks on any
    website using natural language instructions.
  contact:
    name: TinyFish Support
    email: support@tinyfish.ai
servers:
  - url: https://agent.tinyfish.ai
    description: Production
security: []
tags:
  - name: Automation
    description: Browser automation endpoints for executing tasks on websites
  - name: Runs
    description: Endpoints for retrieving automation run data
  - name: Browser
    description: Remote browser session endpoints
  - name: Fetch
    description: Fetch URLs and extract clean page content
  - name: Search
    description: Web search endpoints
  - name: Browser Context Profiles
    description: >-
      Saved browser context endpoints for managing reusable login state,
      cookies, storage, and profile setup sessions
  - name: Vault
    description: >-
      Vault credential management endpoints for connecting password managers and
      managing stored credentials
paths:
  /v1/automation/run-sse:
    post:
      tags:
        - Automation
      summary: Run browser automation with SSE streaming
      description: >-
        Execute a browser automation task with Server-Sent Events (SSE)
        streaming. Returns a real-time event stream with automation progress,
        browser streaming URL, and final results.
      operationId: runSse
      requestBody:
        description: Automation task parameters
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  format: uri
                  description: Target website URL to automate
                  example: https://example.com
                goal:
                  type: string
                  minLength: 1
                  description: >-
                    Natural language description of what to accomplish on the
                    website
                  example: Find the pricing page and extract all plan details
                browser_profile:
                  type: string
                  enum:
                    - lite
                    - stealth
                  description: >-
                    Browser profile for execution. LITE uses standard browser,
                    STEALTH uses anti-detection browser.
                  example: lite
                api_integration:
                  type: string
                  description: >-
                    Name of the integration making this API call (e.g., "dify",
                    "zapier", "n8n"). Used for analytics.
                  example: dify
                agent_config:
                  type: object
                  properties:
                    mode:
                      type: string
                      enum:
                        - default
                        - strict
                      description: >-
                        Agent behavior mode. "strict" enables fail-fast for test
                        automation.
                      example: strict
                    cursor_style:
                      type: string
                      enum:
                        - fish
                        - standard
                        - green-pointer
                      description: Cursor style for the browser agent.
                      example: standard
                    max_steps:
                      type: integer
                      minimum: 1
                      maximum: 500
                      description: >-
                        Maximum tool-call steps before the agent stops. Defaults
                        to 150.
                      example: 50
                    max_duration_seconds:
                      type: integer
                      minimum: 1
                      description: >-
                        Maximum wall-clock seconds before the agent stops.
                        Defaults to no limit.
                      example: 300
                  description: Agent behavior configuration
                capture_config:
                  type: object
                  properties:
                    elements:
                      type: boolean
                    snapshots:
                      type: boolean
                    screenshots:
                      type: boolean
                    recording:
                      type: boolean
                    html:
                      type: boolean
                  description: Configure which data to capture during the run.
                webhook_url:
                  type: string
                  format: uri
                  description: >-
                    HTTPS URL to receive webhook notifications for run lifecycle
                    events. Must use HTTPS.
                use_vault:
                  type: boolean
                  description: >-
                    Opt-in to vault credentials for this run. When true, enabled
                    vault items are included. Defaults to false.
                  example: true
                use_profile:
                  type: boolean
                  description: >-
                    Opt-in to the default Browser Context Profile if Browser
                    Context Profiles are enabled; legacy callers are silently
                    ignored when the profiles feature is disabled. Returns 400
                    when enabled but no default profile is set.
                  example: true
                profile_id:
                  type: string
                  minLength: 1
                  description: Browser Context Profile ID to use when use_profile is true.
                  example: prof_abc123def4567890
                credential_item_ids:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  minItems: 1
                  description: >-
                    Scope vault credentials to specific credential URIs.
                    Requires use_vault to be true. If omitted with use_vault:
                    true, all enabled items are used.
                  example:
                    - cred:conn-abc:Work:item-123
                    - cred:conn-def:Personal:item-456
                proxy_config:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                      description: Enable proxy for this automation run
                      example: true
                    country_code:
                      type: string
                      enum:
                        - US
                        - GB
                        - CA
                        - DE
                        - FR
                        - JP
                        - AU
                      description: Country code for proxy location.
                      example: US
                  required:
                    - enabled
                  description: Proxy configuration
                output_schema:
                  type: object
                  properties: {}
                  additionalProperties:
                    nullable: true
                  description: >-
                    Optional provider-supported structured-output schema subset
                    for the run result. Unsupported fields are rejected before
                    the request is accepted.
                  example:
                    type: object
                    properties:
                      title:
                        type: string
                      price:
                        type: number
                    required:
                      - title
                      - price
              required:
                - url
                - goal
      responses:
        '200':
          description: >-
            Server-Sent Events stream. Stream sends STARTED, STREAMING_URL
            (optional), PROGRESS (intermediate events with purpose), COMPLETE
            events, plus periodic HEARTBEAT messages.
          content:
            text/event-stream:
              schema:
                oneOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - STARTED
                      run_id:
                        type: string
                      timestamp:
                        type: string
                    required:
                      - type
                      - run_id
                      - timestamp
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - STREAMING_URL
                      run_id:
                        type: string
                      streaming_url:
                        type: string
                      timestamp:
                        type: string
                    required:
                      - type
                      - run_id
                      - streaming_url
                      - timestamp
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - COMPLETE
                      run_id:
                        type: string
                      status:
                        type: string
                        enum:
                          - COMPLETED
                          - FAILED
                          - CANCELLED
                      error:
                        type: string
                      help_url:
                        type: string
                      help_message:
                        type: string
                      profile_hint:
                        type: object
                        properties:
                          message:
                            type: string
                          setup_url:
                            type: string
                          reason:
                            type: string
                            enum:
                              - auth_wall
                              - bot_challenge
                        required:
                          - message
                          - setup_url
                          - reason
                      result:
                        type: object
                        nullable: true
                        additionalProperties:
                          nullable: true
                      timestamp:
                        type: string
                    required:
                      - type
                      - run_id
                      - status
                      - timestamp
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - HEARTBEAT
                      timestamp:
                        type: string
                    required:
                      - type
                      - timestamp
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - PROGRESS
                      run_id:
                        type: string
                      purpose:
                        type: string
                      tinyfish_api:
                        type: string
                        enum:
                          - search
                          - fetch
                      timestamp:
                        type: string
                    required:
                      - type
                      - run_id
                      - purpose
                      - timestamp
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - TF_API_RESULT
                      run_id:
                        type: string
                      tinyfish_api:
                        type: string
                        enum:
                          - search
                          - fetch
                      result:
                        type: array
                        items:
                          nullable: true
                      timestamp:
                        type: string
                    required:
                      - type
                      - run_id
                      - tinyfish_api
                      - result
                      - timestamp
              example: >-
                data:
                {"type":"STARTED","run_id":"run_123","timestamp":"2025-01-01T00:00:00Z"}


                data:
                {"type":"STREAMING_URL","run_id":"run_123","streaming_url":"https://...","timestamp":"..."}


                data: {"type":"PROGRESS","run_id":"run_123","purpose":"Clicking
                submit button","timestamp":"..."}


                data:
                {"type":"COMPLETE","run_id":"run_123","status":"COMPLETED","result":{...},"timestamp":"..."}
        '400':
          description: Invalid request - missing required fields or invalid format
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - MISSING_API_KEY
                          - INVALID_API_KEY
                          - INVALID_INPUT
                          - RATE_LIMIT_EXCEEDED
                          - INTERNAL_ERROR
                          - RETRY_REQUIRED
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - SERVICE_BUSY
                          - TIMEOUT
                          - INSUFFICIENT_CREDITS
                          - CONTENT_POLICY_VIOLATION
                          - MAX_STEPS_EXCEEDED
                          - SITE_BLOCKED
                          - TASK_FAILED
                          - CANCELLED
                        description: Machine-readable error code
                        example: INVALID_INPUT
                      message:
                        type: string
                        description: Human-readable error message
                        example: Field "url" is required and must be a string
                      details:
                        nullable: true
                        description: Additional error details (validation errors, etc.)
                    required:
                      - code
                      - message
                required:
                  - error
                description: Standard error response format
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - MISSING_API_KEY
                          - INVALID_API_KEY
                          - INVALID_INPUT
                          - RATE_LIMIT_EXCEEDED
                          - INTERNAL_ERROR
                          - RETRY_REQUIRED
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - SERVICE_BUSY
                          - TIMEOUT
                          - INSUFFICIENT_CREDITS
                          - CONTENT_POLICY_VIOLATION
                          - MAX_STEPS_EXCEEDED
                          - SITE_BLOCKED
                          - TASK_FAILED
                          - CANCELLED
                        description: Machine-readable error code
                        example: INVALID_INPUT
                      message:
                        type: string
                        description: Human-readable error message
                        example: Field "url" is required and must be a string
                      details:
                        nullable: true
                        description: Additional error details (validation errors, etc.)
                    required:
                      - code
                      - message
                required:
                  - error
                description: Standard error response format
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - MISSING_API_KEY
                          - INVALID_API_KEY
                          - INVALID_INPUT
                          - RATE_LIMIT_EXCEEDED
                          - INTERNAL_ERROR
                          - RETRY_REQUIRED
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - SERVICE_BUSY
                          - TIMEOUT
                          - INSUFFICIENT_CREDITS
                          - CONTENT_POLICY_VIOLATION
                          - MAX_STEPS_EXCEEDED
                          - SITE_BLOCKED
                          - TASK_FAILED
                          - CANCELLED
                        description: Machine-readable error code
                        example: INVALID_INPUT
                      message:
                        type: string
                        description: Human-readable error message
                        example: Field "url" is required and must be a string
                      details:
                        nullable: true
                        description: Additional error details (validation errors, etc.)
                    required:
                      - code
                      - message
                required:
                  - error
                description: Standard error response format
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication. Get your key from the API Keys page.

````