personal_access_tokens
Creates, updates, deletes, gets or lists a personal_access_tokens
resource.
Overview
Name | personal_access_tokens |
Type | Resource |
Id | linode.profile.personal_access_tokens |
Fields
The following fields are returned by SELECT
queries:
- get_personal_access_token
- get_personal_access_tokens
The requested token.
Name | Datatype | Description |
---|---|---|
id | integer | Read-only This token's unique ID, which can be used to revoke it. |
created | string (date-time) | Filterable, Read-only The date and time this token was created. (example: 2018-01-01T00:01:01) |
expiry | string (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) |
label | string | Filterable 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) |
scopes | string (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: *) |
token | string | Read-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:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_personal_access_token | select | Returns a single Personal Access Token. Learn more... Learn more... | ||
get_personal_access_tokens | select | Returns a paginated list of Personal Access Tokens currently active for your User. Learn more... Learn more... | ||
post_personal_access_token | insert | 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... | ||
put_personal_access_token | replace | Updates a Personal Access Token. Learn more... Learn more... | ||
delete_personal_access_token | delete | 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... |
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.
Name | Datatype | Description |
---|
SELECT
examples
- get_personal_access_token
- get_personal_access_tokens
Returns a single Personal Access Token.
Learn more...
Learn more...
SELECT
id,
created,
expiry,
label,
scopes,
token
FROM linode.profile.personal_access_tokens;
Returns a paginated list of Personal Access Tokens currently active for your User.
Learn more...
Learn more...
SELECT
data,
page,
pages,
results
FROM linode.profile.personal_access_tokens;
INSERT
examples
- post_personal_access_token
- Manifest
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
;
# Description fields are for documentation purposes
- name: personal_access_tokens
props:
- name: expiry
value: string
description: >
When this token should be valid until. If omitted, the new token will be valid until it is manually revoked.
- name: label
value: string
description: >
__Filterable__ 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.
- name: scopes
value: string
description: >
The access [scopes](https://techdocs.akamai.com/linode-api/reference/get-started#oauth-reference) to grant to the created token. These cannot be changed after creation, and may not exceed the scopes of the acting token.
If omitted or entered with a wildcard character (`*`), the new token will have the same scopes as the acting token.
Multiple scopes are separated by a space character (` `).
For example, `linodes:read_write account:read_only`.
REPLACE
examples
- put_personal_access_token
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
- delete_personal_access_token
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;