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

# Delete Test

> Delete a test case from the authenticated project.

<Info>
  **Permission Required**: `project:edit-tests`
</Info>

Permanently delete a test case from your project.

By default, deletion is rejected with `409` if the test has associated runs.
Pass `delete_associated_jobs=true` to also delete the related jobs (which is
required to delete a test that has been run before).

## Path Parameters

<ParamField path="testId" type="string" required>
  The test ID (UUID)
</ParamField>

## Request Body

<ParamField body="delete_associated_jobs" type="boolean" default="false">
  When `true`, also delete the jobs (and runs) that referenced this test.
</ParamField>

<ParamField body="force_delete" type="boolean" default="false">
  When `true`, bypass safety checks that would otherwise prevent deletion.
  Intended for cleanup scenarios; use with care.
</ParamField>

## Response

<ResponseField name="id" type="string" required>
  ID of the deleted test (echoes the path param)
</ResponseField>

<ResponseField name="deleted" type="boolean" required>
  Always `true` on success
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  curl -X DELETE "https://nunu.ai/api/v1/project/your-project-id/tests/a5060a07-d386-4269-98ce-b33fb894201e" \
    -H "X-Api-Key: YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{ "delete_associated_jobs": true }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  { "id": "a5060a07-d386-4269-98ce-b33fb894201e", "deleted": true }
  ```

  ```json 409 Conflict theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  {
    "error": "cannot delete tests with associated runs"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml DELETE /project/{projectId}/tests/{testId}
openapi: 3.1.0
info:
  title: nunu.ai API
  description: >-
    The nunu.ai Public API allows you to programmatically interact with your
    projects, manage test runs, and upload builds.
  version: 1.0.0
servers:
  - url: https://nunu.ai/api/v1
security:
  - apiKeyAuth: []
paths:
  /project/{projectId}/tests/{testId}:
    parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
        description: >-
          The project ID. You can copy it from the project settings page or the
          project URL in the dashboard.
    delete:
      tags:
        - Tests
      summary: Delete Test
      description: Delete a test case from the authenticated project.
      operationId: deleteTest
      parameters:
        - name: testId
          in: path
          required: true
          description: The test ID (UUID)
          schema:
            type: string
            format: uuid
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteTestRequest'
      responses:
        '200':
          description: Test deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - missing project:edit-tests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Test not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Test has associated runs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DeleteTestRequest:
      type: object
      properties:
        delete_associated_jobs:
          type: boolean
          default: false
        force_delete:
          type: boolean
          default: false
    DeleteResponse:
      type: object
      description: >-
        Standard response for DELETE operations on tests, test plans, and shared
        steps.
      properties:
        id:
          type: string
          description: ID of the deleted resource (echoes the path param)
        deleted:
          type: boolean
          enum:
            - true
          description: Always true on success
      required:
        - id
        - deleted
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        details:
          type: object
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key for authentication

````