Xentree supports two authentication methods for protected endpoints:Bearer token for user-session requests
X-API-Key for server-to-server integration requests
Supported auth flow#
Access token#
Use the access token in the Authorization header:API key#
Use API key in the X-API-Key header:API keys are scope-based. Recommended scopes:conversations:read, conversations:write
organizations:read, organizations:write
integrations:read, integrations:write
api:read, api:write, api:admin
Grant only the scopes needed by your integration. For read-only integrations, use only :read scopes.Refresh token#
Xentree also supports session refresh via the refresh endpoint.Main endpoints#
Register#
Create a new user account.Login#
Exchange username and password for an access token.Content type: application/x-www-form-urlencoded
Refresh session#
Issue a fresh access token.Logout#
Invalidate the current session.Current user#
Return the authenticated user profile.This endpoint is bearer-only.
Update current user profile#
Patch profile-level attributes for the current user.This endpoint is bearer-only.
Integration token hardening (RS256, tenant-scoped)#
Integration grants are tenant-isolated and signed with tenant key pairs.Issue grant#
POST /api/integration/grant
Auth: Bearer or X-API-Key (with integrations:write)
{
"mode": "api",
"origin": "https://partner.example.com",
"scopes": ["profile:read", "quota:read"],
"ttlSeconds": 120
}
Verify grant token#
POST /api/integration/verify
Auth: Bearer or X-API-Key (with integrations:read)
{
"token": "<integration-jwt>",
"tenantId": "<tenant-id>"
}
POST /api/integration/revoke
Auth: Bearer or X-API-Key (with integrations:write)
{
"integrationToken": "<integration-jwt>",
"reason": "security-incident"
}
Alternative request using JTI:{
"tenantId": "<tenant-id>",
"jti": "<token-jti>",
"reason": "manual-revoke"
}
Rotate grant and optionally revoke old token#
POST /api/integration/rotate
Auth: Bearer or X-API-Key (with integrations:write)
{
"mode": "api",
"origin": "https://partner.example.com",
"scopes": ["profile:read"],
"ttlSeconds": 120,
"revokeIntegrationToken": "<old-integration-jwt>"
}
GET /api/integration/jwks
GET /api/integration/fingerprint
Admin observability (revocation registry)#
GET /api/admin/integration-token-revocations
Common query filters: tenant_id, jti, include_expired, limit
Integration endpoints emit rate-limit headers on token issuance/verification paths (grant, verify, and rotate):Retry-After (present on HTTP 429)
Representative 429 response detail:{
"detail": "Rate limit exceeded for grant. Try again in <seconds> seconds."
}
Example login request#
Common authentication errors#
401 Unauthorized#
Returned when the bearer token or API key is missing, expired, malformed, or invalid.403 Forbidden#
Returned when a valid principal lacks permission for the requested resource.For API keys, this can indicate insufficient key scope.Representative insufficient scope response:{
"detail": {
"error": "INSUFFICIENT_API_KEY_SCOPE",
"message": "API key lacks required scope for this endpoint",
"required_scope": "conversations:write",
"granted_scopes": ["conversations:read"]
}
}
Best practices#
store API keys securely and rotate them periodically
always send requests over HTTPS
refresh access tokens before long-running sessions expire
revoke sessions on logout or device disconnect
Modified at 2026-04-29 23:53:59