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

Examples

GET /api/users/988725678/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2018-11-16 10:03:06 UTC",
      "updated_at": "2018-11-16 10:03:06 UTC",
      "id": 1,
      "name": "user1@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzfVC+CVRjSl8nv+zQOAB/fCX2KKfkNAdxUJXToFSVpTk1vhsWmT+zKJG3lzOVz+fUdDiqsHCXETR/y2e9BGZANbRz/x/NNG8v2ycKxCNaA3htQKL4lr/yAC8aO5Ex5NcHvgziL/mdtSCi2kB4aMeVHzifJqmY2l7waOmToqC42NIiY/EGFrpvltr50NX4ZzUIQqDS774t1DRf2AWZNdmGbB8uS+QGcnOZm4bl2f11m8Dise0phbOEjgu7b09BNGqRII0TN9aFvIRR3oostC9pYnl8O5BOFi5tFgA0hn0I11kNxMjpodivYF6WpZEFmotLDY84vWqdxkIycHscMB4X foreman1@example.com",
      "length": 2048,
      "fingerprint": "6e:2a:d1:f0:c5:4f:9a:77:73:15:46:b6:e0:89:53:29"
    }
  ]
}

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 and order by a searchable field, e.g. '<field> 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
id integer
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-user5example-com
200
{
  "created_at": "2018-11-16 10:03:07 UTC",
  "updated_at": "2018-11-16 10:03:07 UTC",
  "id": 1,
  "name": "user5@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRddmQ+oi4GJXwuWFRJ4vfFLI26mniBzRF8nuGlLeCNW57Mx4ILwkn73PpltyMMyUpgvqCKTgylGpL+UfAauV38QY7eiHnjIPtiQ/sZ6/H70JYE5mv2axhOfQme1I8ZzOm0Dk26gZiUs5EFpS2R5KuXLRk+/25O/A7PbNNntRubCnvfT8ZbijvkdmyCxLHqS8Ir2tkKqft6o89NnL95s5VhPzBvBm0tnMEjDBiUC411Vu/FMBlk1RJe22ly406IfL869OJM6f5Uc402F/gJsSUIqbEV3lqAqv90AYgGGBoKNEu2SH7rpqZXkFlMAMqbaBnVmx+58OXHa3VR7xQwG/r foreman5@example.com",
  "length": 2048,
  "fingerprint": "8d:67:82:00:79:85:54:82:61:19:cb:70:2c:c9:1d:66"
}

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/988725678/ssh_keys
{
  "ssh_key": {
    "name": "foreman@example.com",
    "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com"
  }
}
201
{
  "created_at": "2018-11-16 10:03:06 UTC",
  "updated_at": "2018-11-16 10:03:06 UTC",
  "id": 2,
  "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/988725678/ssh_keys/1-user2example-com
{
  "ssh_key": {}
}
200
{
  "id": 1,
  "name": "user2@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXEb4ITdGxF/HiFZRwWHpEvPmmLtDniPNEokt98yQ68aKLLl9OTpgrx0CBfucLJV1cfooe+03Il8w5l4vxqsdYFrGpP0ssMLAIrBy499ER5lYEpI1cTJDLLcUvmSnqyNF1gOU0oPetdwloJapTn/7pu/GRJQ8SSOWpumYvvJhzAlSo0fW+NkNFyfjiV+I3x/Xa5BlXRCHJQ06sBbdM+1ki7F4RbSUBssVDVLfxUU4v2j/VL//I1biqHdIp3bV1O/S2G7yVnveWJRO8WyNu864ipWPB1NJZtY1KQCWBbWvOPlTeptrCVMz9Ajatqw40GZeu6KM5hI3Z1vDZdeexvo8r foreman2@example.com",
  "fingerprint": "08:d4:7e:b7:9d:a6:91:cc:43:30:81:8a:94:cd:fd:1f",
  "user_id": 988725678,
  "length": 2048,
  "created_at": "2018-11-16T10:03:06.910Z",
  "updated_at": "2018-11-16T10:03:06.910Z"
}

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