Skip to main content
To keep your workspace secure and enable flexible integrations, we support two authentication methods:
  1. Token-based Authentication – For user-specific access (e.g., web or mobile apps)
  2. Client Credentials Authentication – For public or system-level integrations using workspace-scoped credentials
Every API request must be authenticated using one of these methods. This page explains how to get started with each.

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

  1. A user logs in using the login endpoint.
  2. The system returns a token if credentials are valid.
  3. The token is then passed in every API request via the Authorization header.

Header Format

⚠️ Do not prefix the token with Bearer. The token should be passed directly as a raw string.

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

  1. 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.
  2. Click Create Client Key.
  3. Assign a clear and descriptive label to the client key (e.g., “marketing-automation”) that reflects its specific purpose.
  4. 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. An x-client-user, when passed, must belong to the same workspace and be an Active member.
Once created, you will get:
  • 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)
You can create multiple client keys, each with a clear and descriptive name based on its specific purpose. Each key is permanently tied to the workspace it was created in and can only access that workspace’s data.

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 and be an Active member).

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, role and team writes, task reads and writes, project reads and lifecycle control, template reads and writes, reporting, the Enterprise Locations bulk writes, and single location attribute updates, deletes, and value reads). Calling any other route with a client key returns:
Each allow-listed route still enforces its own permission on the key’s user (e.g. 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, Custom Roles, 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
They behave identically. Because a client key is bound to exactly one workspace, the shorter form resolves the workspace from the key, and the workspace-scoped form must name that same workspace. The user-lifecycle endpoints appear in both shapes across this documentation — the reference pages use the workspace-scoped form, the User Lifecycle guide uses the shorter one. Pick either. Where an endpoint page shows only one shape (for example the Enterprise Locations endpoints, which are workspace-scoped only), use the shape shown. The Templates endpoints are open only in the workspace-scoped form (/api/v1/ops/workspaces/{workspaceId}/checklists/...); calling the same template endpoints on the shorter /api/v1/ops/checklists or /api/v1/ops/checklists/{templateId} path returns 403 for a client key.

Authentication Failures

If authentication fails, the API returns HTTP 401, for example:
Make sure:
  • Token or client credentials are valid (401 Invalid client credentials means 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 and is an Active member (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, create, update and delete workspace roles
  • Teams API - List, create, update and delete workspace teams
  • 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
  • Templates API - List and read templates, create or edit them, archive them, and duplicate them
  • Reporting API - Submission records and analytics for BI tools
  • Data Extraction guide - Pull Xenia data into Power BI and other BI tools

Support

Need help getting started? Contact us at support@xenia.team.