Skip to main content
curl --request POST \
  --url https://api.usedatabrain.com/api/v2/data-app/rotate-api \
  --header 'Authorization: Bearer 550e8400-e29b-41d4-a716-446655440000' \
  --header 'Content-Type: application/json' \
  --data '{
    "expireAt": 0
  }'
{
  "key": "7c9e6679-7425-40de-944b-e07fc1f90ae7"
}
POST
https://api.usedatabrain.com
/
api
/
v2
/
data-app
/
rotate-api
curl --request POST \
  --url https://api.usedatabrain.com/api/v2/data-app/rotate-api \
  --header 'Authorization: Bearer 550e8400-e29b-41d4-a716-446655440000' \
  --header 'Content-Type: application/json' \
  --data '{
    "expireAt": 0
  }'
{
  "key": "7c9e6679-7425-40de-944b-e07fc1f90ae7"
}
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 the Authorization 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:
  1. Go to your Databrain dashboard and open the Data Apps section.
  2. Select the data app whose API key you want to rotate.
  3. Find the API Key under the data app settings.
Use this key as the Bearer value in your Authorization header.

Headers

Authorization
string
required
Bearer token for API authentication. Use the data app API key you want to rotate.
Authorization: Bearer 550e8400-e29b-41d4-a716-446655440000
Content-Type
string
required
Must be set to application/json for all requests.
Content-Type: application/json

Request Body

expireAt
number | string
required
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

key
string
The newly generated API key (UUID format). Use this key for all future API requests.
error
object
Error object returned only when the request fails. Not included in successful responses.

Examples

HTTP Status Code Summary

Status CodeDescription
200OK - Key rotated successfully
400Bad Request - Invalid request parameters or invalid key state
401Unauthorized - API key not found in DB or already expired
500Internal Server Error - Server error occurred

Possible Errors

Error CodeHTTP StatusDescription
INVALID_REQUEST_BODY400Missing or invalid expireAt parameter
AUTHENTICATION_ERROR400 / 401API key missing or not a valid UUID (400); or not found / already expired in DB (401)
INVALID_DATA_APP_API_KEY400Token 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_ERROR500Server error