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

# Archive Environment

> Archive Environment through the OMA API.

<Info>Every request requires `?beta=true`.</Info>


## OpenAPI

````yaml /openapi/oma.en.json post /v1/environments/{environment_id}/archive
openapi: 3.1.0
info:
  title: OMA API Reference
  version: 1.0.0
  description: Open Managed Agents application API reference.
servers:
  - url: http://localhost:38080
    description: Local OMA server
security:
  - omaApiKey: []
  - omaBearer: []
paths:
  /v1/environments/{environment_id}/archive:
    post:
      summary: Archive Environment
      description: >-
        Archive an environment by ID. Archived environments cannot be used to
        create new sessions.
      operationId: beta_archive_environment_v1_environments__environment_id__archive_post
      parameters:
        - name: beta
          in: query
          required: true
          description: Selects the beta API contract for this endpoint. Must be `true`.
          schema:
            type: boolean
            enum:
              - true
        - name: environment_id
          in: path
          required: true
          schema:
            type: string
            title: Environment Id
          example: env_011CZkZ9X2dpNyB7HsEFoRfW
        - name: anthropic-beta
          in: header
          required: false
          schema:
            type: string
            items:
              type: string
            description: >-
              Optional header to specify the beta version(s) you want to use.


              To use multiple betas, use a comma separated list like
              `beta1,beta2` or specify the header multiple times for each beta.
            title: Anthropic-Beta
            x-stainless-override-schema:
              x-stainless-param: betas
              x-stainless-extend-default: true
              type: array
              description: Optional header to specify the beta version(s) you want to use.
              items:
                $ref: '#/components/schemas/AnthropicBeta'
            x-default: managed-agents-2026-04-01
          description: >-
            Optional header to specify the beta version(s) you want to use.


            To use multiple betas, use a comma separated list like `beta1,beta2`
            or specify the header multiple times for each beta.
        - name: anthropic-version
          in: header
          required: false
          schema:
            type: string
            description: |-
              The version of the OMA API you want to use.

              Read more about versioning and our version history here.
            title: Anthropic-Version
          description: |-
            The version of the OMA API you want to use.

            Read more about versioning and our version history here.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaEnvironment'
        4XX:
          description: |-
            Error response.

            See our errors documentation for more details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
