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

# Run a connector

> <p>Execute a connector. By default the call blocks until the run finishes. Pass <code>async: true</code> to return immediately, in which case you should poll <code>GET /runs</code> to retrieve the result once it's ready.</p>



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/indices/openapi.documented.yml post /v1beta/runs
openapi: 3.1.0
info:
  title: Indices API
  description: 'The Indices REST API. See docs for details: https://docs.indices.io'
  version: 0.0.1
servers:
  - url: https://api.indices.io
security:
  - ApiKeyAuth: []
tags:
  - name: Capture Sessions
    description: >-
      Record a browser session; a completed capture is a reusable input for
      building connectors.
  - name: Connectors
    description: Manage connectors.
  - name: Runs
    description: Execute a connector.
  - name: Secrets
    description: Manage secrets like login credentials and API keys.
paths:
  /v1beta/runs:
    post:
      tags:
        - Runs
      summary: Run a connector
      description: >-
        <p>Execute a connector. By default the call blocks until the run
        finishes. Pass <code>async: true</code> to return immediately, in which
        case you should poll <code>GET /runs</code> to retrieve the result once
        it's ready.</p>
      operationId: createRun
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRunRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '202':
          description: >-
            Async run accepted; poll `get /runs` until it reaches a terminal
            status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Indices from 'indicesio';


            const client = new Indices({
              apiKey: process.env['INDICES_API_KEY'], // This is the default and can be omitted
            });


            const run = await client.beta.runs.run({ connector_id:
            'connector_id' });


            console.log(run.id);
        - lang: Python
          source: |-
            import os
            from indices import Indices

            client = Indices(
                api_key=os.environ.get("INDICES_API_KEY"),  # This is the default and can be omitted
            )
            run = client.beta.runs.run(
                connector_id="connector_id",
            )
            print(run.id)
components:
  schemas:
    CreateRunRequest:
      properties:
        connector_id:
          type: string
          description: ID of the connector to execute.
        arguments:
          additionalProperties: true
          type: object
          description: >-
            Arguments to pass to the connector. Optional if the connector does
            not require any arguments.
        secret_bindings:
          additionalProperties:
            type: string
          type: object
          description: >-
            Mapping of secret slot names to secret IDs. Each slot defined in the
            connector's required_secrets must be mapped to a user-owned secret.
        async:
          type: boolean
          description: >-
            When true, return immediately with a pending run; poll retrieveRun
            for the result.
          default: false
        max_timeout_s:
          type: integer
          maximum: 3600
          minimum: 1
          description: Maximum execution time in seconds before the run is timed out.
          default: 300
      type: object
      required:
        - connector_id
      title: CreateRunRequest
    Run:
      properties:
        id:
          type: string
          description: Unique identifier for the object.
        connector_id:
          type: string
          description: ID of the connector executed in this run.
        arguments:
          additionalProperties: true
          type: object
          description: Arguments in this run for the connector's input parameters.
        secret_bindings:
          additionalProperties:
            type: string
          type: object
          description: >-
            Secrets to use for this run. This dict must be a mapping of secret
            slot names to secret IDs.
        status:
          $ref: '#/components/schemas/RunStatus'
          description: >-
            Lifecycle status of the run: `pending`, `running`, `success`,
            `connector_error`, `timed_out`, `result_too_large`, or
            `internal_error`. `connector_error` means the connector's code
            failed (see `error`); `timed_out` and `internal_error` are platform
            outcomes worth retrying; `result_too_large` is not retryable as-is.
        result_json:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Execution result of the run. In JSON, matching the connector's
            output schema. Limited to 100MB; results above 100MB will be
            truncated and result in a `result_too_large` status.
        error:
          anyOf:
            - $ref: '#/components/schemas/RunError'
            - type: 'null'
          description: >-
            Why the run failed. Present iff `status` is `connector_error`; for
            platform failures the status itself is the reason.
        has_logs:
          type: boolean
          description: Whether the run has associated logs
        created_at:
          type: string
          format: date-time
          description: Timestamp when the object was created.
        finished_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: Timestamp when the object was last updated.
      type: object
      required:
        - id
        - connector_id
        - arguments
        - status
        - result_json
        - error
        - has_logs
        - created_at
        - finished_at
      title: Run
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RunStatus:
      type: string
      enum:
        - pending
        - running
        - success
        - connector_error
        - timed_out
        - result_too_large
        - internal_error
      title: RunStatus
    RunError:
      properties:
        type:
          type: string
          description: >-
            Machine-readable failure type: `auth_required`, `invalid_input`,
            `site_unavailable`, `site_changed`, `crash`, or `unhandled`.
        message:
          type: string
          description: Human-readable description of the failure.
        retryable:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            Whether retrying the run with the same arguments is expected to
            succeed. Null when unknown.
        exception:
          anyOf:
            - type: string
            - type: 'null'
          description: Exception class name, when the failure came from a raised exception.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Structured context reported by the connector.
      type: object
      required:
        - type
        - message
        - retryable
        - exception
        - details
      title: RunError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Enter your API key as the bearer token. Set header: `Authorization` to
        `Bearer <api_key>`

````