Environments

envless.environments.get()

Read one environment by slug

ts
get(project: string, environment: string, options?: ProductScope): Promise<EnvironmentSummaryResource>

Fetches a single environment inside a project. The two path arguments are not symmetrical: project accepts a slug or a uniqueId, while environment is a slug only. An environment uniqueId 404s on every route in this namespace.

The payload is the summary shape, identical to a list row, and it carries the stored exposed flag and updatedAt directly.

Example

ts
const environment = await envless.environments.get('api', 'production')

console.log(environment.id)

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug or uniqueId that owns the environment.
environmentstringYesEnvironment slug, unique within the project.
options.productstringNoProduct slug that disambiguates an ambiguous project slug.
options.signalAbortSignalNoCancels the request.

Returns

EnvironmentSummaryResource with id, name, slug, projectId, exposed, createdAt and updatedAt.

Worth knowing

  • A 402 on this route means the project is locked for exceeding the plan project allowance, not that the environment is missing.
  • Use the id from here as the environmentId you match against variables and versions.

Required scopes

environments:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}

Request and response schema, every error code, and a live playground.

In Python

envless.environments.get()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.environments.get

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->environments->get()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.