components:
  schemas:
    BetaEnvironment:
      properties:
        archived_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Archived At
          description: >-
            RFC 3339 timestamp when environment was archived, or null if not
            archived
          examples:
            - null
        config:
          oneOf:
            - $ref: '#/components/schemas/BetaCloudConfig'
            - $ref: '#/components/schemas/BetaSelfHostedConfig'
          title: Config
          description: Environment configuration (either OMA Cloud or self-hosted)
          discriminator:
            propertyName: type
            mapping:
              cloud:
                $ref: '#/components/schemas/BetaCloudConfig'
              self_hosted:
                $ref: '#/components/schemas/BetaSelfHostedConfig'
          examples:
            - type: cloud
              networking:
                type: limited
                allowed_hosts:
                  - api.example.com
                allow_package_managers: true
                allow_mcp_servers: false
              packages:
                type: packages
                pip:
                  - pandas
                  - numpy
                npm: []
                apt: []
                cargo: []
                gem: []
                go: []
        created_at:
          type: string
          title: Created At
          description: RFC 3339 timestamp when environment was created
          examples:
            - '2026-03-15T10:00:00Z'
        description:
          type: string
          title: Description
          description: User-provided description for the environment
          examples:
            - Python environment with data-analysis packages.
        id:
          type: string
          title: Id
          description: Environment identifier (e.g., 'env_...')
          examples:
            - env_011CZkZ9X2dpNyB7HsEFoRfW
        metadata:
          additionalProperties:
            type: string
          type: object
          title: Metadata
          description: User-provided metadata key-value pairs
          examples:
            - key: value
        name:
          type: string
          title: Name
          description: Human-readable name for the environment
          examples:
            - python-data-analysis
        scope:
          type: string
          enum:
            - organization
            - account
          title: Scope
          description: >-
            The visibility scope for this environment. 'organization' means
            visible to all accounts. 'account' means visible only to the owning
            account.
        type:
          type: string
          const: environment
          title: Type
          description: The type of object (always 'environment')
          default: environment
          examples:
            - environment
        updated_at:
          type: string
          title: Updated At
          description: RFC 3339 timestamp when environment was last updated
          examples:
            - '2026-03-15T10:00:00Z'
      type: object
      required:
        - archived_at
        - config
        - created_at
        - description
        - id
        - metadata
        - name
        - type
        - updated_at
      title: Environment
      description: >-
        Unified Environment resource for both cloud and self-hosted
        environments.
      example:
        type: environment
        id: env_011CZkZ9X2dpNyB7HsEFoRfW
        name: python-data-analysis
        description: Python environment with data-analysis packages.
        config:
          type: cloud
          networking:
            type: limited
            allowed_hosts:
              - api.example.com
            allow_package_managers: true
            allow_mcp_servers: false
          packages:
            type: packages
            pip:
              - pandas
              - numpy
            npm: []
            apt: []
            cargo: []
            gem: []
            go: []
        metadata: {}
        archived_at: null
        created_at: '2026-03-15T10:00:00Z'
        updated_at: '2026-03-15T10:00:00Z'
    BetaErrorResponse:
      properties:
        error:
          discriminator:
            mapping:
              api_error:
                $ref: '#/components/schemas/BetaAPIError'
              authentication_error:
                $ref: '#/components/schemas/BetaAuthenticationError'
              billing_error:
                $ref: '#/components/schemas/BetaBillingError'
              invalid_request_error:
                $ref: '#/components/schemas/BetaInvalidRequestError'
              not_found_error:
                $ref: '#/components/schemas/BetaNotFoundError'
              overloaded_error:
                $ref: '#/components/schemas/BetaOverloadedError'
              permission_error:
                $ref: '#/components/schemas/BetaPermissionError'
              rate_limit_error:
                $ref: '#/components/schemas/BetaRateLimitError'
              timeout_error:
                $ref: '#/components/schemas/BetaGatewayTimeoutError'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaInvalidRequestError'
            - $ref: '#/components/schemas/BetaAuthenticationError'
            - $ref: '#/components/schemas/BetaBillingError'
            - $ref: '#/components/schemas/BetaPermissionError'
            - $ref: '#/components/schemas/BetaNotFoundError'
            - $ref: '#/components/schemas/BetaRateLimitError'
            - $ref: '#/components/schemas/BetaGatewayTimeoutError'
            - $ref: '#/components/schemas/BetaAPIError'
            - $ref: '#/components/schemas/BetaOverloadedError'
          title: Error
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        type:
          const: error
          default: error
          title: Type
          type: string
      required:
        - error
        - request_id
        - type
      title: ErrorResponse
      type: object
    BetaCloudConfig:
      properties:
        networking:
          oneOf:
            - $ref: '#/components/schemas/BetaUnrestrictedNetwork'
            - $ref: '#/components/schemas/BetaLimitedNetwork'
          title: Networking
          description: Network configuration policy.
          discriminator:
            propertyName: type
            mapping:
              limited:
                $ref: '#/components/schemas/BetaLimitedNetwork'
              unrestricted:
                $ref: '#/components/schemas/BetaUnrestrictedNetwork'
          examples:
            - type: limited
              allowed_hosts:
                - api.example.com
              allow_package_managers: true
              allow_mcp_servers: false
        packages:
          $ref: '#/components/schemas/BetaPackages'
          description: Package manager configuration.
          examples:
            - type: packages
              pip:
                - pandas
                - numpy
              npm: []
              apt: []
              cargo: []
              gem: []
              go: []
        type:
          type: string
          const: cloud
          title: Type
          description: Environment type
          examples:
            - cloud
      type: object
      required:
        - networking
        - packages
        - type
      title: CloudConfig
      description: '`cloud` environment configuration.'
      example:
        type: cloud
        networking:
          type: limited
          allowed_hosts:
            - api.example.com
          allow_package_managers: true
          allow_mcp_servers: false
        packages:
          type: packages
          pip:
            - pandas
            - numpy
          npm: []
          apt: []
          cargo: []
          gem: []
          go: []
    BetaSelfHostedConfig:
      properties:
        type:
          type: string
          const: self_hosted
          title: Type
          description: Environment type
      additionalProperties: false
      type: object
      required:
        - type
      title: SelfHostedConfig
      description: Configuration for self-hosted environments.
    BetaAPIError:
      properties:
        message:
          default: Internal server error
          title: Message
          type: string
        type:
          const: api_error
          default: api_error
          title: Type
          type: string
      required:
        - message
        - type
      title: APIError
      type: object
    BetaAuthenticationError:
      properties:
        message:
          default: Authentication error
          title: Message
          type: string
        type:
          const: authentication_error
          default: authentication_error
          title: Type
          type: string
      required:
        - message
        - type
      title: AuthenticationError
      type: object
    BetaBillingError:
      properties:
        message:
          default: Billing error
          title: Message
          type: string
        type:
          const: billing_error
          default: billing_error
          title: Type
          type: string
      required:
        - message
        - type
      title: BillingError
      type: object
    BetaInvalidRequestError:
      properties:
        message:
          default: Invalid request
          title: Message
          type: string
        type:
          const: invalid_request_error
          default: invalid_request_error
          title: Type
          type: string
      required:
        - message
        - type
      title: InvalidRequestError
      type: object
    BetaNotFoundError:
      properties:
        message:
          default: Not found
          title: Message
          type: string
        type:
          const: not_found_error
          default: not_found_error
          title: Type
          type: string
      required:
        - message
        - type
      title: NotFoundError
      type: object
    BetaOverloadedError:
      properties:
        message:
          default: Overloaded
          title: Message
          type: string
        type:
          const: overloaded_error
          default: overloaded_error
          title: Type
          type: string
      required:
        - message
        - type
      title: OverloadedError
      type: object
    BetaPermissionError:
      properties:
        message:
          default: Permission denied
          title: Message
          type: string
        type:
          const: permission_error
          default: permission_error
          title: Type
          type: string
      required:
        - message
        - type
      title: PermissionError
      type: object
    BetaRateLimitError:
      properties:
        message:
          default: Rate limited
          title: Message
          type: string
        type:
          const: rate_limit_error
          default: rate_limit_error
          title: Type
          type: string
      required:
        - message
        - type
      title: RateLimitError
      type: object
    BetaGatewayTimeoutError:
      properties:
        message:
          default: Request timeout
          title: Message
          type: string
        type:
          const: timeout_error
          default: timeout_error
          title: Type
          type: string
      required:
        - message
        - type
      title: GatewayTimeoutError
      type: object
    BetaUnrestrictedNetwork:
      properties:
        type:
          type: string
          const: unrestricted
          title: Type
          description: Network policy type
      additionalProperties: false
      type: object
      required:
        - type
      title: UnrestrictedNetwork
      description: Unrestricted network access.
    BetaLimitedNetwork:
      properties:
        allow_mcp_servers:
          type: boolean
          title: Allow Mcp Servers
          description: >-
            Permits outbound access to MCP server endpoints configured on the
            agent, beyond those listed in the `allowed_hosts` array.
        allow_package_managers:
          type: boolean
          title: Allow Package Managers
          description: >-
            Permits outbound access to public package registries (PyPI, npm,
            etc.) beyond those listed in the `allowed_hosts` array.
        allowed_hosts:
          items:
            type: string
          type: array
          title: Allowed Hosts
          description: Specifies domains the container can reach.
        type:
          type: string
          const: limited
          title: Type
          description: Network policy type
      type: object
      required:
        - allow_mcp_servers
        - allow_package_managers
        - allowed_hosts
        - type
      title: LimitedNetwork
      description: Limited network access.
    BetaPackages:
      properties:
        apt:
          items:
            type: string
          type: array
          title: Apt
          description: Ubuntu/Debian packages to install
        cargo:
          items:
            type: string
          type: array
          title: Cargo
          description: Rust packages to install
        gem:
          items:
            type: string
          type: array
          title: Gem
          description: Ruby packages to install
        go:
          items:
            type: string
          type: array
          title: Go
          description: Go packages to install
        npm:
          items:
            type: string
          type: array
          title: Npm
          description: Node.js packages to install
        pip:
          items:
            type: string
          type: array
          title: Pip
          description: Python packages to install
        type:
          type: string
          const: packages
          title: Type
          description: Package configuration type
          default: packages
      type: object
      required:
        - apt
        - cargo
        - gem
        - go
        - npm
        - pip
      title: Packages
      description: Packages (and their versions) available in this environment.
  securitySchemes:
    omaApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: OMA workspace API key.
      x-default: sk-ant-local-default
    omaBearer:
      type: http
      scheme: bearer
      description: OMA workspace API key sent as a bearer token.

````