API Tokens
Rotate API Key
Rotate your Data App API key to enhance security and manage key lifecycle effectively.
POST
Rotate your data app API key to maintain security best practices by periodically refreshing credentials. This endpoint expires the current API key and generates a new one, ensuring seamless transition while maintaining security.
The API key used in the
Authorization header is the key being rotated. You only need to provide expireAt in the request body — no key field required.Authentication
This endpoint requires the data app API key you want to rotate in theAuthorization header. The key used for authentication is the key that will be expired and replaced with a new one.
To access your data app API key:
- Go to your Databrain dashboard and open the Data Apps section.
- Select the data app whose API key you want to rotate.
- Find the API Key under the data app settings.
Headers
Bearer token for API authentication. Use the data app API key you want to rotate.
Must be set to
application/json for all requests.Request Body
Duration in seconds until the current API key expires. This allows for a grace period to update your applications before the old key stops working. Accepts a number or a numeric string.
Response
The newly generated API key (UUID format). Use this key for all future API requests.
Error object returned only when the request fails. Not included in successful responses.
Examples
HTTP Status Code Summary
| Status Code | Description |
|---|---|
200 | OK - Key rotated successfully |
400 | Bad Request - Invalid request parameters or invalid key state |
401 | Unauthorized - API key not found in DB or already expired |
500 | Internal Server Error - Server error occurred |
Possible Errors
| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_REQUEST_BODY | 400 | Missing or invalid expireAt parameter |
AUTHENTICATION_ERROR | 400 / 401 | API key missing or not a valid UUID (400); or not found / already expired in DB (401) |
INVALID_DATA_APP_API_KEY | 400 | Token is a service token (no dataAppId), key not found, belongs to a different org, or the key already has an expiry date set |
INTERNAL_SERVER_ERROR | 500 | Server error |
Related Resources
API Token Guide
Learn about API token management and authentication
Create Data App
Create data apps and generate initial API tokens
Guest Token API
Generate guest tokens using your data app API key
List Embeds API
List all embed configurations for your data app

