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

# Delete A/B Test

> Permanently deletes an A/B test. Only tests in draft or completed status
can be deleted. Running or paused tests must be completed first.
Requires `ab_testing:manage` permission.




## OpenAPI

````yaml DELETE /api/ab-tests/{id}
openapi: 3.1.0
info:
  title: Naturalead A/B Testing API
  version: 1.0.0
  description: >
    API for managing A/B tests in the Naturalead platform. A/B tests allow you

    to compare multiple AI agent configurations by splitting lead traffic across

    variants with configurable weights. All endpoints require API key
    authentication

    and are scoped to the caller's account.
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security:
  - BearerAuth: []
tags:
  - name: A/B Testing
    description: A/B test CRUD, status management, and results
paths:
  /api/ab-tests/{id}:
    delete:
      tags:
        - A/B Testing
      summary: Delete A/B test
      description: |
        Permanently deletes an A/B test. Only tests in draft or completed status
        can be deleted. Running or paused tests must be completed first.
        Requires `ab_testing:manage` permission.
      operationId: deleteAbTest
      parameters:
        - $ref: '#/components/parameters/AbTestId'
      responses:
        '200':
          description: A/B test deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                required:
                  - success
        '400':
          description: Cannot delete a running or paused test
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Cannot delete a running or paused A/B test
        '404':
          description: A/B test not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: A/B test not found
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    AbTestId:
      name: id
      in: path
      required: true
      description: A/B test ID (MongoDB ObjectId)
      schema:
        type: string
        example: 665a1b2c3d4e5f6a7b8c9d0e
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  responses:
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Failed to process request
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        Bearer token using an API key (format: nl_live_* or nl_test_*).

````