Skip to main content

api_tokens

Creates, updates, deletes, gets or lists an api_tokens resource.

Overview​

Nameapi_tokens
TypeResource
Idrailway.account.api_tokens

Fields​

The following fields are returned by SELECT queries:

One row per ApiToken.

NameDatatypeDescription
idstring
namestring
workspace_idstring
display_tokenstring
expires_atstring (date-time)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectGets all API tokens for the authenticated user. Backed by the Railway GraphQL query apiTokens.
createinsertnameCreates a new API token. Backed by the Railway GraphQL mutation apiTokenCreate.
deletedeleteidDeletes 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.

NameDatatypeDescription
idstring
namestring

SELECT examples​

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​

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
;

DELETE examples​

Deletes an API token. Backed by the Railway GraphQL mutation apiTokenDelete.

DELETE FROM railway.account.api_tokens
WHERE
id = '{{ id }}' --required
;