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

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# 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. The run reads a version of its saved dataset: `dataset_version` when given, else the version the experiment pins, else the current content saved as a new version.



## OpenAPI

````yaml POST /api/v1/experiments/{slug}/run
openapi: 3.1.0
info:
  title: LangWatch API
  description: LangWatch openapi spec
  version: 1.0.0
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/v1/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. The run reads a version of its
        saved dataset: `dataset_version` when given, else the version the
        experiment pins, else the current content saved as a new version.
      operationId: postApiExperimentsBySlugRun
      parameters:
        - in: path
          name: slug
          schema:
            type: string
            minLength: 1
          required: true
          description: The experiment's slug, or its id
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  maxItems: 4000
                  type: array
                  items:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                dataset_id:
                  type: string
                  minLength: 1
                dataset_version:
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
                parameters:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type:
                      - string
                      - number
                      - boolean
                row_indices:
                  type: array
                  items:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                concurrency:
                  type: integer
                  minimum: 1
                  maximum: 24
      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:
                    description: Link to the run in the LangWatch app
                    type: string
                required:
                  - runId
                  - status
                  - total
                additionalProperties: false
            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, the experiment
            has no dataset configured, or `dataset_version` was sent while the
            run reads no saved dataset (no `dataset_id` and an inline active
            dataset)
          content: {}
        '401':
          description: Missing or invalid API key, or the key lacks the permission
          content: {}
        '404':
          description: >-
            No such experiment in this project, or its dataset has no version
            `dataset_version` names (`dataset_version_not_found`)
          content: {}
      security:
        - project_api_key: []
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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.