Skip to content

Add an SSH key for a user

POST
/api/v4/users/{user_id}/keys

Adds an SSH key for a specified user account. Administrators only.

user_id
required
integer

The ID of the user

Media type application/json
object
key
required

The new SSH key

string
nullable
title
required

The title of the new SSH key

string
nullable
expires_at

The expiration date of the SSH key in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)

string format: date-time
nullable
usage_type

Scope of usage for the SSH key

string
default: auth_and_signing nullable
Allowed values: auth_and_signing auth signing

Created

Media type application/json
object
id
integer format: int64
title
string
created_at
string format: date-time
expires_at
string format: date-time
last_used_at
string format: date-time
key
string
usage_type
string
Example
{
"id": 1,
"title": "Sample key 25",
"created_at": "2015-09-03T07:24:44.627Z",
"expires_at": "2020-09-03T07:24:44.627Z",
"last_used_at": "2020-09-03T07:24:44.627Z",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt1256k6Yjz\\\n GGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCdd\\\n NaP0L+hM7zhFNzjFvpaMgJw0=",
"usage_type": "auth"
}

Bad Request

Not Found