Skip to content

How do I use a Vercel API Access Token?

Vercel Access Tokens are required to authenticate and use the Vercel API.

Tokens can be created and managed inside your account settings, and can be scoped to only allow access for specific Teams. This article covers how to create a token and use it with your account.

Creating an Access Token

Make sure that you are under Personal Account and not Teams in the dropdown at the top left in the Navigation bar. Navigate to the Account Tokens page, also found under the Settings area of your Personal Account.

  1. Click Create to open the create token modal.
  2. Enter a descriptive name and click Create Token.
  3. Choose the scope of access for the token from the dropdown.
  4. Make a note of the token created as it will not be shown again.

Using the Access Token in Personal Account API Calls

Once your token has been created, you can use it with the Vercel API. For example:

  1. Identify the Vercel API endpoint you would like to call. For example, to list the deployments in your Personal Account, the endpoint is /v6/deployments. The access token token you created would need access to your Personal Account.
  1. Make a request to https://api.vercel.com/v6/deployments using your access token as the Authorization header.
$ curl "https://api.vercel.com/v6/deployments" -H "Authorization: Bearer TOKEN"

Request to list the deployments of your Personal Account using curl.

const result = await fetch( 'https://api.vercel.com/v6/deployments', { method: 'GET', headers: { Authorization: `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`, } } );

Request to list the deployments in your Personal Account.

Using the Access Token in Team API Calls

If you are trying to retrieve deployments for a team, you will need to append ?teamId=<your-team-id> to the URL. Your Team ID can be found inside your team's general project settings on the dashboard.

You will also need to ensure the access token created has the correct scope for the Team.

const teamId = 'replace-me' const result = await fetch( `https://api.vercel.com/v6/deployments?teamId=${teamId}`, { method: 'GET', headers: { Authorization: `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`, } } );

Request to list the deployments in your Team.

Couldn't find the guide you need?