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

# Discard unrecoverable environment state

> Requires current session.destroy permission, confirmation of the exact environment ID and the original observed version/generation. Only available after Firedrill verifies physical infrastructure fencing. Does not fabricate deletion, reset state or remove evidence. Retry the same intent and key after a lost acknowledgment.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/projects/{projectId}/environments/{environmentId}/runtime/discard
openapi: 3.1.0
info:
  title: Firedrill Control API
  version: 1.0.0
  description: >-
    The control plane for drills, drill runs, and the worlds they run in. Errors
    always carry the canonical envelope; unsafe operations require an
    Idempotency-Key; long work returns an operation resource.
servers:
  - url: https://api.firedrill.run
security:
  - controlCredential: []
paths:
  /v1/projects/{projectId}/environments/{environmentId}/runtime/discard:
    post:
      summary: Discard unrecoverable environment state
      description: >-
        Requires current session.destroy permission, confirmation of the exact
        environment ID and the original observed version/generation. Only
        available after Firedrill verifies physical infrastructure fencing. Does
        not fabricate deletion, reset state or remove evidence. Retry the same
        intent and key after a lost acknowledgment.
      operationId: environments.discardRuntime
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
            pattern: ^prj_[0-9a-z]{12,32}$
        - name: environmentId
          in: path
          required: true
          schema:
            type: string
            pattern: ^env_[0-9a-z]{12,32}$
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 8
            maxLength: 128
            pattern: ^[A-Za-z0-9._:-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiscardEnvironmentRuntimeRequest'
      responses:
        '200':
          description: >-
            Exact retained loss disposition; replay preserves the original
            receipt
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscardEnvironmentRuntimeResponse'
        '400':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        default:
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    DiscardEnvironmentRuntimeRequest:
      type: object
      properties:
        expectedRuntimeVersion:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        expectedLeaseGeneration:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          maximum: 9007199254740991
        confirm:
          type: string
          pattern: ^env_[0-9a-z]{12,32}$
          description: Must equal the environment being removed.
      required:
        - expectedRuntimeVersion
        - expectedLeaseGeneration
        - confirm
      additionalProperties: false
    DiscardEnvironmentRuntimeResponse:
      type: object
      properties:
        receipt:
          type: object
          properties:
            schemaVersion:
              type: number
              enum:
                - 1
            organizationId:
              type: string
              pattern: ^org_[0-9a-z]{12,32}$
            projectId:
              type: string
              pattern: ^prj_[0-9a-z]{12,32}$
            environmentId:
              type: string
              pattern: ^env_[0-9a-z]{12,32}$
            sessionId:
              type: string
              pattern: ^ses_[0-9a-z]{12,32}$
            buildHash:
              type: string
              pattern: ^sha256:[0-9a-f]{64}$
            leaseGeneration:
              type: integer
              minimum: 0
              exclusiveMinimum: true
              maximum: 9007199254740991
            previousRuntimeVersion:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            runtimeVersion:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            operationId:
              type: string
              pattern: ^op_[0-9a-z]{12,32}$
            disposition:
              type: string
              enum:
                - lost
            disposedAtMs:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
          required:
            - schemaVersion
            - organizationId
            - projectId
            - environmentId
            - sessionId
            - buildHash
            - leaseGeneration
            - previousRuntimeVersion
            - runtimeVersion
            - operationId
            - disposition
            - disposedAtMs
          additionalProperties: false
        replayed:
          type: boolean
      required:
        - receipt
        - replayed
      additionalProperties: false
    ErrorEnvelope:
      type: object
      properties:
        code:
          type: string
          pattern: ^(control|world)\.[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$
        message:
          type: string
          minLength: 1
        correlationId:
          type: string
          minLength: 1
        retryable:
          type: boolean
        retryAfterMs:
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        operationId:
          type: string
        source:
          type: string
          enum:
            - platform
            - simulated_provider
        issues:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              code:
                type: string
              message:
                type: string
            required:
              - path
              - code
              - message
            additionalProperties: false
        details:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        evidence:
          type: object
          properties:
            sessionId:
              type: string
            runId:
              type: string
            journalSeq:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            buildHash:
              type: string
          additionalProperties: false
      required:
        - code
        - message
        - correlationId
        - retryable
        - source
      additionalProperties: true
  securitySchemes:
    controlCredential:
      type: http
      scheme: bearer
      description: Opaque control credential

````