Projects

envless.projects.get()

Fetch one project by slug or id

ts
get(slug: string, options?: ProductScope): Promise<ProjectResource>

Reads a single project. A UUID shaped slug is resolved as a uniqueId first and only then as a slug, which is why ids never need a product hint.

Slugs do need one. Because slugs are unique per product, a slug that exists in two products fails with 409 project.ambiguous_product and you must retry with options.product. Projects outside a restricted key allowlist, and projects inside private products with no grant, come back as 404 rather than 403, so absence and denial look identical here.

Example

ts
const project = await envless.projects.get('api', { product: 'billing' })

console.log(project.id, project.product?.name)

Parameters

ParameterTypeRequiredDescription
slugstringYesProject slug, or the project uniqueId.
options.productstringNoProduct slug used to disambiguate a project slug that exists in more than one product.
options.signalAbortSignalNoCancels the request.

Returns

ProjectResource including the product object the project belongs to.

Worth knowing

  • options.product is matched against product slugs only. A product uniqueId there yields 404.
  • A missing project is 404 project.not_found and an ambiguous slug is 409 project.ambiguous_product.
  • A project sitting beyond the plan allowance fails with 402 and stays locked until the workspace upgrades.

Required scopes

projects:read

Underlying endpoint

GET /projects/{slug}

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

In Python

envless.projects.get()

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

In Ruby

Envless.projects.get

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

In PHP

$envless->projects->get()

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