createWorkspaceForOrganization()
Creates a workspace using multipart form fields, with optional metadata and optional
workspace_image upload.Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function createWorkspaceForOrganization(organizationId: string) { const client = await wachtClient(); return client.organizations.createWorkspaceForOrganization(organizationId, { name: 'Engineering', description: 'Core team workspace', });}Signature
function createWorkspaceForOrganization( organizationId: string, request: CreateWorkspaceRequest,): Promise<Workspace>Parameters
›organizationId?: string | undefined;
organizationId?: string | undefined;Stable organization id.
›request.name?: string | undefined;
request.name?: string | undefined;Workspace name.
›request.description?: string | undefined;
request.description?: string | undefined;Optional workspace description.
›request.public_metadata?: Record<string, unknown> | undefined;
request.public_metadata?: Record<string, unknown> | undefined;Optional public metadata.
›plan?: string | undefined;
plan?: string | undefined;Example public plan field.
›owner?: string | undefined;
owner?: string | undefined;Example public owner field.
›request.private_metadata?: Record<string, unknown> | undefined;
request.private_metadata?: Record<string, unknown> | undefined;Optional private metadata.
›internal_notes?: string | undefined;
internal_notes?: string | undefined;Example internal note field.
›billing_id?: string | undefined;
billing_id?: string | undefined;Example internal billing identifier.
›request.workspace_image?: File | Blob | undefined;
request.workspace_image?: File | Blob | undefined;Optional uploaded workspace image.
Behavior
- Creates a new resource and returns the created object from the backend.
- Validate required fields before calling to avoid predictable request failures.