---
title: How to Assume a Role with an Instance Identity Token
url: https://docs.vultr.com/platform/iam/product-integrations/instance-and-bare-metal-auth/assume-role
description: Assume a Vultr IAM role from an instance or Bare Metal server using its identity token, with no stored credentials.
publish_date: 2026-09-21T20:22:30.893571Z
last_updated: 2026-10-23T20:36:24.191039Z
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

A Vultr Cloud Compute instance or Bare Metal server can assume an IAM role using its own identity token in place of a user's credentials. The identity token itself authenticates the request, so the assume-role call needs no `user_id` or `oidc_issuer_id`.

> [!NOTE]
> Before assuming a role this way, you must have a role trust configured for the `instance` or `baremetal` issuer source. See [How to Configure a Role Trust for Instance or Bare Metal](https://docs.vultr.com/platform/iam/product-integrations/instance-and-bare-metal-auth/configure-role-trust).

Follow this guide to assume a role from within an instance or bare metal server using the Vultr API.

1. [Obtain an identity token](https://docs.vultr.com/platform/iam/product-integrations/instance-and-bare-metal-auth/obtain-identity-token) from the server's metadata service.

1. Send a `POST` request to the [**Create Assumed Role Session** endpoint](https://www.vultr.com/api/#tag/iam/operation/iam-assume-role), passing the identity token as the `Authorization` header instead of a Vultr API key. Replace `IDENTITY-TOKEN` with the token from the previous step, `ROLE-ID` with the assumable role id, and `SESSION-NAME` with a name for the session.

    ```console
    $ curl "https://api.vultr.com/v2/assumed-roles/assume" \
        -X POST \
        -H "Authorization: Bearer IDENTITY-TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
            "role_id": "ROLE-ID",
            "session_name": "SESSION-NAME",
            "auth_method": "oidc",
            "duration": 3600
        }'
    ```

    A successful request returns an HTTP `201 Created` response with a `session_token` prefixed `ars-`. Both `user_id` and `oidc_issuer_id` return empty in the response, since the session is tied to the entity's trust rather than a platform user.

    > [!NOTE]
    > Pass `session_token` as the `Authorization: Bearer` token in subsequent requests. The session expires after the specified `duration`.
