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

# Delete test run

> Permanently deletes a terminal test run and its results (cascade). A run still in progress (`pending`/`running`) cannot be deleted — only `passed`, `failed`, or `error` runs. Scope `sessions:write`.



## OpenAPI

````yaml /api-reference/openapi.json delete /agent-test-runs/{run_id}
openapi: 3.1.0
info:
  title: Lehar API
  version: v0
  description: >-
    Customer-facing REST API for the Lehar voice-AI platform. Platform-admin
    endpoints are intentionally excluded from this reference. Regenerate with
    `npm run sync:openapi`.
servers:
  - url: https://api.lehar.ai/ca/api/v0
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /agent-test-runs/{run_id}:
    delete:
      tags:
        - Agent Testing
      summary: Delete test run
      description: >-
        Permanently deletes a terminal test run and its results (cascade). A run
        still in progress (`pending`/`running`) cannot be deleted — only
        `passed`, `failed`, or `error` runs. Scope `sessions:write`.
      operationId: delete_run_ca_api_v0_agent_test_runs__run_id__delete
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Deleted
          content:
            application/json:
              example:
                deleted: true
        '400':
          description: >-
            The run is still in progress, or the authenticated context has no
            `customer_id`.
          content:
            application/json:
              example:
                error:
                  code: invalid_request
                  message: Cannot delete a run while it is still in progress.
        '401':
          description: Missing or invalid credentials (code `unauthorized`).
        '403':
          description: >-
            The credential is missing the required `sessions:write` scope (code
            `forbidden`).
        '404':
          description: No run with this id in the workspace.
          content:
            application/json:
              example:
                error:
                  code: not_found
                  message: Test run not found
        '500':
          description: Unexpected server error (code `internal_error`).
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````