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

# Get an environment

> By ID or by name.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/environments/{id}
openapi: 3.1.0
info:
  title: envlink API
  version: 1.0.0
  description: >-
    Lease build environments, wire them to your sandbox, and keep snapshots and
    artifacts.
servers:
  - url: https://envlink-api.projectinwork.com
security:
  - bearerAuth: []
tags:
  - name: Environments
  - name: Templates
  - name: Sandboxes
  - name: Snapshots
  - name: Artifacts
  - name: Projects
  - name: Tokens
  - name: Usage
  - name: Account
paths:
  /v1/environments/{id}:
    get:
      tags:
        - Environments
      summary: Get an environment
      description: By ID or by name.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Its ID or name.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Environment'
        '404':
          description: Not in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Environment:
      type: object
      properties:
        id:
          type: string
          examples:
            - env_3iynbifi4k6xgfhn
        name:
          type: string
          examples:
            - linux-build-3f2a
        template:
          type: string
          examples:
            - linux-build
        state:
          type: string
          enum:
            - pending
            - starting
            - ready
            - stopping
            - stopped
            - failed
        node:
          type: string
          description: The node it runs on.
        sandbox:
          type: string
          description: The sandbox it's wired to.
        pool:
          type: string
          examples:
            - linux-arm64
        labels:
          type: object
          additionalProperties:
            type: string
        project:
          type: string
          description: Whose key seals its files.
          examples:
            - github.com/acme/app
        readyMs:
          type: integer
          description: From request to ready.
        error:
          type: string
        createdBy:
          type: string
        created:
          type: string
          format: date-time
        ready:
          type: string
          format: date-time
        stopped:
          type: string
          format: date-time
        expires:
          type: string
          format: date-time
        idleUntil:
          type: string
          format: date-time
        idle:
          type: string
          examples:
            - 1h0m0s
        hard:
          type: string
          examples:
            - 6h0m0s
        exports:
          type: array
          items:
            $ref: '#/components/schemas/Export'
        shares:
          type: array
          items:
            $ref: '#/components/schemas/Share'
        snapshot:
          type: string
          description: The key its files are saved under when it ends.
        restored:
          $ref: '#/components/schemas/Restored'
    Error:
      type: object
      properties:
        error:
          type: string
          description: What went wrong, for people.
        code:
          type: string
          description: >-
            A machine-readable code, when there is one: quota, no_template,
            not_found, …
      required:
        - error
    Export:
      type: object
      properties:
        service:
          type: string
          examples:
            - postgres
        listen:
          type: string
          description: Where the sandbox reaches it.
          examples:
            - 127.0.0.1:5432
        target:
          type: string
          description: The service's address inside the environment.
          examples:
            - 127.0.0.1:5432
    Share:
      type: object
      properties:
        name:
          type: string
          examples:
            - src
        direction:
          type: string
          enum:
            - in
            - out
        envPath:
          type: string
          examples:
            - /work
        localPath:
          type: string
          description: On the sandbox, relative to its folder.
          examples:
            - .
        files:
          type: array
          items:
            type: string
          description: Extra files' destinations.
    Restored:
      type: object
      properties:
        key:
          type: string
        root:
          type: string
        files:
          type: integer
        created:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A CLI token or an organization API key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.