POST route that accepts a discriminated action body. Every mutating operation on organizations — creating one, updating its settings or branding, managing locations, roles, members, billing, and even deleting the org — is dispatched through this one endpoint. The action field in the request body determines which operation runs and which additional fields are required.
All requests require a valid Bearer token. Most actions that target an existing organization also require your role to have the corresponding permission. See Org permission model below.
Workspace actions endpoint
Request headers
Bearer token from your Clerk session. Example:
Bearer eyJhbGc...Must be
application/json.Request body
The action to perform. Must be one of the action type strings listed in the sections below.
action value. Each action is documented in its own section below.
Response
On success, returns{ "ok": true } plus any action-specific fields (e.g., createdOrgId).
On failure, returns HTTP 400 with an error body:
issues field:
Create organization
action:createOrganization
Creates a new organization and sets it as the caller’s active organization. The caller is automatically assigned the built-in owner role and a free-tier billing account is provisioned.
Body fields
"createOrganization"Organization display name. 1–120 characters.
URL-safe slug for the organization. Lowercase alphanumeric with hyphens; 2–48 characters; must start and end with an alphanumeric character. If omitted, a slug is auto-generated from
name. Must be unique across all organizations.Response fields
true on success.ID of the newly created organization.
Example
Set active organization
action:setActiveOrganization
Sets the active organization for your user session. You must already be an active member of the target organization. The touchActiveOrganizationFromNavigation action is an alias with identical behavior, used internally by the navigation shell.
Body fields
"setActiveOrganization" or "touchActiveOrganizationFromNavigation"ID of the organization to set as active. Must be an org you are an active member of.
Example
Update organization settings
action:updateOrganizationSettings
Updates the display name and slug for an existing organization. Requires the orgSettings permission.
Body fields
"updateOrganizationSettings"ID of the organization to update.
New display name. 1–120 characters.
New slug. Lowercase alphanumeric with hyphens; 2–48 characters; must start and end with an alphanumeric character. Must be unique across all organizations.
Update organization branding
action:updateOrganizationBrand
Updates the custom brand name, logo URL, and primary color for an organization. Requires the brand permission. All fields are optional; pass null to clear a value.
Body fields
"updateOrganizationBrand"ID of the organization to update.
Custom brand display name. Maximum 120 characters. Pass
null to clear.URL to the organization logo. Maximum 2000 characters. Pass
null to clear.Primary brand color as a
#RRGGBB hex string (e.g. "#1A56DB"). Maximum 7 characters. Pass null to clear.Create location
action:createOrgLocation
Adds a new location to the organization. Locations are appended at the end of the existing sort order. Requires the locations permission.
Body fields
"createOrgLocation"ID of the organization.
Location display name. 1–120 characters.
Street address. Maximum 200 characters.
City. Maximum 80 characters.
State, province, or region. Maximum 80 characters.
Postal code. Maximum 20 characters.
ISO 3166-1 alpha-2 country code (e.g.
"US"). Stored in uppercase. Maximum 2 characters.Phone number. Maximum 40 characters.
Update location
action:updateOrgLocation
Updates an existing location. Requires the locations permission.
Body fields
"updateOrgLocation"ID of the organization.
ID of the location to update. Must belong to the specified organization.
Updated location name. 1–120 characters.
Updated street address. Maximum 200 characters.
Updated city. Maximum 80 characters.
Updated region. Maximum 80 characters.
Updated postal code. Maximum 20 characters.
Updated country code. Stored in uppercase. Maximum 2 characters.
Updated phone number. Maximum 40 characters.
Delete location
action:deleteOrgLocation
Permanently removes a location from the organization. Requires the locations permission.
Body fields
"deleteOrgLocation"ID of the organization.
ID of the location to delete. Must belong to the specified organization.
Create role
action:createOrgRole
Creates a new custom role for the organization with a defined permission set. Requires the roles permission. The slug "owner" is reserved and cannot be used for custom roles.
Body fields
"createOrgRole"ID of the organization.
Role display name. 1–80 characters.
URL-safe slug for the role. Lowercase alphanumeric with hyphens; 2–32 characters; must start and end with alphanumeric. If omitted, auto-generated from
name. Cannot be "owner".An object mapping permission keys to boolean values. Any key not included defaults to
false. See Org permission model for the full list of keys.Example
Update role permissions
action:updateOrgRolePermissions
Updates the permission set for an existing custom role. Requires the roles permission. The built-in owner role cannot be modified through this action.
Body fields
"updateOrgRolePermissions"ID of the organization.
ID of the role to update. Must belong to the specified organization. Cannot be the
owner role.Updated permission map. Any key not included defaults to
false.Delete role
action:deleteOrgRole
Permanently removes a custom role from the organization. The built-in owner role cannot be deleted. Roles with active members must have all members reassigned before deletion. Requires the roles permission.
Body fields
"deleteOrgRole"ID of the organization.
ID of the role to delete. Must have zero assigned members.
Invite member by email
action:inviteOrgMember
Creates a pending invitation for an email address. The invited user appears in the member list with status: "INVITED" and a synthetic userId of "invite:<email>". Requires the members permission.
Body fields
"inviteOrgMember"ID of the organization.
Email address to invite. Must be a valid email; maximum 254 characters.
Slug of the role to assign to the invited member. Defaults to
"owner" if omitted. The role must already exist in the organization.Add member by user ID
action:addOrgMemberByUserId
Directly adds an existing Clerk user to the organization as an active member. Use this when you already know the user’s Clerk ID rather than their email address. Requires the members permission.
Body fields
"addOrgMemberByUserId"ID of the organization.
Clerk user ID of the user to add. Must start with
"user_".Slug of the role to assign. Defaults to
"owner" if omitted.Update member role
action:updateOrgMemberRole
Changes the role assigned to an existing member. Requires the members permission.
Body fields
"updateOrgMemberRole"ID of the organization.
ID of the membership record to update.
Slug of the new role to assign. 1–40 characters. The role must exist in the organization.
Remove member
action:removeOrgMember
Removes a member from the organization. The organization owner cannot be removed. Requires the members permission.
Body fields
"removeOrgMember"ID of the organization.
ID of the membership record to remove.
Update billing account
action:updateBillingAccount
Updates the billing account for an organization. Requires the billing permission.
This action updates billing records directly. For Stripe-managed subscriptions, use the Stripe integration to initiate checkout or portal sessions rather than writing Stripe IDs directly.
Body fields
"updateBillingAccount"ID of the organization.
Subscription tier. One of
"FREE", "STARTER", "PRO", "ENTERPRISE".Billing status. One of
"NONE", "ACTIVE", "PAST_DUE", "CANCELED".Stripe customer ID. Maximum 120 characters. Pass
null to clear.Stripe subscription ID. Maximum 120 characters. Pass
null to clear.Delete organization
action:deleteOrganization
Permanently deletes the organization and all associated data. Only the organization owner can perform this action. It also requires the orgSettings permission.
Body fields
"deleteOrganization"ID of the organization to delete.
Response fields
true on success.Always
"/orgs". Clients should redirect the user here after a successful deletion.Upsert user profile
action:upsertUserProfile
Creates or updates your own user profile. All fields are optional; omitted fields are set to null. The publicSlug, if provided, must be unique across all users and follow the same format rules as org slugs (lowercase alphanumeric with hyphens, 2–48 characters).
Body fields
"upsertUserProfile"Preferred display name. Maximum 120 characters.
Job title or role description. Maximum 120 characters.
Short biography. Maximum 2000 characters.
URL to your avatar image. Maximum 2000 characters.
Accent color or style token for profile tile display. Maximum 32 characters.
Public profile slug. Lowercase alphanumeric with hyphens; 2–48 characters; must start and end with alphanumeric. Must be globally unique.
Example
Org permission model
Every organization member is assigned a role. Each role carries apermissions object with six boolean keys. Permissions default to false for custom roles; the built-in owner role always has all permissions set to true.
| Permission key | What it controls |
|---|---|
orgSettings | Update the organization name and slug; delete the organization |
brand | Customize brand name, logo URL, and primary color |
locations | Add, edit, and remove locations |
roles | Create custom roles, update role permissions, delete roles |
members | Invite members by email or user ID, update member roles, remove members |
billing | Update billing account tier, status, and Stripe identifiers |
Organization owners always have all six permissions regardless of what is stored in the role’s
permissions field. The owner role is a built-in role (isBuiltIn: true) with slug "owner" and cannot be deleted or have its permissions modified through the API.GET /v1/workspace/org-bundle/:orgId. The response includes your assigned role object with its full permissions map, as well as the complete list of roles defined for the organization.
Error cases
| Status | Error message | Cause |
|---|---|---|
400 | "Invalid body." with issues | Request body failed schema validation. |
400 | "That slug is already taken." | A different organization already uses the requested org slug. |
400 | "Slug must be 2–48 chars, lowercase letters, numbers, hyphens; start/end with alphanumeric." | Org slug format is invalid. |
400 | "Not a member of this organization." | You are not an active member of the target org. |
400 | "You do not have permission for this action." | Your role does not include the required permission key. |
400 | "Cannot remove the organization owner." | Attempted to remove the member who owns the org. |
400 | "Reassign members before deleting this role." | Role still has members assigned. |
400 | "Cannot delete owner role." | Attempted to delete the built-in owner role. |
400 | "Cannot change owner permissions here." | Attempted to modify the owner role’s permissions. |
400 | "Only the owner can delete the workspace." | Attempted deleteOrganization without being the org owner. |
400 | "Primary color must be #RRGGBB hex." | brandPrimaryHex was not a valid 6-digit hex color. |
400 | "That public slug is already taken." | Another user’s profile already uses the requested public slug. |
401 | Missing Authorization Bearer token. | No Authorization header was sent. |
401 | Invalid or expired token. | The Bearer token is malformed or has expired. |
