AI assistant Logs
For monitoring the usage of the AI assistant, you can utilize the following API.
How to use it?
First, an API key is needed. To get started, you have two options: either an API key from your account settings or an API key from your Plugin API Token.
When using an API key from your account settings, you can set various permissions. Go to Settings, then navigate to API Tokens. From there, select "Create API Token" and specify the permissions you wish to grant to this token.
If you prefer using the same API key that was used for the initialization of your Plugin, simply copy it from the Plugin Settings under "Show API key."
When working with the API, make sure to set the following headers:
Headers:
{
"accept": "application/json",
"Authorization": "Bearer <api-key>"
}
Get number of tokens
To get total a number of used tokens for your account, you need to send a GET request to our API endpoint:
- URL:
https://app.topol.io/api/open-ai-logs/team
- Method:
GET
Request:
You can use following parameters (optional):
key | value |
---|---|
date_from (string) | date from (nullable) |
date_to (string) | date to (nullable) |
Response:
Successful response will look like this:
{
"success": true,
"data": {
"name": "Your Team",
"total_tokens": 100,
"date_from": "2023-01-01T00:00:00.000000Z", // if is set
"date_to": "2023-01-01T00:00:00.000000Z" // if is set
}
}
Get number of tokens for all users
To list users and their number of tokens, send a GET request to our API endpoint:
- URL:
https://app.topol.io/api/open-ai-logs/team-users
- Method:
GET
Request:
Params:
key | value |
---|---|
search | search query string (in user ) |
per_page | expected data per page (default is 25) |
current_page | current page (default is 1) |
sort_by | possible values: total_tokens |
sort_by_direction | possible values: asc , desc |
date_from | date from |
date_to | date to |
Response:
Successful response will look like this:
{
"success": true,
"data": {
"data": [
{
"team_id": 1,
"name": "Your Team",
"user": "UserId",
"total_tokens": 100
},
{
"team_id": 1,
"name": "Your Team",
"user": "UserId2",
"total_tokens": 200
}
],
"total_records": 1,
"current_page": 1,
"per_page": 25,
"next_page": null,
"prev_page": null,
"last_page": 1,
"date_from": "2023-01-01T00:00:00.000000Z", // if set
"date_to": "2023-11-01T00:00:00.000000Z" // if set
}
}
Get number of tokens for user
To get total a number for given user, you need to send a GET request to our API endpoint:
- URL:
https://app.topol.io/api/open-ai-logs/user
- Method:
GET
Request:
You can use following parameters (optional):
key | value |
---|---|
user (string) | user (required) |
date_from (string) | date from (nullable) |
date_to (string) | date to (nullable) |
Response:
Successful response will look like this:
{
"success": true,
"data": {
"name": "Your Team",
"user": "UserId",
"total_tokens": 100,
"date_from": "2023-01-01T00:00:00.000000Z", // if is set
"date_to": "2023-01-01T00:00:00.000000Z" // if is set
}
}