# JetBrains Account API

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/jetbrains-console/llms.txt).

You can use the [JetBrains Account API](https://account.jetbrains.com/api-doc) to automate the management of licenses and user accounts. It's a REST API with endpoints to:

* View, [assign](assigning-licenses-to-users.html), and [revoke](revoke-licenses-from-users.html) licenses

* Transfer licenses between [teams](about-teams.html)

* Create and delete user accounts > **Note:** > Available only for organizations with a [verified domain](verified-domains.html).

Users with the [Manage organization](roles.html#permissions_manage_org) permission can also enable or disable the JetBrains Account API for the entire organization. While the API is enabled, they have full read and write access to it.

Procedure: Enable the JetBrains Account API

1. In the sidebar, select Organization | Administration.

If you don't see this page, or the controls on this page are inactive, make sure your role has the necessary [permissions](roles.html#permissions).

2. In the JetBrains Account API section of the Administration page, click Enable API.

This enables API access for all users with the [Manage organization](roles.html#permissions_manage_org) permission.

Procedure: Disable the API

1. In the sidebar, select Organization | Administration.

If you don't see this page, or the controls on this page are inactive, make sure your role has the necessary [permissions](roles.html#permissions).

2. In the JetBrains Account API section of the Administration page, click Disable API.

Disabling the JetBrains Account API blocks all API access to the organization, but any [access tokens](#Manage-your-personal-API-token) generated by users stay valid. If you re-enable the API later, they'll still work. For more information, see [Token lifetime](#Token-lifetime).

## Manage your personal API token

To use the JetBrains Account API, you’ll need a personal access token. You can [generate](#Generate-a-personal-token), [regenerate](#Regenerate-a-personal-token), or [invalidate](#Remove-a-personal-access-token) it anytime.

Your token is tied to your account, so any API requests made with it will be linked to you. Other users with JetBrains Account API access can generate their own tokens too.

Procedure: Generate a personal token

1. In the sidebar, select Organization | Administration.

If you don't see this page, or the controls on this page are inactive, make sure your role has the necessary [permissions](roles.html#permissions).

2. In the JetBrains Account API section of the Administration page, click Generate access token.

3. Copy your token from the dialog that pops up. For security reasons, we only show the token once – so make sure to save it somewhere safe before closing the dialog.

> **Warning: Don't share your access token with anyone**
> If it's compromised, [invalidate it](#Remove-a-personal-access-token) or [generate a new one](#Regenerate-a-personal-token) immediately.

Procedure: Generate a new personal token

Generate a new token if you lost access to the current one or accidentally disclosed it to others.

1. In the sidebar, select Organization | Administration.

If you don't see this page, or the controls on this page are inactive, make sure your role has the necessary [permissions](roles.html#permissions).

2. In the JetBrains Account API section of the Administration page, click Generate new token.

3. When a confirmation dialog pops up, click Generate new token again.

4. Copy your token from the dialog that pops up. For security reasons, we only show the token once – so make sure to save it somewhere safe before closing the dialog.

> **Warning:**
> Generating a new token immediately invalidates the previous one. Make sure to update your token in any applications using the JetBrains Account API.

Procedure: Invalidate your personal access token

Invalidate your token if you no longer need access to the JetBrains Account API.

1. In the sidebar, select Organization | Administration.

If you don't see this page, or the controls on this page are inactive, make sure your role has the necessary [permissions](roles.html#permissions).

2. In the JetBrains Account API section of the Administration page, click Invalidate token.

3. When a confirmation dialog pops up, click Invalidate token again.

## Token lifetime

The JetBrains Account API tokens have an indefinite lifetime.

Each user gets one token, even if they have multiple roles. Unless they [regenerate](#Regenerate-a-personal-token) or [remove](#Remove-a-personal-access-token) it, the token stays active as long as they have API access. If they lose all roles, the token gets revoked automatically.

If you [disable the API](#Disable-the-API) and re-enable it later, any previously generated tokens will still be valid.

> **Warning:**
> If you compromise your personal access token, [regenerate](#Regenerate-a-personal-token) or [invalidate](#Remove-a-personal-access-token) it immediately.

## Use API methods

See the [JetBrains Account API reference](https://account.jetbrains.com/api-doc) for the full list of available methods. To use the API methods, you'll need two parameters:

`X-Customer-Code`
: Your JetBrains customer ID. You can find it by [copying support information](getting-help.html#copy-support-information).

`X-Api-Key`
: Your [personal API token](#Manage-your-personal-API-token).

cURL:

```BASH
curl -X 'DELETE' \
  'https://account.jetbrains.com/api/v1/account' \
  -H 'accept: application/json' \
  -H 'X-Customer-Code: 12345678' \
  -H 'X-Api-Key: ac723fc5-ea7a-42cf-ab30-bb079be95a66' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "john.doe@example.com"
  }'
```

HTTP:

```HTTP_REQUEST
DELETE https://account.jetbrains.com/api/v1/account
accept: application/json
X-Customer-Code: 12345678
X-Api-Key: ac723fc5-ea7a-42cf-ab30-bb079be95a66
Content-Type: application/json

{
  "email": "john.doe@example.com"
}
```

