def create(body = nil, timeout: nil, **fields)def create: (
?(workspace_create | Hash[Symbol | String, untyped])? body,
?timeout: seconds?,
**untyped
) -> workspace_resourceCreates 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
require "envless/sdk"
workspace = Envless.workspaces.create(
name: "Billing",
slug: "billing"
)
puts "#{workspace[:id]} #{workspace[:slug]}"Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
body | workspace_create | No | The fields below as one Hash, with Symbol or String keys, in place of the keywords. |
name: | String | Yes | Display name, 3 to 50 characters. |
slug: | String | No | Globally unique URL slug of lowercase letters, digits and single hyphens. |
timeout: | Integer | Float | Rational | No | Seconds 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.createdto 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.