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

Examples

GET /api/users/988725681/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2020-05-20 13:36:04 UTC",
      "updated_at": "2020-05-20 13:36:04 UTC",
      "id": 6,
      "name": "user14@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+OE271mxb31sEmQl8SqZl712GOByy+b1VE6xhny7sYAfvh18qiUlSgSX6L8rDS/1Fp1RsCOXaOcrQBpOGrwBP3xusb5bMWNJ9IxyDNM/zR+mxX2c1mvCIEuvbJsHydAK1a7MQNBStrzMpGUHIr7TVGazvbAJQl5Cm+Uon65mq+DCpDVClC3cVkgIwwDYrX1d+RCu97VcuMRXbctv96tZU06XaVES2mHynJgKgDE05oZg4lu+kQgRgl5w3JPjgY6+1GIzdbop04CVWapkchCocvG/w8YBhFbrdMps6zurkcqT1zlAvlpfQU+XgB7cdITSWmlzH/lIPIRYNxM9arSch foreman14@example.com",
      "length": 2048,
      "fingerprint": "WdYhP96M47rtqn+59uBdDRy0JKIx0Pqa4eh08+PkfsM="
    }
  ]
}

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 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/988725678/ssh_keys/1-user11example-com
200
{
  "created_at": "2020-05-20 13:36:03 UTC",
  "updated_at": "2020-05-20 13:36:03 UTC",
  "id": 1,
  "name": "user11@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ4sCOytAqSGeX+FTaTNfgHDSzQQZDggBPA+y7BoowF7HKuSRn8jdVtApAyN9sRpbg83ZZ5e+xFy75dGMG8snMcco/ATTnUdCgLS8LH6dTX+Eyd3MeajJ/EinqV2F+pBe20/sO0Y/FKeDKFKLv9rOtM/Vz8P4weGKcsadKtw8nIrZ4pr1B/dLsQ2/I7GmlayQN8iO5mQ5/fMRcNEUbBvC2fwluRoieNCk62/ZXOsBOmJ+Hl0ygRIQ9MWDFED6h/oiMIPx7/lgYr0BMQcHRP9vMJH1x+zaLUfYLCLu/tTs7zgAmBuaoWE08S6MSi+j3H5VfaNkjNTEm6P1RIl1HE5OL foreman11@example.com",
  "length": 2048,
  "fingerprint": "J6sll0cJNsBlrgqFPA1huDuSTzMYPEGrLpv7BuP09EU="
}

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/988725679/ssh_keys
{
  "ssh_key": {
    "name": "foreman@example.com",
    "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com"
  }
}
201
{
  "created_at": "2020-05-20 13:36:04 UTC",
  "updated_at": "2020-05-20 13:36:04 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/988725682/ssh_keys/7-user15example-com
{
  "ssh_key": {}
}
200
{
  "id": 7,
  "name": "user15@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7S8f+r73SCOb6aH4F8ybbGGCgGj0JLrq5IoDfPh4YBJUc1u2uJvlEPxDjqjcOp/crcMzwzamswStvZ4cwXOpnvKcGf+ZLgN3uW6p3+3rWXSV7hkuG/yxNMXwAc/kWpLUXX5ja4fPxr+NYbt4XnHgSEZHR0g9+wOrP43EmFvfXt3CMD3P+c/u0eFgMU+nmt4CpJBzcd84pq9emj5TiiwOzftTF9N5VHosW0NuAoqKS77saE1MfRg+UgO83HkfC5Y/RTs0tIVo326h6PtIeD4KVFpflmcsNYxY93NXGL23OYEpDEjBLHDkDYIklR6/gsdgAY0fgbfsly+ZNSjQqCKBf foreman15@example.com",
  "fingerprint": "x0LD6dlPPZfA1kOMsv34IF79Gv10vwmPaofhYkyHxuo=",
  "user_id": 988725682,
  "length": 2048,
  "created_at": "2020-05-20T13:36:05.269Z",
  "updated_at": "2020-05-20T13:36:05.269Z"
}

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