GET /api/users/:user_id/ssh_keys
List all SSH keys for a user

Examples

GET /api/users/988725765/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2019-11-07 08:34:21 UTC",
      "updated_at": "2019-11-07 08:34:21 UTC",
      "id": 7,
      "name": "user5@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqU15t/OmNTpGmrUR580X5GgjpcZuH30MW685EuFOnUdQ/G50Q1viVWJF3Z1rbT9pPbhpkU76A7wL301iCa6KNz4hdA2Dr9k0e9/LCOIiX8VJ+wmtqW38XjeUs743Hk6Kks03Y2ffFUJzbu3NSL7Rpbl0i7OOHDDSE14Xkgy2iypR8YJaxup4IFMQVqFjUsvMmNqu5F8MqQXeKFjCcmvTmy73Keut3j/upV8mbGG3Tuv4cFz17Ljwx34UWeOjm6mxrInabNbT6QU0U41SkNIen/LYpWr3k0pDfBJg3ldYIin+ByBUTbSwqtqMbBPC/HguW5D3sYGUbNDn13++nwjT3 foreman5@example.com",
      "length": 2048,
      "fingerprint": "ff:78:1c:b2:8a:58:0d:50:34:c2:f7:1d:76:95:c2:23"
    }
  ]
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

Validations:

  • Must be a Integer

user_id
Required

ID of the user

Validations:

  • Must be a String

search
Optional

filter results

Validations:

  • Must be a String

order
Optional

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
Optional

Page number, starting at 1

Validations:

  • Must be a number.

per_page
Optional

Number of results per page to return

Validations:

  • Must be a number.

Search fields

Field name Tipo Possible values
name string
user_id integer

GET /api/users/:user_id/ssh_keys/:id
Show an SSH key from a user

Examples

GET /api/users/988725763/ssh_keys/4-user3example-com
200
{
  "created_at": "2019-11-07 08:34:20 UTC",
  "updated_at": "2019-11-07 08:34:20 UTC",
  "id": 4,
  "name": "user3@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtHpTawqCvNL3QmcJ8zRJhG8PRqonLTkC7odkdW7rcmT45Osu/isXHEUu4HzY2848QKCE8Axk6Zittj8Os5QTDSZB+MF8yh9EAQ4+qQAnGlcFZAxNntWA4dSzyjAujj38NRmU9UPIa10cJAk43hgD+nQChZr0xuF99/kMP8YWUn9sMRvaTvajPly2DdhGYjehVMgBuDSgzsxven2l/kEJrlE6HGD/r8pAebJA6zY5ishMFQynTWt95WPPGuWBI3Voc1VRkIDhKs1q3oGi2hDmIX+hwovulxzySdYZ2U2sCiWunwa/tsJn5rFUhjAQOEw+BEkBHCyiOeN6tNYMPLgtD foreman3@example.com",
  "length": 2048,
  "fingerprint": "b3:0a:3e:fe:24:fc:56:91:8b:7e:3c:12:c2:8f:58:4b"
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
Required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

user_id
Required

ID of the user

Validations:

  • Must be a String


POST /api/users/:user_id/ssh_keys
Add an SSH key for a user

Examples

POST /api/users/988725762/ssh_keys
{
  "ssh_key": {
    "name": "foreman@example.com",
    "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com"
  }
}
201
{
  "created_at": "2019-11-07 08:34:20 UTC",
  "updated_at": "2019-11-07 08:34:20 UTC",
  "id": 3,
  "name": "foreman@example.com",
  "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com",
  "length": 520,
  "fingerprint": "8e:0c:28:d9:99:e8:c2:84:46:1b:1d:ba:e5:78:4c:33"
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

Validations:

  • Must be a Integer

user_id
Required

ID of the user

Validations:

  • Must be a String

ssh_key
Required

Validations:

  • Must be a Hash

ssh_key[name]
Required

Validations:

  • Must be a String

ssh_key[key]
Required

Public SSH key

Validations:

  • Must be a String


DELETE /api/users/:user_id/ssh_keys/:id
Delete an SSH key for a user

Examples

DELETE /api/users/988725761/ssh_keys/1-user1example-com
{
  "ssh_key": {}
}
200
{
  "id": 1,
  "name": "user1@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCo69RMtV/XrMlMbEFB1UPrjCUGNXrKodoacCdVoyH/CKXR2DapReBt5J3NmblrNWukLLkWmUWYBA2bzqIRL5+OJQsqvxyJTcZT7Sbmir7xyEtE8pmzpHGvEjUrm+GM7kLDEDKVTqo678Pm8tLanPMvldQoB/i6hoYqLqlq+EgtUMY4Z0dRfyDo1aMvzTSWscWSvY/K7EIuinFRVhW+y9BFmOeov0bNTugj7xa4tWLa9le8ilBMM+Sk7mpAohEBQ7C3L1AzjvbKUfdQLaSZCyjapK8MsTdNEJue8emJ9Igp6J1QE6yfm9BX9vB6gvwXmoRFGBHdRIIe24W6jxtOkHt3 foreman1@example.com",
  "fingerprint": "5a:83:21:e1:87:3b:09:65:6b:a2:bd:17:aa:36:9d:53",
  "user_id": 988725761,
  "length": 2048,
  "created_at": "2019-11-07T08:34:20.318Z",
  "updated_at": "2019-11-07T08:34:20.318Z"
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
Required

Validations:

  • Must be a String

user_id
Required

ID of the user

Validations:

  • Must be a String