Clone Workspace — full data (v1)
Method & Path (metadata)
GET /v1/admin/workspaces/:workspaceId/clone-requirements
Description (metadata)
Returns whether the source workspace has a storefront and/or vCard, so the admin UI can require new public slugs before cloning.
Persona access: Admin with businesses.manage.
Response 200 OK (metadata)
{
"needsStorefrontSlug": true,
"needsVcardSlug": false,
"sourceStoreSlug": "old-store",
"sourceVcardSlug": null
}
Method & Path (clone)
POST /v1/admin/workspaces/:workspaceId/clone
Description (clone)
Creates a new workspace (new owner email, password, phone) and copies workspace profile plus domain data from the source: staff (emails uniquified), CRM clients, sessions, storefront (with new store slug if a store exists), products, orders, POS, lab configuration and visits, nutrition, forms, SMS/email logs, expenses, suppliers, payments metadata, short links (new codes), tracking links (destination slugs updated), etc.
Persona access: Admin with businesses.manage.
Slugs: If the source has a StorefrontStore, storefrontSlug is required (globally unique). If the source has a VCard, vcardSlug is required (globally unique). Format: lowercase letters, numbers, hyphens.
Not copied (by design): custom domains (StorefrontDomain — DNS/SSL are environment-specific), MFA enrollment for the new owner, workspace activity logs, page-view analytics, push tokens, transient OTP sessions. Files in object storage keep the same URLs (shared blobs); only database rows are duplicated.
Authentication
Required: Admin JWT with businesses.manage.
Authorization: Bearer <admin_token>
Request Body (clone)
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | New workspace login email (unique) |
password | string | Yes | Min 8 chars, at least one digit |
phone | string | Yes | E.164, unique |
name | string | No | Display name; defaults to source |
storefrontSlug | string | If source has store | New public storefront slug |
vcardSlug | string | If source has vCard | New public vCard slug |
Response 201 Created
Same as before: { "message": "...", "workspace": { ... } }.
Common Errors
422: Missing or invalid slugs when source has store/vCard; slug already taken; validation fieldErrors may be Arabic messages from the API.
409: Email or phone conflict.
500: Clone failure — the API attempts to purge partial data for the new workspace ID before surfacing the error.