def create(
body: WorkspaceCreate,
*,
timeout: float | None = None,
) -> WorkspaceResourceasync def create(
body: WorkspaceCreate,
*,
timeout: float | None = None,
) -> WorkspaceResourceCreates 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
from envless import envless
workspace = envless.workspaces.create(
{'name': 'Billing', 'slug': 'billing'}
)
print(workspace['id'], workspace['slug'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
workspace = await envless.workspaces.create(
{'name': 'Billing', 'slug': 'billing'}
)
print(workspace['id'], workspace['slug'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
body['name'] | str | Yes | Display name, 3 to 50 characters. |
body['slug'] | str | No | Globally unique URL slug of lowercase letters, digits and single hyphens. |
timeout | float | No | Seconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off. |
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.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.