---
title: How to Create Access Tokens for a MicroVM
description: Create, list, and revoke access tokens that can reach only one MicroVM&#39;s URLs.
product: Microvms
url: https://docs.digitalocean.com/products/microvms/how-to/manage-access-tokens/
last_updated: "2026-11-16"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Create Access Tokens for a MicroVM

DigitalOcean MicroVMs are lightweight virtual machines that run a container image in an isolated kernel, pause automatically when idle, and resume on the next request with memory, files, and processes intact.

A MicroVM access token can send requests to one DigitalOcean MicroVM’s URLs and nothing else. It cannot call the DigitalOcean API, reach your team’s other MicroVMs, or run commands. Use an access token to give a person or another service access to one MicroVM without sharing a team API token.

Access tokens add to your team’s API tokens. They do not restrict them. A team token with the `microvm:access` scope still reaches every MicroVM on your team, including MicroVMs that have access tokens.

Each token works on every URL of its MicroVM, including URLs you add later. A MicroVM can have up to 10 active access tokens. Tokens can expire after a duration you choose, or never expire. Revoking a token takes effect immediately, and deleting a MicroVM revokes all of its tokens.

The token value is shown only once, when you create it. Store it somewhere safe. If you lose it, revoke the token and create a new one.

## Prerequisites

- A MicroVM that is not being deleted, on an account that is not in a free trial.
- For `doctl` or the API, a [personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) with the `microvm:update` scope to create and revoke tokens, and the `microvm:read` scope to list them.
- For `doctl`, [`doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md) v2.3.0 or later.

## Manage Access Tokens Using the Control Panel

Go to the [**MicroVMs** page](https://cloud.digitalocean.com/microvms?utm_source=docs-agent&utm_medium=md), click the MicroVM’s name, then click the **Settings** tab. In the **Access Tokens** section, click **Create Access Token**.

Enter a **Name** for the token, then choose when it expires in **Expires in**: **30 days**, **60 days**, **90 days**, **1 year**, or **No expire**. The default is 90 days. Click **Create Access Token**.

The new token’s value appears under **Copy your access token now**. Copy it and store it somewhere safe. The Control Panel does not show it again.

The **Access Tokens** section lists each active token’s name, creation date, and expiration date. To revoke a token, click **Revoke** in its row, type the token’s name to confirm, then click **Revoke**.

## Manage Access Tokens Using doctl

Create a token with a name that is unique among the MicroVM’s active tokens. `--expires-in-seconds` is optional. Without it, the token does not expire:

```shell
doctl compute microvm access-token create <your-microvm-id> \
  --name example-reviewer \
  --expires-in-seconds 86400
```

The output includes the token value in the **Token** column. This is the only time `doctl` shows it.

List a MicroVM’s active tokens, oldest first. The list never includes token values:

```shell
doctl compute microvm access-token list <your-microvm-id>
```

Revoke a token. The command prompts for confirmation, and `--force` skips the prompt:

```shell
doctl compute microvm access-token revoke <your-microvm-id> <your-token-id>
```

## Manage Access Tokens Using the API

Send a `POST` request to `/v2/microvms/<your-microvm-id>/access_tokens` with a `name` of 1 to 64 characters and an optional `expires_in_seconds`:

```shell
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"name": "example-reviewer", "expires_in_seconds": 86400}' \
  "https://api.digitalocean.com/v2/microvms/<your-microvm-id>/access_tokens"
```

A successful request returns HTTP 201 with an `access_token` object that contains the token’s `id`, `name`, `created_at`, `expires_at`, and `token`. `token` is the value to use, and the API never returns it again.

The request returns HTTP 409 if the MicroVM already has an active token with the same name, and HTTP 400 if the MicroVM already has 10 active tokens or is being deleted.

To list the MicroVM’s active tokens, oldest first, send a `GET` request to `/v2/microvms/<your-microvm-id>/access_tokens`. The list includes each token’s `id`, `name`, `created_at`, and `expires_at`, but not its value.

To revoke a token, send a `DELETE` request to `/v2/microvms/<your-microvm-id>/access_tokens/<your-token-id>`. A successful request returns HTTP 204. A revoked token cannot be restored.

## Use an Access Token

Send the access token in the `Authorization` header of a request to any of the MicroVM’s URLs, the same way you would send a team token:

```shell
curl -H "Authorization: Bearer <your-microvm-access-token>" \
  "https://<your-microvm-id>.mkc1.microvm.ondigitalocean.com"
```

The platform accepts tokens only in the `Authorization` header. A browser that opens a MicroVM’s URL directly does not send the header, so the request returns HTTP 401. To show a MicroVM to users in a browser, such as for a preview environment, have your backend forward their requests to the MicroVM and add the access token to each one. Keep the token on your backend, not in code that runs in the browser.

For more about sending requests, see [How to Send Requests to a MicroVM](https://docs.digitalocean.com/products/microvms/how-to/send-requests/index.html.md).