Projects

envless.projects.create()

Create a project inside a product

ts
create(body: ProjectCreate, options?: RequestScope): Promise<ProjectResource>

Creates a project and returns it. The destination product comes from body.product, which is a field in the body rather than a query option, and it accepts a product slug only. Omit it and the workspace default product is used, being created on the fly if it does not exist yet.

The API wants both name and slug here, unlike product creation which derives the slug for you. Slug uniqueness is scoped to the chosen product, so the same project slug can exist in several products. The plan allowance is counted across the whole workspace and checked before the slug conflict, so a workspace at its limit fails with 402 even when the slug was also taken.

Example

ts
const project = await envless.projects.create({ name: 'API', slug: 'api', product: 'billing' })

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

Parameters

ParameterTypeRequiredDescription
body.namestringYesHuman readable project name.
body.slugstringYesSlug for the project, slugified before it is validated for uniqueness.
body.productstringNoProduct slug to create the project in, defaulting to the workspace default product.
options.signalAbortSignalNoCancels the request.

Returns

ProjectResource for the newly created project.

Worth knowing

  • slug is required, and a create without it is refused with 400 request.body_invalid.
  • body.product resolves product slugs only. Passing a product uniqueId returns 404 product.not_found.
  • On a 402 the error resource names the allowance that was hit and its message states the limit. The response body also carries limit and current, which EnvlessApiError does not expose.

Required scopes

projects:write

Underlying endpoint

POST /projects

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

In Python

envless.projects.create()

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

In Ruby

Envless.projects.create

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

In PHP

$envless->projects->create()

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