Create & Retrieve Workspaces
Create a new workspace, list the workspaces the current user belongs to, and fetch a single workspace.
Create Workspace
POST /wallethero-api/workspace/create
Creates a workspace, adds the caller as workspace admin, and seeds the default data-model fields. Name and slug are checked for uniqueness.
Auth: Bearer token — system admins only (directus_users.system_admin). Other callers receive 403 { "error": "forbidden" }. Regular onboarding goes through POST /system/workspaces, which can assign or invite an owner.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Workspace display name (1–100 characters) |
slug | string | Yes | URL-friendly identifier (1–100 characters, must match ^[a-z_]+$ — lowercase letters and underscores only) |
Example Request
curl -X POST "https://api.wallethero.app/wallethero-api/workspace/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "Acme Coffee Rewards", "slug": "acme_coffee" }'Response (200)
{
"message": "Workspace created successfully",
"workspace": {
"id": "11111111-1111-1111-1111-111111111111",
"name": "Acme Coffee Rewards",
"slug": "acme_coffee",
"date_created": "2024-01-15T10:30:00Z",
"date_updated": null,
"user_created": "22222222-2222-2222-2222-222222222222"
}
}SDK
// The SDK adapts the response to { data: Workspace }.
const { data: workspace } = await wh.workspaces.create({
name: "Acme Coffee Rewards",
slug: "acme_coffee",
});List My Workspaces
GET /wallethero-api/workspaces/mine
Lists the workspaces the authenticated user is a member of, newest first.
Auth: Bearer token — scoped to the caller's memberships.
Example Request
curl "https://api.wallethero.app/wallethero-api/workspaces/mine" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{
"id": "11111111-1111-1111-1111-111111111111",
"name": "Acme Coffee Rewards",
"slug": "acme_coffee",
"date_created": "2024-01-15T10:30:00Z",
"date_updated": "2024-02-01T09:00:00Z",
"user_created": "22222222-2222-2222-2222-222222222222"
}
]
}SDK
const { data: workspaces } = await wh.workspaces.list();Get Workspace
GET /wallethero-api/workspace/:workspaceId
Fetches a single workspace by ID. The caller must be a member.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | string (UUID) | Workspace identifier |
Example Request
curl "https://api.wallethero.app/wallethero-api/workspace/WORKSPACE_ID" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": {
"id": "11111111-1111-1111-1111-111111111111",
"name": "Acme Coffee Rewards",
"slug": "acme_coffee",
"date_created": "2024-01-15T10:30:00Z",
"date_updated": "2024-02-01T09:00:00Z",
"user_created": "22222222-2222-2222-2222-222222222222"
}
}A missing workspace returns 404 with { "error": "Workspace not found" }.
SDK
const { data: workspace } = await wh.workspaces.get("WORKSPACE_ID");