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

# Delete an environment

> Delete an environment

<Info>
  Requires an [Account API key](/docs/reference/backend/http-api/api-keys#account-api-keys). Create one from [Account API keys](https://app.nango.dev/api-keys) in the dashboard.
</Info>

Deletes an environment. `environmentId` is the numeric ID returned when the environment was [created](/docs/reference/backend/http-api/environments/create).

The reserved `prod` environment cannot be deleted.


## OpenAPI

````yaml DELETE /environments/{environmentId}
openapi: 3.1.0
info:
  title: Nango API
  description: Nango API specs used to authorize & sync data with external APIs.
  version: 1.0.0
servers:
  - url: https://api.nango.dev
    description: Production server
  - url: http://localhost:3003
    description: Local server
security:
  - bearerAuth: []
externalDocs:
  url: https://nango.dev/docs/reference/backend/http-api/authentication
paths:
  /environments/{environmentId}:
    delete:
      summary: Delete an environment
      description: Delete an environment
      parameters:
        - name: environmentId
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
          description: Numeric environment ID returned when the environment was created.
      responses:
        '204':
          description: Successfully deleted the environment
        '400':
          description: Cannot delete the reserved `prod` environment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StdError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    StdError:
      type: object
      additionalProperties: false
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
          properties:
            code:
              type: string
            message:
              type: string
            errors:
              type: array
              items:
                type: object
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An Environment API key from your Nango environment, or an Account API
        key for account-level endpoints.

````