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

# Delete an environment

> Deletes an environment by ID and prunes environment-specific subscriptions. The project is derived from the entity.



## OpenAPI

````yaml /api-reference/openapi.generated.json delete /api/environments/{id}
openapi: 3.1.0
info:
  title: Empirical API
  version: 1.0.0
  description: Programmatic access to Empirical test runs, snoozes, and more.
  contact:
    name: Empirical
    url: https://empirical.run
servers:
  - url: https://api.empirical.run
security:
  - Bearer: []
tags:
  - name: Analytics
    description: Aggregated test-run, test-count and test-case analytics for a project.
  - name: Analytics (Deprecated)
    description: >-
      Legacy analytics endpoints retained for backwards compatibility; prefer
      the v2 equivalents.
  - name: Environments
    description: >-
      Named deployment targets (slug + Playwright project filters) a project's
      tests run against.
  - name: Snoozes
    description: Temporarily suppress known test failures for specific Playwright tests.
  - name: Telemetry
    description: Product telemetry derived from analytics events, scoped to a project.
  - name: Test Cases
    description: >-
      Browse the Playwright test cases synced from a project's repository and
      manage their tags.
paths:
  /api/environments/{id}:
    delete:
      tags:
        - Environments
      summary: Delete an environment
      description: >-
        Deletes an environment by ID and prunes environment-specific
        subscriptions. The project is derived from the entity.
      operationId: deleteEnvironment
      parameters:
        - schema:
            type: integer
            minimum: 1
            description: Environment ID.
          required: true
          description: Environment ID.
          name: id
          in: path
      responses:
        '200':
          description: Deletion succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentDeleteResponse'
        '403':
          description: Environment is in an environments.yaml-managed project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentMutationError'
        '404':
          description: Environment not found or not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentMutationError'
components:
  schemas:
    EnvironmentDeleteResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Always true on success.
      required:
        - success
    EnvironmentMutationError:
      type: object
      properties:
        error:
          anyOf:
            - type: string
            - type: object
              properties:
                message:
                  type: string
                  description: Error message.
              required:
                - message
          description: >-
            Error, returned as a bare string or a `{ message }` object (legacy
            shape).
      required:
        - error
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````