Usage API

The Usage API provides programmatic access to usage metrics across an organization

The Usage API (released with 5.18.0) provides programmatic access to usage metrics across an organization. It complements existing enterprise reporting options—UI-based usage reports and CSV exports—by enabling integration into internal dashboards and tools via API.

The Usage API is available to all Enterprise customers on both SaaS (console.tabnine.com) and Private installations.

The APIs return JSON with parameter details and example responses.

Enabling Usage API

Only users with Admin access to Tabnine can access the Usage API. This is done by navigating to Settings, then Access Tokens.

Navigate to the top righthand corner and click Generate token.

A new Generate New Token window.

Type in the Token Description, then press the blue Generate Token button.

You can only access this token at this point. Once you hit Close, you will no longer be able to access this particular token.

Generate a new token in the Access Tokens section

If you need to access a new token, you can generate a new token. If the token you intended to use was lost (for example, copied and next pasted), you should revoke that token by hitting 🗑️ Revoke.

API Categories

The Usage API can retrieve the following information:

  • Organization & Teams

    • Get organization and team IDs

    • List organization teams

    • List users from each team

  • Usage Metrics

    • Active users

    • Account utilization

    • Productivity factor

    • Automation factor

    • Usage volumes for:

      • Code Completions

      • Chat Interactions

List of Implemented APIs

APIs return JSON with parameter details and example responses:

Organizational Level Info APIs and Usage APIs

  1. Get current organization ID and high-level settings

  2. Get list of teams for given organization

  3. Get license info

  4. Get account utilization info

  5. Get account permissions info

  6. Get organization-level usage

Team Level Info APIs

  1. Get users of a given team

  2. Get users that aren't assigned to a team

  3. Get current utilization info

  4. Get team name

  5. Team Level Usage API

Organization-Level APIs

Get current organization ID and high-level settings

Endpoint:

GET /api/v1/organization

Parameters:

Parameter
Type
Required?
Description

-

-

-

-

Response Codes:

  • 200 OK – Successful response with usage data

  • 400 Bad Request – Invalid or missing parameters

  • 401 Unauthorized – Invalid token

  • 404 Not Found – Organization or team not found

  • 500 Internal Server Error – Unexpected server error

Response (JSON):

{
    "publicKey": "-----BEGIN PUBLIC KEY-----\nMIICIXXXXXXAAQ==\n-----END PUBLIC KEY-----\n",
    "samlEnabled": false,
    "smtpConfigured": true,
    "usernamePasswordEnabled": true,
    "name": "Yagel",
    "domains": [
        "tabnine.com"
    ],
    "planType": "Enterprise",
    "id": "9a3895ca-1c27-4231-8978-85ae00267d02"
}

Team-Level APIs

Get Users for a Given Team

This returns all registered and deactivated users from a team.

Endpoint:

GET api/v1/team/{:teamId}/users?offset=0&limit=0

Parameters:

Parameter

Type

Required?

Description

limit

string (non-negative integer)

Specifies the maximum number of items to return. (Example: limit=10 returns only 10 items)

offset

string

Skips a number of items before starting to return results.(Example: offset=20 skips the first 20 items and starts from item 21)

Response Codes:

  • 200 OK – Successful response with usage data

  • 400 Bad Request – Invalid or missing parameters

  • 401 Unauthorized – Invalid token

  • 404 Not Found – Organization or team not found

  • 500 Internal Server Error – Unexpected server error

Response (JSON):

{
    "data": [
        {
            "id": "xxxxxxxxxxxxxxxxxx",
            "username": "Taylor",
            "email": "[email protected]",
            "role": "Admin",
            "verified": true
        },
        {
            "id": "yyyyyyyyyyyyyyy",
            "username": "Matt",
            "email": "[email protected]",
            "role": "Manager",
            "verified": true
        },
        {
            "id": "ZZZZZZZZZZZZZZZZZZZZ",
            "username": "Ben",
            "email": "[email protected]",
            "role": "Member",
            "verified": true
        }
    ],
    "meta": {
        "count": 3,
        "total": 3,
        "next": {
            "limit": 0,
            "offset": 0
        }
    }
}

Last updated

Was this helpful?