---
title: "POST /v2/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:generateAccessToken"
method: POST
path: "/v2/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:generateAccessToken"
tags: ["projects"]
---

# POST /v2/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:generateAccessToken

`POST /v2/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:generateAccessToken`

## Request

- Base URL: `https://notebooks.googleapis.com`
- URL: `https://notebooks.googleapis.com/v2/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:generateAccessToken`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/notebooks`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/notebooks`

Called by VM to return an EUC for the instance owner. Do not use this method directly. Design doc: go/wbi-euc:dd

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `instancesId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- GenerateAccessTokenRequest: Request message for generating an EUC for the instance owner.
  - `vmToken` string: Required. The VM identity token (a JWT) for authenticating the VM. https://cloud.google.com/compute/docs/instances/verifying-instance-identity

## Response `200`

Successful response

- GenerateAccessTokenResponse: Response message for generating an EUC for the instance owner.
  - `access_token` string: Short-lived access token string which may be used to access Google APIs.
  - `expires_in` integer: The time in seconds when the access token expires. Typically that's 3600.
  - `scope` string: Space-separated list of scopes contained in the returned token. https://cloud.google.com/docs/authentication/token-types#access-contents
  - `token_type` string: Type of the returned access token (e.g. "Bearer"). It specifies how the token must be used. Bearer tokens may be used by any entity without proof of identity.

## Changes

- **2026-12-05** `4dfb67434032`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/notebooks` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/notebooks` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/notebooks/changes/v2/projects/:projectsId/locations/:locationsId/instances/:instancesId:generateAccessToken/post.md)

---

[API](https://skmtc.dev/google/apis/notebooks.md) - [All operations](https://skmtc.dev/google/apis/notebooks/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/notebooks/revisions/4dfb67434032?raw)
