Skip to main content

Overview

This guide covers the user-management endpoints reachable with a client key: listing users, reading the caller’s context, provisioning new users (with or without SSO), updating profiles, changing roles, setting passwords/PINs, activating/deactivating, and removing users.
Creating users is done through the Provision Users endpoint (POST /api/v1/mgt/users/provision) — which works whether or not the workspace uses SSO; see the Single Sign-On guide for how it interacts with SSO’s own automatic provisioning, and Directory Sync if you want Xenia to read your IdP’s directory instead of being told who to create. Provisioning is silent by default and can invite the users it creates — see Inviting the users you provision. The admin “register user” routes are not accessible via API key. Most actions here enforce the key’s default-user permissions (e.g. CAN_MANAGE_USERS, CAN_MANAGE_USER_ROLES) — the required permission is noted per section below — so choose a default user whose role grants what your integration needs. (Provisioning has no separate permission gate.)

Authentication & base URL

All requests go to https://api.xenia.team; every path starts with /api/v1. Authenticate with:
The workspace is derived from the key. Where a path shows {workspaceId} it must be your key’s own workspace; most user routes also accept an unscoped form (e.g. /api/v1/mgt/users/{userId}/role) and resolve the workspace from the key automatically.
Response envelopes: list/read endpoints return { data, meta }; message-style endpoints return { data, extra_meta: { message } }; user-context returns { data, message, extra_meta: { token } }. There is no status/statusCode/success/requestId field. Successful POST/PATCH/PUT calls return HTTP 200.

List Users

Retrieve users in your workspace. Endpoint: GET /api/v1/mgt/workspaces/{workspaceId}/users
Query Parameters: none. This endpoint returns all users in the workspace; it does not support query-based paging or filtering — passing params such as offset or limit returns a 422. Response:
UserWorkspaces holds a user’s membership per workspace (role, status, default location, admin flag); UserWorkspace (singular) is the membership for your key’s workspace; UserLocations lists assigned location IDs.

Membership statuses


Get User Context

Return the caller’s identity, workspace memberships, features, and permissions. When no x-client-user is supplied, this reflects the key’s default user. Endpoint: GET /api/v1/mgt/user-context
Response:

Provision Users (create / sync)

Create new users or sync existing ones for a workspace in a single call — the API-key path for programmatic user creation. New users are created and existing ones (matched by email) have their role and location memberships updated. Endpoint: POST /api/v1/mgt/users/provision
Request Body:
Resolve valid role_id and location_ids with the workspace-discovery reads — see the Roles API and Locations API.

Inviting the users you provision

By default this endpoint is silent — it creates accounts and sends nothing, which is what an integration syncing a system of record usually wants. Pass notification: "auto" to have Xenia invite each newly created user, choosing the email by their address’s domain: An existing user is never emailed, whatever you pass: re-provisioning is a sync, not an onboarding event, and the alternative is re-mailing everyone each time your integration runs.
notification: "auto" requires the client key to have a default user, because both emails are sent on a named person’s behalf. Without one the whole batch is rejected before anything is written, rather than creating some users and failing to notify them. notification: "none" has no such requirement.
location_ids are expanded to their leaf locations before membership is written, so passing a district or region grants the stores beneath it. Membership is stored flat and several read paths match a location literally rather than walking the hierarchy, so a user holding only a parent node would sign in to empty Submissions and Tasks pages. Passing leaves directly is unaffected.
If you would rather Xenia read your identity provider’s directory than be told who to create, see Directory Sync — it mirrors the directory over SCIM and invites from it with rules that assign role and locations from directory attributes.
Response (this endpoint returns a per-user result list rather than the standard envelope):
Per-user failures are returned in errors (e.g. { "email": "...", "error": "Invalid role_id: ..." }) without failing the whole batch.

Update User Profile

Modify a user’s profile fields. Endpoint: PATCH /api/v1/mgt/users/{userId}/profile
Request Body (all optional): Response:

Change User Role

Update the role assigned to a user. roleId goes in the body (the path ends at /role). Endpoint: PATCH /api/v1/mgt/users/{userId}/role
Response:
Requires the CAN_MANAGE_USER_ROLES permission. Role changes take effect immediately.

Deactivate User

Set a user’s workspace membership to Inactive without removing them. Endpoint: PATCH /api/v1/mgt/users/{userId}/deactivate
Response:
Requires CAN_MANAGE_USERS.

Set User Status

Explicitly set a user’s membership status. Valid values are Active and Inactive only (transitions to/from Pending are rejected). Use status/Active to reactivate a deactivated user. Endpoint: PATCH /api/v1/mgt/users/{userId}/status/{status}
Response:

Set User Password

Set or reset a user’s password. The target user is identified in the body, not the path. Endpoint: PATCH /api/v1/mgt/set-password
Request Body: Response:
Requires CAN_MANAGE_USERS and CAN_MANAGE_USERS_PASSWORD. Setting the password also activates the user’s membership. A workspace-scoped variant PATCH /api/v1/mgt/workspaces/{workspaceId}/set-password also exists.

Set User Login PIN

Set a numeric login PIN (mobile quick-login). The target user is identified in the body. Because a PIN lets the target user sign in, this is a privileged action: the key’s user must hold CAN_MANAGE_USERS and CAN_MANAGE_USERS_PASSWORD (same as setting a password) — otherwise the call returns 403. Endpoint: PUT /api/v1/mgt/set-login-pin
Request Body: Response:

Delete User

Remove a user from the workspace. This soft-deletes the workspace membership (and location memberships); the underlying user account is hard-deleted only if they have no remaining workspaces. Endpoint: DELETE /api/v1/mgt/users/{userId}
Response:
Requires CAN_MANAGE_USERS. You can’t delete your own user, can only remove peers/subordinates, and can’t remove the last active admin. Consider deactivating instead for temporary removals.

Permissions Required

The admin “register user” routes (/api/v1/admin/...) are not on the API-key allow-list. Use POST /api/v1/mgt/users/provision for programmatic user creation.

Next Steps

Roles API

List workspace roles to resolve role_id

Locations API

List locations to resolve location_ids

Single Sign-On guide

How SSO login, just-in-time provisioning, and deactivation work together