Skip to main content

personal_access_tokens

Creates, updates, deletes, gets or lists a personal_access_tokens resource.

Overview

Namepersonal_access_tokens
TypeResource
Idlinode.profile.personal_access_tokens

Fields

The following fields are returned by SELECT queries:

The requested token.

NameDatatypeDescription
idintegerRead-only This token's unique ID, which can be used to revoke it.
createdstring (date-time)Filterable, Read-only The date and time this token was created. (example: 2018-01-01T00:01:01)
expirystring (date-time)Read-only When this token will expire. Personal Access Tokens cannot be renewed, so after this time the token will be completely unusable and a new token will need to be generated. Tokens may be created with null as their expiry and will never expire unless revoked. (example: 2018-01-01T13:46:32)
labelstringFilterable This token's label. This is for display purposes only, but can be used to more easily track what you're using each token for. (example: linode-cli)
scopesstring (oauth-scopes)Read-only The scopes this token was created with. These define what parts of the Account the token can be used to access. Many command-line tools, such as the Linode CLI, require tokens with access to *. Tokens with more restrictive scopes are generally more secure. (example: *)
tokenstringRead-only The token used to access the API. When the token is created, the full token is returned here. Otherwise, only the first 16 characters are returned. (example: abcdefghijklmnop)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_personal_access_tokenselectReturns a single Personal Access Token.

Learn more...

Learn more...
get_personal_access_tokensselectReturns a paginated list of Personal Access Tokens currently active for your User.

Learn more...

Learn more...
post_personal_access_tokeninsertCreates a Personal Access Token for your User. The raw token will be returned in the response, but will never be returned again afterward so be sure to take note of it. You may create a token with at most the scopes of your current token. The created token will be able to access your Account until the given expiry, or until it is revoked. Parent and child accounts In a parent and child account environment, the following apply:

- If you're using a child account parent user (proxy user), you can't create this form of token. The only token available to a proxy user is one that lets you run operations in a child account. These are created with the Create a proxy user token operation.

Learn more...

Learn more...
put_personal_access_tokenreplaceUpdates a Personal Access Token.

Learn more...

Learn more...
delete_personal_access_tokendeleteRevokes a Personal Access Token. The token will be invalidated immediately, and requests using that token will fail with a 401. It is possible to revoke access to the token making the request to revoke a token, but keep in mind that doing so could lose you access to the api and require you to create a new token through some other means.

Learn more...

Learn more...

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription

SELECT examples

Returns a single Personal Access Token.

Learn more...

Learn more...

SELECT
id,
created,
expiry,
label,
scopes,
token
FROM linode.profile.personal_access_tokens;

INSERT examples

Creates a Personal Access Token for your User. The raw token will be returned in the response, but will never be returned again afterward so be sure to take note of it. You may create a token with at most the scopes of your current token. The created token will be able to access your Account until the given expiry, or until it is revoked. Parent and child accounts In a parent and child account environment, the following apply:

- If you're using a child account parent user (proxy user), you can't create this form of token. The only token available to a proxy user is one that lets you run operations in a child account. These are created with the Create a proxy user token operation.

Learn more...

Learn more...

INSERT INTO linode.profile.personal_access_tokens (
data__expiry,
data__label,
data__scopes
)
SELECT
'{{ expiry }}',
'{{ label }}',
'{{ scopes }}'
RETURNING
id,
created,
expiry,
label,
scopes,
token
;

REPLACE examples

Updates a Personal Access Token.

Learn more...

Learn more...

REPLACE linode.profile.personal_access_tokens
SET
data__label = '{{ label }}'
WHERE

RETURNING
id,
created,
expiry,
label,
scopes,
token;

DELETE examples

Revokes a Personal Access Token. The token will be invalidated immediately, and requests using that token will fail with a 401. It is possible to revoke access to the token making the request to revoke a token, but keep in mind that doing so could lose you access to the api and require you to create a new token through some other means.

Learn more...

Learn more...

DELETE FROM linode.profile.personal_access_tokens;