Access Tokens

Use access tokens for enhanced security when integrating with CVAT API

Overview

When interacting with the API, there are several authentication options available in CVAT:

  • Basic authentication, with a username and a password
  • Legacy token authentication, with an API key (deprecated)
  • Session authentication, with a session ID and a CSRF token
  • Personal Access Token (PAT) authentication, with an access token value

Personal Access Token (PAT) is an authentication option dedicated to CLI, SDK and Server API clients. To authenticate using this method, you need an access token that can be created and configured in the user settings section in the UI. It is the recommended authentication option for CVAT API interaction and integrations.

Compared to the other authentication options, PATs provide a more convenient, controlled, and secure way to authenticate requests from the CLI, scripts, and 3rd-party applications. They improve the security of your account by allowing you to use separate credentials for each application and by removing the need to use the password. Tokens can be created and revoked at any time by a user request. The security is further improved by configuring the allowed operations and setting expiration dates for each token.

How to manage Personal Access Tokens

It’s possible to create, edit, and revoke tokens. The tokens can be created, edited, and revoked at any time by a user request. You can configure the name, expiration date, and permissions for each token.

It’s recommended to always specify the expiration date for tokens. Please note that unused tokens are automatically considered “stale” and removed after some time period of inactivity (1 year by default).

Permissions

It’s possible to configure allowed operations for a token. Currently, there is an option to make a token read-only or read/write capable. A read-only token will only be allowed to make safe requests that do not modify the server state.

How to create a Personal Access Token

  1. Open the user settings page

User profile menu item

  1. Navigate to the “Security” section

User profile - security tab

  1. Create a new token using the “+” button

Access Token create button

  1. Configure the name, expiration date, and permissions for the new token. Once ready, click “Save”.

Access Token edit dialog

  1. You will be shown the new token. Make sure to securely save this value, it will not be available in CVAT after the dialog window is closed.

Access Token private key dialog

  1. Once the value is saved, close the dialog window.

The new token is ready for use.

How to edit a Personal Access Token

  1. Open the user settings page

User profile menu item

  1. Navigate to the “Security” section

User profile - security tab

  1. Click the “Edit” button for the token.

Access Token edit button

  1. The token editing page will be displayed. Here you can configure token name, permissions, and expiration date.

Access Token edit dialog

  1. After the required changes are made, click the “Update” button to confirm the updates.

How to revoke Personal Access Tokens

Revocation allows you to prevent further uses of a token. Once a token is revoked, it cannot be restored.

  1. Open the user settings page

User profile menu item

  1. Navigate to the “Security” section

User profile - security tab

  1. Click the “Revoke” button for the token.

Access Token revoke button

  1. Confirm revocation in the dialog

Access Token revoke dialog

The token will not be available for use anymore.