- Token-based Authentication – For user-specific access (e.g., web or mobile apps)
- Client Credentials Authentication – For public or system-level integrations using workspace-scoped credentials
1. Token-based Authentication
This method is for users who log in to Xenia via the UI or mobile app and need to access protected endpoints.Flow Overview
- A user logs in using the login endpoint.
- The system returns a token if credentials are valid.
- The token is then passed in every API request via the
Authorizationheader.
Header Format
Example
2. Client Credentials Authentication (Public APIs)
Use this method when you want to integrate with Xenia on behalf of a workspace — for automations, backend services, or 3rd-party integrations.Setup Instructions
- In the Xenia web app, open Settings → Public Integrations (this is an add-on capability — if you don’t see it, contact your Xenia representative to enable it for your workspace). Creating keys requires the Manage API Access Keys permission, granted to workspace Owners by default.
- Click Create Client Key.
- Assign a clear and descriptive label to the client key (e.g., “marketing-automation”) that reflects its specific purpose.
- Choose a default user from your workspace. The key’s data access, and which endpoints it can call, are governed by that user’s role and location access.
This user will represent the API caller if x-client-user is not explicitly passed.
- client key (the name/identifier you chose)
- client secret (a generated token, shown only once — copy and store it securely; it cannot be retrieved later)
Header Format
- x-client-user is optional.
- If not provided, API acts as the default user tied to that key.
- If provided, API will impersonate that user (must belong to the same workspace).
Example
Each header also has a query-string equivalent (
?token=, ?clientKey=, ?clientSecret=, ?clientUser=) for tools that can’t set custom headers. Headers are preferred.What a client key can call
Client keys can only reach a specific allow-listed set of endpoints — the ones documented in this API Reference (reads, user lifecycle, task reads and writes, project reads and lifecycle control, reporting, and the Enterprise Locations bulk writes). Calling any other route with a client key returns:CAN_VIEW_REPORTING, CAN_MANAGE_USERS), so use a default user whose role grants the access your integration needs. Some routes additionally require a feature on the workspace (for example Public API, Advanced Dashboards, Advanced Location Based Assignment, or Location Attributes) — those are called out on the endpoint page, and a missing feature also returns 403.
Two path shapes
Several management endpoints are registered under two paths, and both are allow-listed:- a workspace-scoped form —
PATCH /api/v1/mgt/workspaces/{workspaceId}/users/{userId}/role - a shorter form without the workspace segment —
PATCH /api/v1/mgt/users/{userId}/role
Authentication Failures
If authentication fails, the API returns HTTP401, for example:
- Token or client credentials are valid (
401 Invalid client credentialsmeans the key/secret is wrong or the key was deactivated) - Headers are correctly formatted and case-sensitive
- The x-client-user (if used) belongs to the correct workspace (otherwise
401 User not found in the workspace)
Best Practices
- Keep your client secrets secure and never expose them in frontend code.
- Use one key per use-case to isolate integrations.
- Rotate credentials periodically.
- Use token-based auth for logged-in users (mobile/web).
- Use client credentials for integrations and automation.
Next Steps
Now that you’re authenticated and can make requests, explore the API documentation:- Locations API - Read your organization’s locations
- Users API - User lifecycle management
- Single Sign-On guide - How SSO login and user provisioning work together
- Roles API - List workspace roles
- Teams API - List workspace teams, for resolving task assignees
- Tasks API - Read tasks and work orders, and create, edit, re-status or delete tasks
- Projects API - Read recurring projects and their schedules, and pause, resume or end them
- Reporting API - Submission records and analytics for BI tools
- Data Extraction guide - Pull Xenia data into Power BI and other BI tools