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

# Run an experiment

> Start a run of a saved experiment, addressed by slug. Returns a runId to poll straight away. Send `Accept: text/event-stream` instead to stream progress events until the run finishes.



## OpenAPI

````yaml POST /api/experiments/{slug}/run
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/experiments/{slug}/run:
    post:
      tags:
        - Experiments
      summary: Run an experiment
      description: >-
        Start a run of a saved experiment, addressed by slug. Returns a runId to
        poll straight away. Send `Accept: text/event-stream` instead to stream
        progress events until the run finishes.
      operationId: postApiExperimentsBySlugRun
      parameters:
        - schema:
            type: string
          in: path
          name: slug
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                  description: >-
                    Rows to evaluate inline, instead of the experiment's saved
                    dataset. Mutually exclusive with dataset_id.
                dataset_id:
                  type: string
                  description: >-
                    A saved dataset to evaluate, instead of the one the
                    experiment is configured with. Mutually exclusive with data.
                parameters:
                  type: object
                  additionalProperties:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                  description: >-
                    Constant inputs applied to every row, overriding fields of
                    the same name
                row_indices:
                  type: array
                  items:
                    type: integer
                    minimum: 0
                  description: Run only these rows of the dataset, by zero-based index
              not:
                required:
                  - data
                  - dataset_id
      responses:
        '200':
          description: Run started
          content:
            application/json:
              schema:
                type: object
                properties:
                  runId:
                    type: string
                    description: Identifier to poll this run with
                  status:
                    type: string
                    const: running
                  total:
                    type: number
                    description: Number of cells this run will execute
                  runUrl:
                    type: string
                    description: Link to the run in the LangWatch app
                required:
                  - runId
                  - status
                  - total
            text/event-stream:
              schema:
                type: string
                description: Progress events, ending with a done event carrying the summary
        '400':
          description: >-
            The body was not valid JSON, failed input validation, or the
            experiment has no dataset configured
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Missing or invalid API key, or the key lacks the permission
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable failure code; branch on this
                  message:
                    type: string
                  fault:
                    type: string
                    description: >-
                      Who the failure is attributable to: customer, platform,
                      provider
                  tips:
                    type: array
                    items:
                      type: string
                  docsUrl:
                    type: string
                required:
                  - error
                additionalProperties: true
        '404':
          description: No such experiment or run in this project
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable failure code; branch on this
                  message:
                    type: string
                  fault:
                    type: string
                    description: >-
                      Who the failure is attributable to: customer, platform,
                      provider
                  tips:
                    type: array
                    items:
                      type: string
                  docsUrl:
                    type: string
                required:
                  - error
                additionalProperties: true
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````