Memos unofficial
POST/api/v1/users/{user}/personalAccessTokens

Create a personal access token

Creates a long-lived personal access token for a user. Supply the required parent resource name in the format users/{user}; you can optionally provide a description and an expiresInDays value. The token value is returned only when you create the token, so store it securely at that time.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 3 body fields
userstringrequired
The user ID for which to create the personal access token.

Personal access token creation details. parent is required.

parentstringrequired
Required. The parent resource where this token will be created. Format: users/{user}
descriptionstringoptional
Optional. Description of the personal access token.
expiresInDaysintegeroptional
Optional. Expiration duration in days (0 = never expires).

2 status codes
200Returns the personal access token metadata and the token value, which is visible only in this creation response.
personalAccessTokenobjectoptional
The personal access token metadata.
tokenstringoptional
The actual token value - only returned on creation. This is the only time the token value will be visible.
defaultDefault error response
codeintegeroptional
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
messagestringoptional
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
detailsarray<object>optional
A list of messages that carry the error details. There is a common set of message types for APIs to use.

Error handling

The parent field is required and must use the format users/{user}. The user path parameter must identify the user in that parent resource. The token value is visible only in the creation response, so save it when returned.