curl -X POST \
'https://api.chartbrew.com/project/123/share/token' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"share_policy": {
"params": [
{
"key": "userId",
"value": "12345"
},
{
"key": "region",
"value": "us-east"
}
],
"allow_params": true
},
"exp": "2024-12-31T23:59:59Z"
}'
const response = await fetch('https://api.chartbrew.com/project/123/share/token', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
share_policy: {
params: [
{ key: 'userId', value: '12345' },
{ key: 'region', value: 'us-east' }
],
allow_params: true
},
exp: '2024-12-31T23:59:59Z'
})
});
const data = await response.json();
console.log(data.url); // Use this URL for sharing
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOnsidHlwZSI6IlByb2plY3QiLCJpZCI6MTIzfSwiaWF0IjoxNjQyNDQwMDAwLCJleHAiOjE3MDM5NzYwMDB9.example_signature",
"url": "https://app.chartbrew.com/report/my-dashboard?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOnsidHlwZSI6IlByb2plY3QiLCJpZCI6MTIzfSwiaWF0IjoxNjQyNDQwMDAwLCJleHAiOjE3MDM5NzYwMDB9.example_signature"
}
Dashboards
Generate Dashboard Share Token
Generate a signed JWT token for secure dashboard sharing with optional parameters and expiration
POST
/
project
/
{id}
/
share
/
token
curl -X POST \
'https://api.chartbrew.com/project/123/share/token' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"share_policy": {
"params": [
{
"key": "userId",
"value": "12345"
},
{
"key": "region",
"value": "us-east"
}
],
"allow_params": true
},
"exp": "2024-12-31T23:59:59Z"
}'
const response = await fetch('https://api.chartbrew.com/project/123/share/token', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
share_policy: {
params: [
{ key: 'userId', value: '12345' },
{ key: 'region', value: 'us-east' }
],
allow_params: true
},
exp: '2024-12-31T23:59:59Z'
})
});
const data = await response.json();
console.log(data.url); // Use this URL for sharing
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOnsidHlwZSI6IlByb2plY3QiLCJpZCI6MTIzfSwiaWF0IjoxNjQyNDQwMDAwLCJleHAiOjE3MDM5NzYwMDB9.example_signature",
"url": "https://app.chartbrew.com/report/my-dashboard?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOnsidHlwZSI6IlByb2plY3QiLCJpZCI6MTIzfSwiaWF0IjoxNjQyNDQwMDAwLCJleHAiOjE3MDM5NzYwMDB9.example_signature"
}
This endpoint generates a JWT token for accessing a dashboard with a SharePolicy. The token can include custom parameters, expiration dates, and URL parameter permissions.
Parameters
string
required
The ID of the dashboard/project
Body Parameters
object
string
Token expiration date and time in ISO 8601 format (e.g., “2024-12-31T23:59:59Z”)
Response
string
The generated JWT access token for dashboard access
string
The complete shareable URL with the access token included
Example
curl -X POST \
'https://api.chartbrew.com/project/123/share/token' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"share_policy": {
"params": [
{
"key": "userId",
"value": "12345"
},
{
"key": "region",
"value": "us-east"
}
],
"allow_params": true
},
"exp": "2024-12-31T23:59:59Z"
}'
const response = await fetch('https://api.chartbrew.com/project/123/share/token', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
share_policy: {
params: [
{ key: 'userId', value: '12345' },
{ key: 'region', value: 'us-east' }
],
allow_params: true
},
exp: '2024-12-31T23:59:59Z'
})
});
const data = await response.json();
console.log(data.url); // Use this URL for sharing
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOnsidHlwZSI6IlByb2plY3QiLCJpZCI6MTIzfSwiaWF0IjoxNjQyNDQwMDAwLCJleHAiOjE3MDM5NzYwMDB9.example_signature",
"url": "https://app.chartbrew.com/report/my-dashboard?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOnsidHlwZSI6IlByb2plY3QiLCJpZCI6MTIzfSwiaWF0IjoxNjQyNDQwMDAwLCJleHAiOjE3MDM5NzYwMDB9.example_signature"
}
Usage Notes
- Prerequisites: A SharePolicy must exist for the project before generating tokens. Use the “Create Dashboard Share Policy” endpoint first.
- Token Expiration: If no expiration is specified, the token will have a very long expiration (99999 days).
- Parameters: Parameters defined in the share policy will be passed as variables to the dashboard’s charts.
- URL Parameters: If
allow_paramsis true, additional parameters can be passed via URL query parameters and will override policy parameters. - Security: Always use HTTPS when sharing URLs containing access tokens.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the project
Body
application/json