api_tokens
Creates, updates, deletes, gets or lists an api_tokens resource.
Overview​
| Name | api_tokens |
| Type | Resource |
| Id | railway.account.api_tokens |
Fields​
The following fields are returned by SELECT queries:
- list
One row per ApiToken.
| Name | Datatype | Description |
|---|---|---|
id | string | |
name | string | |
workspace_id | string | |
display_token | string | |
expires_at | string (date-time) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | Gets all API tokens for the authenticated user. Backed by the Railway GraphQL query apiTokens. | ||
create | insert | name | Creates a new API token. Backed by the Railway GraphQL mutation apiTokenCreate. | |
delete | delete | id | Deletes an API token. Backed by the Railway GraphQL mutation apiTokenDelete. |
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 |
|---|---|---|
id | string | |
name | string |
SELECT examples​
- list
Gets all API tokens for the authenticated user. Backed by the Railway GraphQL query apiTokens.
SELECT
id,
name,
workspace_id,
display_token,
expires_at
FROM railway.account.api_tokens
;
INSERT examples​
- create
- Manifest
Creates a new API token. Backed by the Railway GraphQL mutation apiTokenCreate.
INSERT INTO railway.account.api_tokens (
name,
workspace_id
)
SELECT
'{{ name }}' /* required */,
'{{ workspace_id }}'
RETURNING
result
;
# Description fields are for documentation purposes
- name: api_tokens
props:
- name: name
value: "{{ name }}"
- name: workspace_id
value: "{{ workspace_id }}"
DELETE examples​
- delete
Deletes an API token. Backed by the Railway GraphQL mutation apiTokenDelete.
DELETE FROM railway.account.api_tokens
WHERE
id = '{{ id }}' --required
;