curl -X GET \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/user' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}'
Spotter Usage Data APIs
Beta
Spotter usage pools let administrators control how many Spotter questions a user, user group, or Org can ask. Each pool tracks a question allowance, a warning threshold, and the number of questions consumed.
ThoughtSpot provides public REST API v2 endpoints to create, retrieve, update, and delete usage pools programmatically for the following purposes:
-
To provision limits for new users or groups.
-
To monitor consumption and find pools that are close to their limit.
-
To raise or lower the limits.
-
To reset usage at the start of a billing period.
To set up usage limits end to end, including the Visual Embed SDK configuration for the usage counter and an upgrade workflow, see Manage Spotter usage limits.
|
Note
|
The Spotter usage data APIs are in Beta in ThoughtSpot Cloud 26.11.0.cl. Breaking changes may be introduced before the endpoints are made Generally Available. |
Usage pools and meteringπ
A usage pool is a Spotter question allowance assigned to an entity: a user, a user group, or an Org. Each pool tracks the following values:
-
usage
The number of questions consumed from the pool. -
warning_limit
The usage level at which users start seeing a warning. Optional. -
limit
The maximum number of questions that the pool allows. Optional. If it is not set, the pool is unlimited.
Metering scopeπ
A cluster meters Spotter usage at exactly one scope: per user, per user group, or per Org. The first pool created on the cluster sets the scope, and every pool created after that must use the same entity_type. To switch the scope, delete all existing pools using the delete usage data API endpoint.
How users draw from poolsπ
A user draws from every pool that meters them. Depending on the metering scope of the cluster, these are the userβs own pool (per user), the pools of the user groups that the user belongs to, including inherited groups (per user group), or the pool of the userβs Org (per Org). The totals in the get usage data for user response are sums across these pools. For example, a user in two groups with limits of 100 and 50 has a total_limit of 150.
A user who draws from no pool is not metered and can use Spotter without a limit.
Required privilegesπ
To use the Spotter usage data APIs, the user requires the following privileges:
-
Get usage data for user: Any user can retrieve their own usage. To retrieve another userβs usage, the user requires
ADMINISTRATION(Can administer ThoughtSpot) privilege.CAN_MANAGE_SPOTTERis not sufficient. -
Search, update, and delete usage data: These endpoints require
ADMINISTRATION(Can administer ThoughtSpot) privilege. Users with onlyCAN_MANAGE_SPOTTER, and Org administrators without cluster-levelADMINISTRATION, cannot call these endpoints.
Getting usage data for a userπ
The GET /api/rest/2.0/ai/usage-data/user API endpoint retrieves a userβs combined Spotter usage: every usage pool that the user draws from, with usage, warning limits, and limits summed across them. Use this endpoint to show users how many Spotter questions they have left, or to check whether a user is blocked by a usage limit.
Request parametersπ
| Parameter | Description |
|---|---|
| String. Optional. Query parameter. GUID of the user whose usage you want to retrieve. If you omit this parameter, the API returns the usage of the authenticated user. Passing another userβs GUID requires |
Example requestπ
curl -X GET -G \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/user' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}' \
--data-urlencode 'user_identifier={user-guid}'
Example responseπ
If the API request is successful, the API returns the following response:
{
"summary": {
"pools": [
{
"key": {
"entity_type": "USER_GROUP",
"entity_identifier": "{group-guid-1}"
},
"usage": 120,
"warning_limit": 80,
"limit": 100,
"updated_time_in_millis": 1793433600000,
"updated_by": "{admin-user-guid}"
},
{
"key": {
"entity_type": "USER_GROUP",
"entity_identifier": "{group-guid-2}"
},
"usage": 0,
"warning_limit": 40,
"limit": 50,
"updated_time_in_millis": 1793433600000,
"updated_by": "{admin-user-guid}"
}
],
"total_usage": 120,
"total_warning_limit": 120,
"total_limit": 150,
"total_remaining": 30,
"is_at_warning": true,
"is_at_limit": false,
"has_unlimited_pool": false
}
}
Response parametersπ
| Parameter | Description |
|---|---|
| The userβs combined usage across every pool that the user draws from. The object includes the following attributes:
|
Searching usage dataπ
The /api/rest/2.0/ai/usage-data/search API endpoint retrieves Spotter usage pools. A usage pool is the Spotter question allowance configured for a user, user group, or Org, together with the number of questions consumed from it. Use this endpoint to monitor usage across your users, for example, to find pools that are close to their limit.
To retrieve every pool on the cluster, send an empty request body. To retrieve specific pools, pass keys. The API omits keys that match no pool from the response.
To see the combined usage of a single user across every pool the user draws from, use the get usage data for user API endpoint.
Request parametersπ
| Parameter | Description |
|---|---|
| Array of objects. Optional. Specify the pools to retrieve. Omit this parameter to return every usage pool on the cluster. Keys that do not correspond to existing pools are silently ignored and do not appear in the response. For each key, specify the following attributes:
|
Example requestπ
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/search' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}' \
--data-raw '{}'
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/search' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}' \
--data-raw '{
"keys": [
{
"entity_type": "USER",
"entity_identifier": "{user-guid}"
}
]
}'
Example responseπ
If the API request is successful, the API returns the following response:
{
"usage_data": [
{
"key": {
"entity_type": "USER",
"entity_identifier": "{user-guid}"
},
"usage": 120,
"warning_limit": 400,
"limit": 500,
"updated_time_in_millis": 1793433600000,
"updated_by": "{admin-user-guid}"
}
]
}
Response parametersπ
| Parameter | Description |
|---|---|
| One entry for each pool. Each entry includes the following attributes:
|
Creating or updating usage dataπ
The /api/rest/2.0/ai/usage-data/update API endpoint creates or updates Spotter usage pools. Use this endpoint to provision limits for new users or groups, raise or lower an existing limit, or reset usage at the start of a billing period.
A pool that does not exist is created. Fields omitted from an update keep their current value. Every key must use the scope that the cluster meters at. To switch the scope, delete the existing pools first.
Request parametersπ
| Parameter | Description |
|---|---|
| Array of objects. The changes to apply, one entry for each pool. At least one entry is required. For each entry, specify the following attributes:
|
Example requestπ
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/update' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}' \
--data-raw '{
"updates": [
{
"key": {
"entity_type": "USER",
"entity_identifier": "{user-guid}"
},
"limit": 500,
"warning_limit": 400
}
]
}'
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/update' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}' \
--data-raw '{
"updates": [
{
"key": {
"entity_type": "USER",
"entity_identifier": "{user-guid}"
},
"usage": 0
}
]
}'
Example responseπ
If the API request is successful, the API returns usage_data with each updated pool as it stands after the change. The response has the same structure as the response of the search usage data API.
{
"usage_data": [
{
"key": {
"entity_type": "USER",
"entity_identifier": "{user-guid}"
},
"usage": 0,
"warning_limit": 400,
"limit": 500,
"updated_time_in_millis": 1793433600000,
"updated_by": "{admin-user-guid}"
}
]
}
Deleting usage dataπ
The /api/rest/2.0/ai/usage-data/delete API endpoint deletes Spotter usage pools. Use this endpoint to remove a limit from a user, user group, or Org, or to clear every pool before switching the metering scope.
Deleting a pool removes its limit rather than blocking its users. A user who no longer draws from any pool is not metered and can use Spotter without a limit.
|
Warning
|
This operation cannot be undone. To recreate a deleted pool, use the create or update usage data API endpoint. The usage of the new pool restarts from |
Request parametersπ
| Parameter | Description |
|---|---|
| Array of objects. The pools to delete. At least one entry is required. For each key, specify the following attributes:
|
Example requestπ
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/ai/usage-data/delete' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {AUTH_TOKEN}' \
--data-raw '{
"keys": [
{
"entity_type": "ORG",
"entity_identifier": "{org-id}"
}
]
}'
Example responseπ
If the API request is successful, the API returns deleted_keys, the keys of the pools that existed and were deleted. The API omits keys that matched no pool.
{
"deleted_keys": [
{
"entity_type": "ORG",
"entity_identifier": "{org-id}"
}
]
}