Workspaces

Envless.workspaces.create

Create a workspace owned by the key owner

def create(body = nil, timeout: nil, **fields)

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

ruby
require "envless/sdk"

workspace = Envless.workspaces.create(
  name: "Billing",
  slug: "billing"
)

puts "#{workspace[:id]} #{workspace[:slug]}"

Parameters

ParameterTypeRequiredDescription
bodyworkspace_createNoThe fields below as one Hash, with Symbol or String keys, in place of the keywords.
name:StringYesDisplay name, 3 to 50 characters.
slug:StringNoGlobally unique URL slug of lowercase letters, digits and single hyphens.
timeout:Integer | Float | RationalNoSeconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

workspace_resource 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 TypeScript

envless.workspaces.create()

The same method in @goenvless/sdk, with the same request, retries and errors.