Skip to content

AI Assistant Logs

The AI Assistant Logs API allows you to track how your team and individual users are utilizing AI features within the Topol Plugin. This is useful for monitoring usage, auditing consumption, and ensuring your API limits are used effectively.

Getting Started

To access the AI Logs API, you need an API key. You have two options:

1. Using Your Account API Token

  • In your Topol account, navigate to Settings -> API Tokens.
  • Assign a name to your new token along with the desired permissions you wish to grant. (Permissions can be changed later in the Manage API Tokens section just below.)
  • Click "Create token"
  • Copy the generated API key securely.

2. Using Your Plugin Initialization API Key

  • Go to Plugin Settings.
  • Search for the token used during Plugin initialization.
  • Click "Show API Key"
  • Copy the displayed API key securely.

All API requests must include the following headers:

json
{
  "accept": "application/json",
  "Authorization": "Bearer <your-api-key>"
}

Endpoints Overview

Get Total Tokens Used (by Team)

Retrieve the total number of OpenAI tokens used by your team during a selected timeframe.

  • URL: https://app.topol.io/api/open-ai-logs/team
  • Method: GET

Request:

Optional params:

keyvalue
date_from (string, nullable)Start date in ISO format
date_to (string, nullable)End date in ISO format

Response:

json
{
  "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 Token Usage per User

Use this to audit usage per team member.

  • URL: https://app.topol.io/api/open-ai-logs/team-users
  • Method: GET

Request:

Params:

keyvalue
search (string)Search query string (in user)
per_page (integer)Number of results per page (default: 25)
current_page (integer)Which page of results to return (default: 1)
sort_by (string)possible values: total_tokens
sort_by_directionpossible values: asc, desc
date_fromStart date in ISO format
date_toEnd date in ISO format

Response:

json
{
  "success": true,
  "data": {
    "data": [
      {
        "team_id": 1,
        "name": "Your Team",
        "user": "UserId1",
        "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 Token Usage for a Specific User

Use this to get total usage for a specific user.

  • URL: https://app.topol.io/api/open-ai-logs/user
  • Method: GET

Request:

Params:

keyvalue
user (string)user (required)
date_from (string, nullable)Start date in ISO format
date_to (string, nullable)End date in ISO format

Response:

json
{
  "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
  }
}