tokens
Creates, updates, deletes, gets or lists a tokens resource.
Overview
| Name | tokens |
| Type | Resource |
| Id | vercel.authentication.tokens |
Fields
The following fields are returned by SELECT queries:
- get
- list
Successful response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the token. (example: 5d9f2ebd38ddca62e5d51e9c1704c72530bdc8bfdd41e782a6687c48399e8391) |
name | string | The human-readable name of the token. |
active_at | number | Timestamp (in milliseconds) of when the token was most recently used. (wire: activeAt) |
created_at | number | Timestamp (in milliseconds) of when the token was created. (wire: createdAt) |
expires_at | number | Timestamp (in milliseconds) of when the token expires. (wire: expiresAt) |
leaked_at | number | Timestamp (in milliseconds) of when the token was marked as leaked. (wire: leakedAt) |
leaked_url | string | URL where the token was discovered as leaked. (wire: leakedUrl) |
origin | string | The origin of how the token was created. (example: github) |
prefix | string | The token's prefix, for identification purposes. (example: vcp_) |
revoked_at | number | Timestamp (in milliseconds) of when the token was revoked. (wire: revokedAt) |
scopes | array | The access scopes granted to the token. |
suffix | string | The last few characters of the token, for identification purposes. (example: abc123) |
type | string | The type of the token. (example: oauth2-token) |
Authentication token metadata.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the token. (example: 5d9f2ebd38ddca62e5d51e9c1704c72530bdc8bfdd41e782a6687c48399e8391) |
name | string | The human-readable name of the token. |
active_at | number | Timestamp (in milliseconds) of when the token was most recently used. (wire: activeAt) |
created_at | number | Timestamp (in milliseconds) of when the token was created. (wire: createdAt) |
expires_at | number | Timestamp (in milliseconds) of when the token expires. (wire: expiresAt) |
leaked_at | number | Timestamp (in milliseconds) of when the token was marked as leaked. (wire: leakedAt) |
leaked_url | string | URL where the token was discovered as leaked. (wire: leakedUrl) |
origin | string | The origin of how the token was created. (example: github) |
prefix | string | The token's prefix, for identification purposes. (example: vcp_) |
revoked_at | number | Timestamp (in milliseconds) of when the token was revoked. (wire: revokedAt) |
scopes | array | The access scopes granted to the token. |
suffix | string | The last few characters of the token, for identification purposes. (example: abc123) |
type | string | The type of the token. (example: oauth2-token) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | token_id | Retrieve metadata about an authentication token belonging to the currently authenticated User. | |
list | select | Retrieve a list of the current User's authentication tokens. | ||
create | insert | name | team_id, slug | Creates and returns a new authentication token for the currently authenticated User. The bearerToken property is only provided once, in the response body, so be sure to save it on the client for use with API requests. |
delete | delete | token_id | Invalidate an authentication token, such that it will no longer be valid for future HTTP requests. |
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 |
|---|---|---|
token_id | string | The identifier of the token to invalidate. The special value "current" may be supplied, which invalidates the token that the HTTP request was authenticated with. |
slug | string | The Team slug to perform the request on behalf of. |
team_id | string | The Team identifier to perform the request on behalf of. (wire: teamId) |
SELECT examples
- get
- list
Retrieve metadata about an authentication token belonging to the currently authenticated User.
SELECT
id,
name,
active_at,
created_at,
expires_at,
leaked_at,
leaked_url,
origin,
prefix,
revoked_at,
scopes,
suffix,
type
FROM vercel.authentication.tokens
WHERE token_id = '{{ token_id }}' -- required
;
Retrieve a list of the current User's authentication tokens.
SELECT
id,
name,
active_at,
created_at,
expires_at,
leaked_at,
leaked_url,
origin,
prefix,
revoked_at,
scopes,
suffix,
type
FROM vercel.authentication.tokens
;
INSERT examples
- create
- Manifest
Creates and returns a new authentication token for the currently authenticated User. The bearerToken property is only provided once, in the response body, so be sure to save it on the client for use with API requests.
INSERT INTO vercel.authentication.tokens (
name,
expires_at,
project_id,
team_id,
slug
)
SELECT
'{{ name }}' /* required */,
{{ expires_at }},
'{{ project_id }}',
'{{ team_id }}',
'{{ slug }}'
RETURNING
bearer_token,
token
;
# Description fields are for documentation purposes
- name: tokens
props:
- name: name
value: "{{ name }}"
- name: expires_at
value: {{ expires_at }}
- name: project_id
value: "{{ project_id }}"
description: |
The ID of the project to scope this token to
- name: team_id
value: "{{ team_id }}"
description: The Team identifier to perform the request on behalf of.
description: The Team identifier to perform the request on behalf of.
- name: slug
value: "{{ slug }}"
description: The Team slug to perform the request on behalf of.
description: The Team slug to perform the request on behalf of.
DELETE examples
- delete
Invalidate an authentication token, such that it will no longer be valid for future HTTP requests.
DELETE FROM vercel.authentication.tokens
WHERE token_id = '{{ token_id }}' --required
;