Skip to content

Update, Delete & Seed Workspace

Update a workspace's name/slug, delete (or clear) a workspace, and seed a demo user.


Update Workspace

PATCH /wallethero-api/workspace/:workspaceId

Updates a workspace's name and/or slug. At least one field must be provided. Both are checked for uniqueness across other workspaces.

Auth: Bearer token — requires the manage_workspace_settings permission (admin).

Path Parameters

ParameterTypeDescription
workspaceIdstring (UUID)Workspace identifier

Request Body

At least one of:

FieldTypeRequiredDescription
namestringNoNew display name (1–100 characters)
slugstringNoNew slug (1–100 characters, must match ^[a-z_]+$)

Example Request

bash
curl -X PATCH "https://api.wallethero.app/wallethero-api/workspace/WORKSPACE_ID" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Coffee Club" }'

Response (200)

json
{
  "message": "Workspace updated successfully",
  "workspace": {
    "id": "11111111-1111-1111-1111-111111111111",
    "name": "Acme Coffee Club",
    "slug": "acme_coffee",
    "date_created": "2024-01-15T10:30:00Z",
    "date_updated": "2024-02-01T09:00:00Z"
  }
}

SDK

typescript
// The SDK adapts the response to { data: Workspace }.
const { data: workspace } = await wh.workspaces.update("WORKSPACE_ID", {
  name: "Acme Coffee Club",
});

Delete or Clear Workspace

DELETE /wallethero-api/workspace/:workspaceId

Permanently deletes the workspace and all related data (cascade). If the query parameter preserve_workspace=true is set, the workspace row is kept but all of its data (passes, clients, templates, campaigns, tiers, rewards, automation rules, etc.) is cleared.

Auth: Bearer token — requires the delete_workspace permission (admin).

Path Parameters

ParameterTypeDescription
workspaceIdstring (UUID)Workspace identifier

Query Parameters

ParameterTypeRequiredDefaultDescription
preserve_workspacebooleanNofalseWhen true, clears the workspace's data but keeps the workspace itself

Example Request

bash
# Delete the workspace entirely
curl -X DELETE "https://api.wallethero.app/wallethero-api/workspace/WORKSPACE_ID" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Clear data but keep the workspace
curl -X DELETE "https://api.wallethero.app/wallethero-api/workspace/WORKSPACE_ID?preserve_workspace=true" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

json
{
  "message": "Workspace deleted successfully",
  "workspace_id": "11111111-1111-1111-1111-111111111111"
}

When clearing, the message is "Workspace data cleared successfully".

DANGER

Deleting a workspace cannot be undone. All projects, templates, passes, clients, campaigns, segments, events, tiers, rewards, automation rules, members, and invitations are removed.

SDK

typescript
// Delete the workspace
await wh.workspaces.deleteWorkspace("WORKSPACE_ID");

// Or clear its data, keeping the workspace
await wh.workspaces.clearWorkspace("WORKSPACE_ID");

Seed Demo User

POST /wallethero-api/workspace/:workspaceId/seed-demo-user

Upserts a user by email and adds them to the workspace with the admin role. Because the matched user's password and role are overwritten by a global email lookup, this is restricted to platform administrators.

Auth: Bearer token — platform admin only (requireAdminAccess).

Path Parameters

ParameterTypeDescription
workspaceIdstring (UUID)Workspace identifier

Request Body

FieldTypeRequiredDescription
emailstring (email)YesEmail of the demo user to create or update
passwordstringYesPassword to set for the demo user
first_namestringNoFirst name
last_namestringNoLast name

Example Request

bash
curl -X POST "https://api.wallethero.app/wallethero-api/workspace/WORKSPACE_ID/seed-demo-user" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "demo-password",
    "first_name": "Demo",
    "last_name": "User"
  }'

Response (200)

json
{
  "message": "Demo user created successfully",
  "status": "created",
  "user": {
    "id": "33333333-3333-3333-3333-333333333333",
    "email": "[email protected]"
  }
}

status is "created" for a new user or "updated" for an existing one (message reflects this).

SDK

No SDK method — call the REST endpoint directly.

WalletHero Documentation