Skip to main content

ssh_public_keys

Creates, updates, deletes, gets or lists a ssh_public_keys resource.

Overview​

Namessh_public_keys
TypeResource
Idrailway.account.ssh_public_keys

Fields​

The following fields are returned by SELECT queries:

One row per SshPublicKey.

NameDatatypeDescription
idstring
namestring
user_idstring
workspace_idstring
created_atstring (date-time)
fingerprintstring
public_keystring
updated_atstring (date-time)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectworkspace_idGets SSH public keys. If workspaceId is provided, returns the keys owned by that workspace (requires workspace MEMBER access). Under a workspace-scoped API token, workspaceId defaults to the token's workspace when omitted; otherwise returns the authenticated user's personal keys. Backed by the Railway GraphQL query sshPublicKeys.
createinsertname, public_keyCreates a new SSH public key. When workspaceId is provided (or omitted under a workspace-scoped API token, in which case it defaults to the token's workspace), the key is owned by the workspace and can be used by anyone authenticating as that workspace via native SSH; requires workspace ADMIN access. Otherwise the key is owned by the authenticated user. Backed by the Railway GraphQL mutation sshPublicKeyCreate.
deletedeleteidDeletes an SSH public key. Backed by the Railway GraphQL mutation sshPublicKeyDelete.

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
workspace_idstring
idstring
namestring
public_keystring

SELECT examples​

Gets SSH public keys. If workspaceId is provided, returns the keys owned by that workspace (requires workspace MEMBER access). Under a workspace-scoped API token, workspaceId defaults to the token's workspace when omitted; otherwise returns the authenticated user's personal keys. Backed by the Railway GraphQL query sshPublicKeys.

SELECT
id,
name,
user_id,
workspace_id,
created_at,
fingerprint,
public_key,
updated_at
FROM railway.account.ssh_public_keys
WHERE workspace_id = '{{ workspace_id }}'
;

INSERT examples​

Creates a new SSH public key. When workspaceId is provided (or omitted under a workspace-scoped API token, in which case it defaults to the token's workspace), the key is owned by the workspace and can be used by anyone authenticating as that workspace via native SSH; requires workspace ADMIN access. Otherwise the key is owned by the authenticated user. Backed by the Railway GraphQL mutation sshPublicKeyCreate.

INSERT INTO railway.account.ssh_public_keys (
name,
public_key,
workspace_id
)
SELECT
'{{ name }}' /* required */,
'{{ public_key }}' /* required */,
'{{ workspace_id }}'
RETURNING
id,
name,
user_id,
workspace_id,
created_at,
fingerprint,
public_key,
updated_at
;

DELETE examples​

Deletes an SSH public key. Backed by the Railway GraphQL mutation sshPublicKeyDelete.

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