Create Workspace Command

Command to create a new workspace for an organization

Overview

The CreateWorkspaceCommand initiates the creation of a new workspace. It contains all necessary information to set up an isolated environment for an organization.

Command Schema

Schema Definition

{
"commandId": "uuid",
"commandType": "CreateWorkspaceCommand",
"timestamp": "2025-12-11T10:30:00Z",
"version": "1.0.0",
"data": {
"name": "string",
"subdomain": "string",
"createdBy": {
"userId": "string",
"email": "string",
"name": "string"
},
"plan": "free | pro | enterprise",
"settings": {
"timezone": "string",
"dateFormat": "string",
"weekStartsOn": "number"
}
}
}

Example

{
"commandId": "cmd_create_ws_123",
"commandType": "CreateWorkspaceCommand",
"timestamp": "2025-12-11T10:30:00Z",
"version": "1.0.0",
"data": {
"name": "Acme Corporation",
"subdomain": "acme",
"createdBy": {
"userId": "usr_john_doe",
"email": "john@acme.com",
"name": "John Doe"
},
"plan": "pro",
"settings": {
"timezone": "America/New_York",
"dateFormat": "MM/DD/YYYY",
"weekStartsOn": 1
}
}
}

Validation Rules

  • Workspace name must be 3-100 characters
  • Subdomain must be unique, lowercase, alphanumeric (3-50 characters)
  • User must have verified email address
  • User can create maximum 3 workspaces on free plan
  • Subdomain cannot be reserved keyword (admin, api, www, etc.)

Results

Success: WorkspaceCreated event is published

Failures:

  • WorkspaceValidationFailed: Invalid workspace data
  • SubdomainAlreadyTaken: Subdomain is not available
  • WorkspaceLimitReached: User exceeded workspace creation limit
16 properties

Command to create a new workspace

commandIdstring<uuid>
required
commandTypestringconstant: CreateWorkspaceCommand
required
timestampstring<date-time>
required
versionstring
required
dataobject
required