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

Examples

GET /api/users/988725677/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2019-02-20 13:29:33 UTC",
      "updated_at": "2019-02-20 13:29:33 UTC",
      "id": 1,
      "name": "user6@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbHuscnTjO4FQjUWKmNqylgPSY/sq49Ra5mzN4MvfGXPVF1JByB9V04jrB/Gnvq2l8M8gntgmzF78D/l3+PKQLVOn108W4M/ZcoPOiN7GPGfkboW0Cee1yXQHLEvBF6JjADf5Flt+G/jQY93CtFTJwKt9Fa0jebEfpw0fMtIc9YozJZNbKlAUCWI7JH8IVauLnf7u8tHdrwLSTPqJz1CtnxN5wnFMe9qE+Ljpke4W6D8arg8pIFzFIT4RG0uhmKUOMF2Jd4Tego0kkybNEUtWSg9bugtObvc8000JXrPooGl26fqB6kDStflYw82ERkatnWDVqbNxY6Lk02fX3Jant foreman5@example.com",
      "length": 2048,
      "fingerprint": "b4:71:bc:e3:c2:db:63:9c:2d:04:18:b0:d2:25:52:fa"
    }
  ]
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

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

paginate results

Validations:

  • Must be a String

per_page
optional

number of entries per request

Validations:

  • Must be a String

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/2-user7example-com
200
{
  "created_at": "2019-02-20 13:29:33 UTC",
  "updated_at": "2019-02-20 13:29:33 UTC",
  "id": 2,
  "name": "user7@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNS5kH4fSRKJYMdYa2YfHORm4ffP3SPhP9NkgeUrfR98p//Oc6mtkVA6f4kT12XufGTKvum2vp099TywLvZ3sg5KiX6bDE9CRJjo8lxv3mjO4oJiguTNK1ul89R1aNK7dJAeDdccYb+28cHJWgV2sclud3+u838el1zXD2ylBhB58kaDkmp1sJ9KrodAZIJ6B9BfNzn0ueOXPQr2i+m59fpmd8YjHWYli8kVxaws1/68QmcmO+RSfaTgLE++WqQLtVa6JPevrByDVgyz7K1rXkxEsUr8hpnyCClcdR63bILTDBzVBvbqdmQzS+DmQosF0B7TYrCLUifKoDhC2cea8x foreman6@example.com",
  "length": 2048,
  "fingerprint": "99:59:5e:16:be:d7:f5:5e:31:20:ea:63:57:99:21:c9"
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

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": "2019-02-20 13:29:33 UTC",
  "updated_at": "2019-02-20 13:29:33 UTC",
  "id": 4,
  "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

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

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/988725680/ssh_keys/5-user9example-com
{
  "ssh_key": {}
}
200
{
  "id": 5,
  "name": "user9@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtgrgT4RH549xl62dxhaow+QH0aqcSoEtWQthGJHnniDF7bAX4mxIup7XEGejzGWSphArWSD6eOs3t8DusLgrJH/ZQ/LeCdq4V1SO1o1H9hrlckvsDFqqsFk44UuJjevwOuelu5dB+RmPatL7WqLIQ4dJ5yzz/TVnrlWYD8PPFmSTneGyPcKhI3owZvhiuztdkbzoHegzwN029QYFJ8f4e6TZHB4eUoQZuypul9DsABZwQ0TIY8swrKMB72kPLYVdwmU1RXWoLteKVQpOQ7fGl+v5TeToNBDJHNNsZLh2qNIEu27vrXUGv7AtQFZWvvWMQtCsdmCeLg+a1z7HVfJA/ foreman8@example.com",
  "fingerprint": "da:74:ee:dc:63:b2:b9:29:b8:b1:b6:81:c5:ca:18:f0",
  "user_id": 988725680,
  "length": 2048,
  "created_at": "2019-02-20T13:29:33.821Z",
  "updated_at": "2019-02-20T13:29:33.821Z"
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String

user_id
required

ID of the user

Validations:

  • Must be a String