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

# Get an environment



## OpenAPI

````yaml /api-reference/openapi.yaml get /environment/{environmentId}
openapi: 3.0.3
info:
  title: Gapstack API
  version: '1.0'
  description: >-
    REST API for Gapstack tenants, projects, environments, resources, and
    integrations.
servers:
  - url: https://9nr7sbhimh.execute-api.us-west-1.amazonaws.com/prod
    description: Production
security:
  - BearerAuth: []
tags:
  - name: healthcheck
    description: Service health
  - name: tenants
    description: Tenants, members, infrastructure, and API keys
  - name: invitations
    description: Tenant invitations
  - name: projects
    description: Projects, variables, webhooks, and integrations
  - name: environments
    description: Environments, deploys, artifacts, and variables
  - name: resources
    description: Cloud resources
  - name: workflows
    description: Deployment and infrastructure workflows
  - name: aws-accounts
    description: Linked AWS accounts
  - name: integrations
    description: Marketplace integrations
  - name: github
    description: GitHub App install and webhooks
  - name: costs
    description: Aggregated cloud costs
  - name: summary
    description: Tenant dashboard summary
  - name: subscription
    description: Plans, usage, and billing webhooks
  - name: settings
    description: System settings, permissions, and superadmins
paths:
  /environment/{environmentId}:
    get:
      tags:
        - environments
      summary: Get an environment
      operationId: getEnvironment
      parameters:
        - $ref: '#/components/parameters/TenantId'
        - $ref: '#/components/parameters/EnvironmentId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentDetails'
        '400':
          description: Bad request, validation failure, or applicable mapped 4xx errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Authenticated but not allowed (e.g. subscription limits).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict (e.g. duplicate or already exists).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
        - ApiKeyAuth: []
