# 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.

### 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. 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 %}

### Usage metrics

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

It is available to Enterprise SaaS and private installations.

#### 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

{% 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 info by `teamId`

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

#### Get team-wide usage

{% 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 info by `user_id`

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

#### Get user usage

{% 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.

#### Update user

{% 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 %}

#### 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 repositories

The Repository Management API automates repository connection management for teams.

All endpoints follow this structure:

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

As of 5.27.0, 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

Introduced in 6.0.0.

{% 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 %}

#### Get team by ID

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

#### Rename team

{% openapi src="<https://raw.githubusercontent.com/codota/t9-api-yamls/refs/heads/main/docs/unified-tabnine-api.yaml>" path="/api/team/v1/{id}" method="put" %}
<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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
