> For the complete documentation index, see [llms.txt](https://docs.tabnine.com/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tabnine.com/main/administering-tabnine/managing-your-team/tabnine-apis.md).

# Tabnine APIs

## Tabnine API Reference

Use these APIs to query usage, retrieve audit data, and automate administration.

This page renders the latest unified OpenAPI spec.

It includes current endpoints and supported legacy endpoints.

### Authentication

All APIs return JSON.

Authenticate with a Personal Access Token in the `Authorization: Bearer <token>` header.

Any user can create a Personal Access Token.

1. Go to **Settings** → **Access Tokens**.
2. Click **Generate Token**.
3. Enter a name and expiration.
4. Under **Token access**, select the permissions the token needs (see [Token scopes](#token-scopes)).
5. Copy the token before closing the dialog.

<figure><img src="/files/n0s3xGfugT37yNZA3RQ1" alt=""><figcaption><p>Generate a new token in the Access Tokens section</p></figcaption></figure>

If you lose a token, revoke it and generate a new one.

See [Personal Access Tokens](/main/administering-tabnine/managing-your-team/settings/access-tokens.md) for token management.

{% hint style="info" %}
Use the API for automation and [Analytics (Usage Reports)](/main/administering-tabnine/managing-your-team/reporting.md) for dashboard views.
{% endhint %}

### Token Scopes

When you create a Personal Access Token, you choose what it can access and at what level. The token carries only the permissions you grant it — give it the minimum it needs.

A token has two kinds of scope:

* **API access** — per-area permissions for the APIs on this page. Each area you enable is granted at one of:
  * **Read** — read-only (`GET`) access to that area.
  * **Read + write** — read plus the area's write operations (`POST`, `PUT`, `PATCH`, `DELETE`).
* **CLI / Agent access** — capabilities for the Tabnine CLI and agent workflows (YOLO mode, Context Engine MCP, Coaching Guidelines MCP). These do **not** affect the APIs on this page.

A request succeeds only if the token grants the relevant area at the required level. A `read-write` operation requires a `read-write` grant; a `read` operation is satisfied by either `read` or `read-write`.

{% hint style="info" %}
Scopes only ever *restrict* a token below its owner's permissions — they never grant extra access. A token can never do more than the user who created it.
{% endhint %}

{% hint style="info" %}
**YOLO mode** lets the Tabnine CLI auto-approve every tool call (file writes, shell commands, MCP calls) with no review. Grant it only to tokens used in trusted, automated workflows. It is honored by the CLI rather than enforced by the API, and the organization-wide **Restrict YOLO mode** setting always takes precedence — if an admin has turned YOLO off for the organization, a token granted YOLO still cannot use it.
{% endhint %}

#### API Areas

| Area                        | Levels              | Covers                                                                          |
| --------------------------- | ------------------- | ------------------------------------------------------------------------------- |
| **Organization**            | Read                | Organization metadata, the list of teams, and unassigned org users              |
| **Usage metrics**           | Read                | Organization, team, and user usage and agent-usage (v1 and v2)                  |
| **Audit logs**              | Read                | Organization audit log events                                                   |
| **License and permissions** | Read                | License metadata and the permissions enabled on the instance                    |
| **Users and teams**         | Read / Read + write | Read team and user details; write creates and renames teams                     |
| **User management**         | Read + write        | Update user roles, active status, and team assignment (including allowed teams) |
| **Team repositories**       | Read / Read + write | List repository connections; write adds, updates, and removes them              |
| **Invitations**             | Read / Read + write | List pending invitations; write invites users and revokes invitations           |

#### Error Responses

If a token lacks the scope a request requires, the API responds with `403`:

| HTTP  | `error`                      | Meaning                                                                                           |
| ----- | ---------------------------- | ------------------------------------------------------------------------------------------------- |
| `403` | `INSUFFICIENT_TOKEN_SCOPE`   | The token does not grant the area/level the endpoint requires. The body includes `requiredScope`. |
| `403` | `ACCESS_TOKEN_NOT_PERMITTED` | The endpoint is administrative and cannot be called with a Personal Access Token.                 |

Example `INSUFFICIENT_TOKEN_SCOPE` body:

```json
{
  "error": "INSUFFICIENT_TOKEN_SCOPE",
  "requiredScope": { "area": "teamRepositories", "level": "read-write" }
}
```

### Usage Metrics

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

It is available to Enterprise SaaS and private installations.

{% hint style="info" %}
Use `v2` usage endpoints for detailed analytics.

Use `v1` endpoints only for backward compatibility.
{% endhint %}

#### ORGANIZATIONS

Use these endpoints to retrieve organization-wide metadata and usage.

#### Get Current Organization

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get List of Teams

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization/teams" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get Account Usage Info

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization/account-utilizations" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get Organization Usage

Returns usage totals with chat, agent, and model breakdowns.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v2/organization/usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### <mark style="color:$warning;">Get Organization Usage (LEGACY)</mark>

Use this endpoint if you still rely on the v1 response shape.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization/usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get Users NOT Assigned to Teams

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization/users" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### LICENSES AND PERMISSIONS

Use these endpoints to validate entitlements and enabled permissions.

#### Get License Info

Returns license metadata for the current Tabnine instance.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/license" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get Account Permissions Info

Returns the permissions enabled on this Tabnine instance.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/instance/permissions" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### TEAMS AND USERS

Use these endpoints to retrieve team-level and user-level usage data.

#### Get Team Users

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/team/{teamId}/users" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get team usage info

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/team/account-utilizations" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get Team-Wide Usage

Returns usage totals with chat, agent, and model breakdowns.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v2/team/usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### <mark style="color:$warning;">Get team-wide usage (LEGACY)</mark>

Use this endpoint if you still rely on the v1 response shape.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/team/usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get User Usage

Returns per-user usage with IDE and language breakdowns.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v2/user/usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### <mark style="color:$warning;">Get user usage (LEGACY)</mark>

Use this endpoint if you still rely on the v1 response shape.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/user/usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### AUDIT LOGS

The Audit Logs API returns audit events for user management, team management, and authentication activity.

The audit log includes:

* Performing user
* Affected user
* Time of change
* Value change for each event

You can use the same mapping from the Usage Metrics API between `user_id` and email, and between `team_id` and team name.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization/audit-logs" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### USER ROLE MANAGEMENT

The User Management API automates user role management and team membership.

#### Permissions

| Role      | Assign Team | Update Role                    | Activate/Deactivate | Invite                         |
| --------- | ----------- | ------------------------------ | ------------------- | ------------------------------ |
| Admin     | ✓           | ✓ (all roles)                  | ✓                   | ✓ (all roles)                  |
| Manager   | ✓           | ✓ (Member, Team Lead, Manager) | ✓                   | ✓ (Member, Team Lead, Manager) |
| Team Lead | ✗           | ✗                              | ✗                   | ✗                              |
| Member    | ✗           | ✗                              | ✗                   | ✗                              |

To use this API, you will need user and team data from the organization and team APIs above.

### Team rRepositories

The Repository Management API automates repository connection management for teams.

All endpoints follow this structure:

`/api/team/v1/{teamId}/connections/repositories`

Only Admins have permission for this endpoint.

#### List Repositories

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/team/v1/{teamId}/connections/repositories" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Add Repository

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/team/v1/{teamId}/connections/repositories" method="post" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Update Repository

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/team/v1/{teamId}/connections/repositories/{repositoryLink}" method="put" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Delete Repository

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/team/v1/{teamId}/connections/repositories/{repositoryLink}" method="delete" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Field descriptions

**Common fields**

<table><thead><tr><th width="294.4755859375">Field</th><th width="121.595703125">Type</th><th width="122.1923828125">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>repo_type</code></td><td>string</td><td>Yes</td><td>Repository type: "git" or "perforce"</td></tr><tr><td><code>repository_link</code></td><td>string</td><td>Yes</td><td>Git: repository URL in SSH or HTTPS format. Perforce: depot path such as //depot/main</td></tr><tr><td><code>latest_status</code></td><td>string</td><td>Read-only</td><td>Current indexing status</td></tr><tr><td><code>last_indexed_successfully</code></td><td>string or null</td><td>Read-only</td><td>ISO 8601 timestamp of last successful indexing, or null if never indexed</td></tr></tbody></table>

**Git-specific fields**

<table><thead><tr><th width="294.3095703125">Field</th><th width="122.3916015625">Type</th><th width="121.6357421875">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>authentication_method</code></td><td>string</td><td>Yes</td><td>"ssh" or "https"</td></tr><tr><td><code>authentication_credentials_name</code></td><td>string</td><td>Conditional</td><td>Required when <code>authentication_method</code> is "https"</td></tr><tr><td><code>view_source_link_pattern</code></td><td>string</td><td>No</td><td>URL pattern for viewing source code. Supports <code>{sha}</code>, <code>{path}</code>, and <code>{line}</code></td></tr></tbody></table>

**Perforce-specific fields**

<table><thead><tr><th width="293.7822265625">Field</th><th width="122.4013671875">Type</th><th width="121.73828125">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>authentication_credentials_name</code></td><td>string</td><td>Yes</td><td>Must match an existing Perforce credential name for the team</td></tr><tr><td><code>view_source_link_pattern</code></td><td>string</td><td>No</td><td>Currently not used for Perforce</td></tr></tbody></table>

**Status values**

| Status     | Description                               |
| ---------- | ----------------------------------------- |
| `pending`  | Repository is queued for initial indexing |
| `cloning`  | Repository is being cloned                |
| `indexing` | Repository is currently being indexed     |
| `success`  | Repository was successfully indexed       |
| `failed`   | Last indexing attempt failed              |

{% hint style="info" %}
Perforce depots typically skip `cloning` and go directly to indexing.
{% endhint %}

### TEAM MANAGEMENT

Use these APIs to manage teams, users, and invitations in Tabnine Enterprise.

#### Create A Team

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/team/v1" method="post" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### USER MANAGEMENT

#### Get user info

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/user/v1/{userId}" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Update user properties

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/user/v1/{userId}" method="patch" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Look up user by email

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/user/v1/by-email/{email}" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### List user's allowed teams

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/user/v1/{userId}/allowed-teams" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Add teams to a user's allowed list

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/user/v1/{userId}/allowed-teams" method="patch" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Remove teams from a user's allowed list

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/user/v1/{userId}/allowed-teams" method="delete" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### Invitation management

#### Invite user by email

Use this endpoint to invite a user to a team by email.

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/invitation/v1" method="post" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### List pending invites

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/invitation/v1" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Revoke invites by ID

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/invitation/v1" method="delete" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

### Agent usage

Use these endpoints to retrieve aggregated agent usage analytics by organization, team, or user.

#### Get organization agent usage

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/organization/agent-usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get team agent usage

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/team/agent-usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}

#### Get user agent usage

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/v1/user/agent-usage" method="get" %}
<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tabnine.com/main/administering-tabnine/managing-your-team/tabnine-apis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
