environments

Get environment

Retrieve a single environment by its id.

Use this to fetch environment details after creation or to verify an environment exists before performing operations.

Required Permissions

Your root key must have one of the following permissions:

  • environment.*.read_environment (to read any environment)
  • environment.<environment_id>.read_environment (to read a specific environment)
post/v2/environments.getEnvironment

Request body

projectstring required

Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

appstring required

Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

environmentstring required

Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Example request

{
  "project": "proj_1234abcd",
  "app": "proj_1234abcd",
  "environment": "proj_1234abcd"
}

Response

Successfully retrieved the environment.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": {
    "id": "env_1234abcd",
    "slug": "production",
    "description": "Production environment",
    "kind": "production",
    "createdAt": 1704067200000,
    "updatedAt": 1704153600000,
    "runtime": {
      "port": 8080,
      "vCpus": 0.25,
      "memoryMib": 256,
      "command": [
        "node",
        "server.js"
      ],
      "healthcheck": {
        "method": "GET",
        "path": "/healthz",
        "intervalSeconds": 10,
        "timeoutSeconds": 2,
        "failureThreshold": 3,
        "initialDelaySeconds": 5
      },
      "shutdownSignal": "SIGTERM",
      "upstreamProtocol": "http1",
      "openapiSpecPath": "/openapi.yaml"
    },
    "build": {
      "dockerfile": "Dockerfile",
      "rootDirectory": ".",
      "buildCommand": "pnpm --filter api build",
      "watchPaths": [
        "src/**"
      ],
      "autoDeploy": true
    },
    "regions": [
      {
        "name": "us-east-1",
        "replicas": {
          "min": 1,
          "max": 3
        }
      }
    ]
  }
}

Changes

Changed in 5 of the 90 revisions of this API.16

    • added the required property data/kind to the response with the 200 status

      response-required-property-added

    • the endpoint scheme security bearer was added to the API

      api-security-added

    • the endpoint scheme security rootKey was removed from the API

      api-security-removed

    This revision also has 5 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • de7b05f5cb3711See the full diff
    • removed the required property data/runtime/cpuMillicores from the response with the 200 status

      response-required-property-removed

    • added the required property data/runtime/vCpus to the response with the 200 status

      response-required-property-added

    • the data/runtime/healthcheck/path response's property pattern ^(/[\w\-]+)+(\.[\w]+)?$ was added for the status 200

      response-property-pattern-added

    • endpoint added

      endpoint-added