components:
  parameters:
    TenantId:
      name: Tenant-Id
      in: header
      required: true
      schema:
        type: string
      description: ID of the tenant (current tenant context).
    EnvironmentId:
      name: environmentId
      in: path
      required: true
      schema:
        type: string
      description: Environment identifier.
  schemas:
    EnvironmentDetails:
      type: object
      properties:
        id:
          type: string
          x-go-name: Pk
        sk:
          type: string
        type:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        name:
          type: string
        description:
          type: string
        aws_region:
          $ref: '#/components/schemas/AwsRegion'
        aws_account_id:
          type: string
        status:
          $ref: '#/components/schemas/EnvironmentStatus'
        total_resources:
          type: integer
        env_variables:
          type: array
          items:
            $ref: '#/components/schemas/EnvVariable'
        webhooks:
          type: array
          items:
            $ref: '#/components/schemas/Webhook'
        last_workflow_id:
          type: string
        stack_info:
          type: string
        bootstraped_info:
          $ref: '#/components/schemas/BootstrapedInfo'
        month_cost:
          $ref: '#/components/schemas/MonthCostDetails'
          nullable: true
    ErrorResponse:
      type: object
      description: >
        JSON body returned by WriteJsonError (internal/app/util.go
        errorResponse).

        Field `error` carries the human-readable message; `code` is set for
        Gapstack errors.
      properties:
        code:
          description: >
            Machine-readable code from paas-lib when the error is a
            GapstackError; omitted when not.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PaasLibErrorCode'
        error:
          type: string
          description: Human-readable error message (JSON key `error`, not `message`).
        meta:
          type: object
          additionalProperties:
            type: string
          description: Optional metadata (e.g. validation field names).
    AwsRegion:
      type: string
      description: AWS region identifier. Matches models.AwsRegion JSON values in paas-lib.
      example: us-east-1
      enum:
        - us-east-1
        - us-east-2
        - us-west-1
        - us-west-2
        - us-gov-east-1
        - us-gov-west-1
        - ca-central-1
        - ca-west-1
        - eu-central-1
        - eu-central-2
        - eu-north-1
        - eu-west-1
        - eu-west-2
        - eu-west-3
        - eu-south-1
        - eu-south-2
        - me-south-1
        - me-central-1
        - mx-central-1
        - cn-north-1
        - cn-northwest-1
        - ap-east-1
        - ap-south-1
        - ap-south-2
        - ap-northeast-1
        - ap-northeast-2
        - ap-northeast-3
        - ap-southeast-1
        - ap-southeast-2
        - ap-southeast-3
        - ap-southeast-4
        - ap-southeast-5
        - ap-east-2
        - ap-southeast-7
        - ap-southeast-6
        - af-south-1
        - sa-east-1
      x-enum-varnames:
        - AwsRegionUsEast1
        - AwsRegionUsEast2
        - AwsRegionUsWest1
        - AwsRegionUsWest2
        - AwsRegionUsGovEast1
        - AwsRegionUsGovWest1
        - AwsRegionCaCentral1
        - AwsRegionCaWest1
        - AwsRegionEuCentral1
        - AwsRegionEuCentral2
        - AwsRegionEuNorth1
        - AwsRegionEuWest1
        - AwsRegionEuWest2
        - AwsRegionEuWest3
        - AwsRegionEuSouth1
        - AwsRegionEuSouth2
        - AwsRegionMeSouth1
        - AwsRegionMeCentral1
        - AwsRegionMxCentral1
        - AwsRegionCnNorth1
        - AwsRegionCnNorthwest1
        - AwsRegionApEast1
        - AwsRegionApSouth1
        - AwsRegionApSouth2
        - AwsRegionApNortheast1
        - AwsRegionApNortheast2
        - AwsRegionApNortheast3
        - AwsRegionApSoutheast1
        - AwsRegionApSoutheast2
        - AwsRegionApSoutheast3
        - AwsRegionApSoutheast4
        - AwsRegionApSoutheast5
        - AwsRegionApEast2
        - AwsRegionApSoutheast7
        - AwsRegionApSoutheast6
        - AwsRegionAfSouth1
        - AwsRegionSaEast1
    EnvironmentStatus:
      type: string
      enum:
        - CLONED
        - DEFINED
        - DEPLOY_IN_PROGRESS
        - DEPLOYED
        - FAILED
        - ROLLBACK
        - REQUIRES_MANUAL_DELETION
      x-enum-varnames:
        - EnvironmentStatusCloned
        - EnvironmentStatusDefined
        - EnvironmentStatusDeployInProgress
        - EnvironmentStatusDeployed
        - EnvironmentStatusFailed
        - EnvironmentStatusRollback
        - EnvironmentStatusRequiresManualDeletion
    EnvVariable:
      type: object
      description: Environment variable at project or environment scope.
      required:
        - id
        - name
        - value
      properties:
        id:
          type: string
        name:
          type: string
        value:
          type: string
        sensitive:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        actor:
          type: string
          description: Email or identifier of the user who last changed the variable.
    Webhook:
      type: object
      description: Project webhook subscription.
      properties:
        id:
          type: string
        events:
          type: array
          items:
            type: string
        endpoint:
          type: string
          format: uri
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    BootstrapedInfo:
      type: object
      properties:
        artifacts_bucket_arn:
          type: string
        artifacts_bucket_name:
          type: string
        openid_role_arn:
          type: string
        openid_role_name:
          type: string
    MonthCostDetails:
      type: object
      description: Aggregated cost summary for a billing period.
      properties:
        cost:
          type: number
          format: double
        cost_unit:
          type: string
          description: Currency or unit for cost values (e.g. USD).
        max_day_cost:
          type: number
          format: double
        min_day_cost:
          type: number
          format: double
        average_day_cost:
          type: number
          format: double
    PaasLibErrorCode:
      type: string
      description: >
        Machine-readable code from paas-lib (errors.Code). Matches
        github.com/gapai-io/paas-lib/pkg/errors.Code.
      enum:
        - common.internal_error
        - common.unavailable
        - common.timeout
        - common.conflict
        - common.not_implemented
        - validation.invalid
        - validation.required
        - auth.unauthorized
        - auth.forbidden
        - storage.not_found
        - storage.already_exists
        - storage.db_error
        - storage.constraint_violation
        - service.invalid_state
        - service.rule_violation
        - service.aborted
        - external.error
        - external.timeout
        - external.bad_response
        - stack.manual_deletion
        - subscription.invalid_state
        - subscription.rule_violation
        - subscription.canceled
        - subscription.not_found
        - subscription.limit_reached
      x-enum-varnames:
        - ErrInternalErrorCode
        - ErrUnavailableErrorCode
        - ErrTimeoutErrorCode
        - ErrConflictErrorCode
        - ErrNotImplementedErrorCode
        - ErrValidationInvalidCode
        - ErrValidationRequiredCode
        - ErrUnauthorizedCode
        - ErrForbiddenCode
        - ErrRepoNotFoundErrorCode
        - ErrRepoAlreadyExistsErrorCode
        - ErrRepoDBErrorCode
        - ErrRepoConstraintViolationErrorCode
        - ErrInvalidStateCode
        - ErrBusinessRuleCode
        - ErrOperationAbortCode
        - ErrExternalErrorCode
        - ErrExternalTimeoutCode
        - ErrExternalBadRespCode
        - ErrStackManualDeletionCode
        - ErrSubscriptionInvalidStateCode
        - ErrSubscriptionBusinessRuleCode
        - ErrSubscriptionCanceledCode
        - ErrSubscriptionNotFoundCode
        - ErrSubscriptionLimitReachedCode
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token in the Authorization header (e.g. JWT / Cognito access
        token).
    ApiKeyAuth:
      type: apiKey
      name: x-api-key
      in: header
      description: API key in the X-Api-Key header.

````