Profile

Personal Access Tokens List

get
https://api.linode.com/v4/profile/tokens

Returns a paginated list of Personal Access Tokens currently active for your User.

Request Samples

curl -H "Authorization: Bearer $TOKEN" \
    https://api.linode.com/v4/profile/tokens

Response Samples

{
  "data": [
    {
      "id": "",
      "created": "2018-01-01T00:01:01.000Z",
      "label": "linode-cli",
      "token": "abcdefghijklmnop",
      "expiry": "2018-01-01T13:46:32",
      "scopes": "*"
    }
  ],
  "page": 1,
  "pages": 1,
  "results": 1
}

Responses

200: A paginated list of active tokens.

data
array of objects
id
integer

This token's unique ID, which can be used to revoke it.

created
Filterable
string

The date and time this token was created.

label
Filterable
string

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.

token
string

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.

expiry
string

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.

scopes
string

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.

page
integer

The current page.

pages
integer

The total number of pages.

results
integer

The total number of results.

default: Error

errors
array of objects
reason
string

What happened to cause this error. In most cases, this can be fixed immediately by changing the data you sent in the request, but in some cases you will be instructed to open a Support Ticket or perform some other action before you can complete the request successfully.

field
string

The field in the request that caused this error. This may be a path, separated by periods in the case of nested fields. In some cases this may come back as "null" if the error is not specific to any single element of the request.

Personal Access Token Create

post
https://api.linode.com/v4/profile/tokens

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.

Request Body Schema

expiry
string <date-time>

When this token should be valid until. If omitted, the new token will be valid until it is manually revoked.

label
Filterable
string [1 .. 100] characters

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.

scopes
string <oauth-scope>

The access scopes 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.

Request Samples

curl -H "Content-Type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -X POST -d '{
      "scopes": "*",
      "expiry": "2018-01-01T13:46:32",
      "label": "linode-cli"
    }' \
    https://api.linode.com/v4/profile/tokens

Response Samples

{
  "token": "abcdefghijklmnop",
  "created": "2018-01-01T00:01:01.000Z",
  "expiry": "2018-01-01T13:46:32",
  "id": 1234,
  "label": "linode-cli",
  "scopes": "*"
}

Responses

200: Token created successfully.

token
string

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.

created
Filterable
string <date-time>

The date and time this token was created.

expiry
string <date-time>

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.

id
integer

This token's unique ID, which can be used to revoke it.

label
Filterable
string [1 .. 100] characters

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.

scopes
string <oauth-scopes>

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.

default: Error

errors
array of objects
reason
string

What happened to cause this error. In most cases, this can be fixed immediately by changing the data you sent in the request, but in some cases you will be instructed to open a Support Ticket or perform some other action before you can complete the request successfully.

field
string

The field in the request that caused this error. This may be a path, separated by periods in the case of nested fields. In some cases this may come back as "null" if the error is not specific to any single element of the request.