Skip to main content
curl --request GET \
  --url 'https://api.usedatabrain.com/api/v2/data-app/api-tokens?dataAppName=Customer%20Portal%20Analytics' \
  --header 'Authorization: Bearer service_token_xyz...'
{
  "data": [
    {
      "key": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Production API Key",
      "description": "API key for data app Customer Portal Analytics",
      "createdAt": "2024-01-15T10:30:00Z"
    },
    {
      "key": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "name": "Development Token",
      "description": "API key for data app Customer Portal Analytics",
      "createdAt": "2024-01-10T14:15:00Z"
    },
    {
      "key": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "name": "Staging Environment",
      "description": "API key for data app Customer Portal Analytics",
      "createdAt": "2024-01-08T09:00:00Z"
    }
  ]
}
GET
https://api.usedatabrain.com
/
api
/
v2
/
data-app
/
api-tokens
curl --request GET \
  --url 'https://api.usedatabrain.com/api/v2/data-app/api-tokens?dataAppName=Customer%20Portal%20Analytics' \
  --header 'Authorization: Bearer service_token_xyz...'
{
  "data": [
    {
      "key": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Production API Key",
      "description": "API key for data app Customer Portal Analytics",
      "createdAt": "2024-01-15T10:30:00Z"
    },
    {
      "key": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "name": "Development Token",
      "description": "API key for data app Customer Portal Analytics",
      "createdAt": "2024-01-10T14:15:00Z"
    },
    {
      "key": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "name": "Staging Environment",
      "description": "API key for data app Customer Portal Analytics",
      "createdAt": "2024-01-08T09:00:00Z"
    }
  ]
}
Get a list of all API tokens for a specific Data App. This is useful for managing and auditing API tokens associated with your Data Apps.
Authentication Requirement: This endpoint requires a service token (not a data app API key). Service tokens have elevated permissions to manage API tokens across your organization.

Endpoint Formats

Authentication

This endpoint requires a service token in the Authorization header. Service tokens differ from data app API keys and provide organization-level permissions. To access your service token:
  1. Go to your Databrain dashboard and open Settings.
  2. Navigate to Settings.
  3. Find the Service Tokens section.
  4. Click the “Generate Token” button to generate a new service token if you don’t have one already.
Use this token as the Bearer value in your Authorization header.

Headers

Authorization
string
required
Bearer token for API authentication. Use your service token (not data app API key).
Authorization: Bearer service_token_xyz...

Query Parameters

dataAppName
string
required
The name of the Data App to list API tokens for. This must exactly match an existing Data App name.
isPagination
string
Whether to paginate results. Pass "true" to enable pagination with a limit of 10 per page.Note: Query parameters are passed as strings. Use "true" or "false".
pageNumber
string
Page number to retrieve (1-based). Only used when isPagination is "true". Must be a numeric string (e.g., "1", "2").

Response

data
array
Array of API token objects with their metadata.
data[].key
string
The API key value (UUID). Use this key for authentication when making API requests.
data[].name
string
The descriptive name/label assigned to the API token when it was created.
data[].description
string
The description of the API token, typically indicating the Data App it belongs to.
data[].createdAt
string
ISO 8601 formatted timestamp indicating when the API token was created.
error
object
Error object returned only when the request fails. Not included in successful responses.

Examples

HTTP Status Code Summary

Status CodeDescription
200OK - API tokens retrieved successfully
400Bad Request - Invalid request parameters
500Internal Server Error - Server error occurred

Possible Errors

Error CodeHTTP StatusDescription
INVALID_REQUEST_BODY400Missing or invalid dataAppName
DATA_APP_NOT_FOUND400Data App with given name not found
AUTHENTICATION_ERROR400Invalid or missing service token
INTERNAL_SERVER_ERROR500Server error

Quick Start Guide

1

Get your service token

Go to your Databrain dashboard, navigate to Settings > Service Tokens, and generate a new service token if you don’t have one.
2

Identify the Data App

Use the List Data Apps API to find the Data App name:
curl --request GET \
  --url 'https://api.usedatabrain.com/api/v2/data-app' \
  --header 'Authorization: Bearer service_token_xyz...'
3

List API tokens

Get all API tokens for the Data App:
curl --request GET \
  --url 'https://api.usedatabrain.com/api/v2/data-app/api-tokens?dataAppName=My%20Data%20App' \
  --header 'Authorization: Bearer service_token_xyz...'
4

Manage your tokens

Use the token information to manage your API keys:
const tokens = await listApiTokens({ dataAppName: 'My Data App' });

tokens.data.forEach(token => {
  console.log(`Token: ${token.name}`);
  console.log(`  Key: ${token.key}`);
  console.log(`  Created: ${token.createdAt}`);
  
  // Check if token is old and might need rotation
  const createdDate = new Date(token.createdAt);
  const daysSinceCreation = (Date.now() - createdDate) / (1000 * 60 * 60 * 24);
  
  if (daysSinceCreation > 90) {
    console.log(`  ⚠️ Consider rotating this token (${Math.floor(daysSinceCreation)} days old)`);
  }
});

Next Steps