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

Examples

GET /api/users/988725684/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2021-05-19 07:41:37 UTC",
      "updated_at": "2021-05-19 07:41:37 UTC",
      "id": 4,
      "name": "user12@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/NDP6bBHAWfnn2S8Spo5TD1vnb4NMrJ7KX0xyk4PRzocsH152WlanonvWGcHtrNJfD0cqy2Jv04vdkOuo82NMP8m2J6SECUVTgZGTpGbRmIpCBH3Ma1oAfBf5SEgH31RSlH60eytp3PIFF8J5C7KSALTrBEFdSGeH22Zi/kZeOxEAb0d+9iV21pq4TIHEFCIuId+y27OP6nJgIDdcCeUK53wHMWZwkZgBL/L5QH+ECttmhTHGwkGnFqdbgG3mgnNAB/gEVX/u6fKCxdUGxaN67ueTqHVx2CqwP1/5pknYgU1Zb/baoNlnh09RqNEpoXtrUyaFRkNd7AyxTJ9UJFCd foreman12@example.com",
      "length": 2048,
      "fingerprint": "K9Wc3ZFsSnEkYtzov00tFFbXlRucGLSj6hgV7wPSpYg="
    }
  ]
}

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, ‘all’ to return all results

Validations:

  • Must match regular expression /\A([1-9]\d|all)\Z$/.

Search fields

Field name Type 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/988725682/ssh_keys/1-user10example-com
200
{
  "created_at": "2021-05-19 07:41:36 UTC",
  "updated_at": "2021-05-19 07:41:36 UTC",
  "id": 1,
  "name": "user10@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCq6dP/hPBH6+cECNjhwhjJCRgGkhFBu52tqTqgf5Q53LKYPaPhmtdw9pa2wWG4Uy5PQDfueSToorwo5LWB2SR4lq+PuOyMZB5udEw4UMYgFnHIzWgShvd1GGfHAXUYnwVCQSLx74i2WGIDB191dE2qNB0Co4tq9D8F/gbedg1FdtGjJZCS+W9Ks1qnJ7Lb6462mAs/mTm3Bo4U/b5CNOsv4saGubNj537rOPQgs4mT8vC92a3Cy4zDQKcPwmWJex29N2mTu/47vz5t9DoHowQ8LhXrRcZAZMKnYara6Cbje7TJRdfdyHYxUbege9F4TueOb3Uh8c92EguoB+QRTNkv foreman10@example.com",
  "length": 2048,
  "fingerprint": "RrsIquxbPoH+ZGCzRTLeTQgoQV2CaMb1IVP+fgavoqQ="
}

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/988725683/ssh_keys
{
  "name": "foreman@example.com",
  "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com",
  "ssh_key": {
    "name": "foreman@example.com",
    "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com"
  }
}
201
{
  "created_at": "2021-05-19 07:41:36 UTC",
  "updated_at": "2021-05-19 07:41:36 UTC",
  "id": 3,
  "name": "foreman@example.com",
  "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com",
  "length": 520,
  "fingerprint": "5YShdnIX3EEv8GzgY2BSVyOmR9ADnS71FpyobuNljxk="
}

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/988725685/ssh_keys/5-user13example-com
{
  "ssh_key": {}
}
200
{
  "id": 5,
  "name": "user13@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8zyk9zfyBXwO3GdgbAcyDiShDGFAACVxNb36DYMDRkAnfpl3it3PHZ/Rg9mdzP7mI5nodmWxe9aRcMuAWR0jaC9pM40HtOOKe+G5RFnqvFaTfE3xOGpJ17ImtK1A3mboO5VRYjURgs+42d7MRuzK9TzN+4hCaWQlS1PHJzuiBuYuQXi41ZEe3np8G4fw4Zowc7NQ8K6IOqshYYqp1GHqBQpd2oTws2sZ6oaQJs0a9Agyp8YSX0EskZp5AcfvSHY0TBZHETFpHdr/fojJWPgDXu8PrX1jnlA0IU41m9ZgofZ9+fFYdeISyW1Bp+2KetJrbWbCYCU3gUTEkacK1fQUD foreman13@example.com",
  "fingerprint": "9cjQCbNIunqsi1yzN3X50TSBTUaD79NikiaCkrq3RoE=",
  "user_id": 988725685,
  "length": 2048,
  "created_at": "2021-05-19T07:41:37.192Z",
  "updated_at": "2021-05-19T07:41:37.192Z"
}

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