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

# Delete projects environments

> Delete an environment and all its secrets



## OpenAPI

````yaml /openapi.json delete /projects/{project}/environments/{environment}
openapi: 3.1.0
info:
  title: Keyflare API
  description: >-
    Open-source secrets manager built entirely on Cloudflare. One Worker. One D1
    database. Zero trust storage.
  version: 0.1.0
  contact:
    name: Keyflare
    url: https://github.com/keyflare/keyflare
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: '{baseUrl}'
    description: Your Keyflare deployment
    variables:
      baseUrl:
        default: https://keyflare.YOUR_ACCOUNT.workers.dev
        description: >-
          Base URL of your Keyflare Worker (e.g. https://secrets.example.com or
          https://keyflare.my-account.workers.dev)
security:
  - bearerAuth: []
tags:
  - name: Health
    description: Health check endpoints
  - name: Bootstrap
    description: Initial setup endpoints
  - name: Keys
    description: API key management
  - name: Projects
    description: Project management
  - name: Environments
    description: Environment management
  - name: Secrets
    description: Secret management
paths:
  /projects/{project}/environments/{environment}:
    delete:
      tags:
        - Environments
      description: Delete an environment and all its secrets
      operationId: deleteProjectsByProjectEnvironmentsByEnvironment
      parameters:
        - schema:
            type: string
          in: path
          name: project
          required: true
        - schema:
            type: string
          in: path
          name: environment
          required: true
      responses:
        '200':
          description: Environment deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    type: object
                    properties:
                      deleted:
                        type: string
                      project:
                        type: string
                      secrets_removed:
                        type: number
                    required:
                      - deleted
                      - project
                      - secrets_removed
                required:
                  - ok
                  - data
        '400':
          description: Bad Request - Invalid request body or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '401':
          description: Unauthorized - Missing, invalid, or revoked API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '403':
          description: Forbidden - Key doesn't have required scope/permission
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '404':
          description: Not Found - Resource doesn't exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication (kfl_user_* or kfl_sys_*)

````