Workspaces

envless.workspaces.create()

Create a workspace owned by the key owner

ts
create(body: WorkspaceCreate, options?: RequestScope): Promise<WorkspaceResource>

Creates a workspace and makes the API key owner its owner with the full owner role. slug is optional and defaults to a slugified name, but slugs are unique across every Envless workspace rather than only yours, so a common name may already be taken.

The response is the last thing this key will ever see of the new workspace. Keys are bound at creation, so current comes back false and no other method in the SDK can reach it. Mint a key inside the new workspace before you try to add products, projects or variables.

Each owner may hold at most 100 workspaces, and passing the cap fails with workspace.limit_reached.

Example

ts
const workspace = await envless.workspaces.create({ name: 'Billing', slug: 'billing' })

console.log(workspace.id, workspace.slug)

Parameters

ParameterTypeRequiredDescription
body.namestringYesDisplay name, 3 to 50 characters.
body.slugstringNoGlobally unique URL slug of lowercase letters, digits and single hyphens.
options.signalAbortSignalNoCancels the request.

Returns

WorkspaceResource for the new workspace, with current always false.

Worth knowing

  • This does not change which workspace the owner has selected in the dashboard.
  • Emits workspace.created to the webhook endpoints of the new workspace, so your existing endpoints never see it.

Required scopes

workspace:write

Underlying endpoint

POST /workspaces

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

In Python

envless.workspaces.create()

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

In Ruby

Envless.workspaces.create

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

In PHP

$envless->workspaces->create()

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