> ## 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.

# Create a profile setup session

> Starts a temporary setup browser for a Browser Context Profile. The response returns session_id, cdp_url, base_url, timeout_seconds, and expires_at. Connect your Playwright, Puppeteer, or CDP client to cdp_url, log in, then save the setup session with session_id. Unsaved setup state is discarded if the session is cancelled or times out.



## OpenAPI

````yaml https://agent.tinyfish.ai/v1/openapi/main post /v1/profiles/{profileId}/setup-session
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/profiles/{profileId}/setup-session:
    post:
      tags:
        - Browser Context Profiles
      summary: Create a profile setup session
      description: >-
        Starts a temporary setup browser for a Browser Context Profile. The
        response returns session_id, cdp_url, base_url, timeout_seconds, and
        expires_at. Connect your Playwright, Puppeteer, or CDP client to
        cdp_url, log in, then save the setup session with session_id. Unsaved
        setup state is discarded if the session is cancelled or times out.
      operationId: createBrowserContextProfileSetupSession
      parameters:
        - schema:
            type: string
            minLength: 1
            description: Browser Context Profile ID
            example: prof_abc123def4567890
          required: true
          description: Browser Context Profile ID
          name: profileId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    Target URL the browser session will navigate to on startup.
                    Bare domains (e.g. tinyfish.ai) are automatically prefixed
                    with https://. If omitted, the browser starts at
                    about:blank.
                  example: https://www.tinyfish.ai
                timeout_seconds:
                  type: integer
                  nullable: true
                  minimum: 5
                  maximum: 86400
                  description: >-
                    Inactivity timeout in seconds (5–86400). If omitted, null,
                    or greater than your plan maximum, the plan maximum is used.
                  example: 300
              description: Browser session creation parameters
      responses:
        '201':
          description: Create a profile setup session succeeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  session_id:
                    type: string
                    minLength: 1
                    description: Unique identifier for this browser session.
                    example: br-a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  cdp_url:
                    type: string
                    format: uri
                    description: >-
                      WebSocket URL for browser connection. Pass this to
                      Playwright's connect_over_cdp or any WebSocket-based CDP
                      client.
                    example: wss://browser.example.tinyfish.io/session/cdp
                  base_url:
                    type: string
                    format: uri
                    description: >-
                      HTTPS base URL for the session. Use to access session
                      endpoints such as /pages.
                    example: https://browser.example.tinyfish.io/session
                  timeout_seconds:
                    type: integer
                    example: 300
                  expires_at:
                    type: string
                    example: '2026-06-10T12:05:00Z'
                required:
                  - session_id
                  - cdp_url
                  - base_url
                  - timeout_seconds
                  - expires_at
        '400':
          description: Invalid request body or profile state too large.
          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
                  request_id:
                    type: string
                    description: >-
                      Request correlation ID, also returned as the X-Request-ID
                      response header. Include it when reporting issues.
                    example: 8f9dba20-e37b-4749-a919-2269e28b4a2c
                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
                  request_id:
                    type: string
                    description: >-
                      Request correlation ID, also returned as the X-Request-ID
                      response header. Include it when reporting issues.
                    example: 8f9dba20-e37b-4749-a919-2269e28b4a2c
                required:
                  - error
                description: Standard error response format
        '404':
          description: Browser Context Profile not found.
          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
                  request_id:
                    type: string
                    description: >-
                      Request correlation ID, also returned as the X-Request-ID
                      response header. Include it when reporting issues.
                    example: 8f9dba20-e37b-4749-a919-2269e28b4a2c
                required:
                  - error
                description: Standard error response format
        '409':
          description: Setup session cleanup or binding conflict; retry shortly.
          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
                  request_id:
                    type: string
                    description: >-
                      Request correlation ID, also returned as the X-Request-ID
                      response header. Include it when reporting issues.
                    example: 8f9dba20-e37b-4749-a919-2269e28b4a2c
                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
                  request_id:
                    type: string
                    description: >-
                      Request correlation ID, also returned as the X-Request-ID
                      response header. Include it when reporting issues.
                    example: 8f9dba20-e37b-4749-a919-2269e28b4a2c
                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.

````