Rotate the organization service token. The current token is set to expire after a grace period (in seconds), and a new service token is returned. Use this for key rotation and security best practices.
Self-Hosted Only: This endpoint is available only on self-hosted Databrain instances.
Authentication Requirement: This endpoint requires an authenticated admin user (Bearer token) and a subscribed account.
Authentication
Use a valid admin session token in the Authorization header (e.g. from Create Admin JWT).
Bearer token for an authenticated admin user.Authorization: Bearer <access_token>
Must be application/json when sending a JSON body.Content-Type: application/json
Request Body
The current service token (UUID) to rotate. This token will be expired according to expireAt. Must be a valid UUID.
Duration in seconds until the current token expires. The old token remains valid until this many seconds from the request, then it is invalidated. Use 0 to expire immediately. Common values: 0 (immediate), 3600 (1 hour), 86400 (24 hours). Allows a grace period to update clients before the old token stops working.
Response
On success, the API returns 200 with a JSON object:
The new service token (UUID). Use this for all future service-level API calls. Store it securely; the previous token will expire per expireAt.
On error, the API returns a JSON object with error.code and error.message and an appropriate HTTP status (400 or 500).
Examples
HTTP Status Code Summary
| Status Code | Description |
|---|
200 | OK – New service token returned in key |
400 | Bad Request – Invalid token, missing parameters, or token already expired |
500 | Internal Server Error – Server error or self-hosted-only error |
Possible Errors
| Code | Message | HTTP Status |
|---|
INVALID_REQUEST_BODY | Joi validation message (e.g. "token" is required, "expireAt" is required, invalid UUID) | 400 |
AUTHENTICATION_ERROR | Invalid Service Token | 400 |
EXPIRED_SERVICE_TOKEN | Service token is already expired | 400 |
INVALID_SERVICE_TOKEN | Invalid service token | 400 |
SELFHOSTED_APP_ERROR | This feature is only available for self-hosted instances | 500 |
INTERNAL_SERVER_ERROR | Internal server error or GraphQL error message | 500 |