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-15 19:01:28 UTC",
      "updated_at": "2018-11-15 19:01:28 UTC",
      "id": 1,
      "name": "user1@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrKErfOEcwln07iYNSZPn5YNTe59foGgZZ37GNwWc1A8RlksGAZbUxY7PDUlKH0SQgG9nylubyLp19Jz+i8DZYan448uOs3trWgivwu69XqoO2DSnOm1BP8qAuvD6djbFttQAuIVtLr4W4PZKUwFecet9FBpqQTHi/JqcSSfYPwpOaxu4O+BY4uObjW6lDiVvq4mNGpm9fcwc3dugsLLGaMkBa64z3GWj4XCTIus3i4B3K8r5A+ut7om/XgWrHf/EEFncXZ+MA6FdaWGb5Y9aJKGiYljmwX/YtmZP9T4Nis5XzoiUyUAbe0G+v3wZOMWs4CQQJpzMKPwQcFSV2+Wrd foreman1@example.com",
      "length": 2048,
      "fingerprint": "de:d5:2d:e8:0b:8a:f0:1c:50:7c:8c:71:42:77:44:cf"
    }
  ]
}

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/1-user4example-com
200
{
  "created_at": "2018-11-15 19:01:28 UTC",
  "updated_at": "2018-11-15 19:01:28 UTC",
  "id": 1,
  "name": "user4@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA13mD474oUTlgiK5gQItgbkPTgYW2440AShXCLN76gcdP3DNW2qDU4m2Si1EpzNUKeGoZPxuMXh00P2oViyDzrVklDuegF1XzGkz8JA/WYyVk9Fm5IZoDvrlALS5WlqNpKpa0LUonIDW6QH0+62l68n5qw39MhRbHWSfcNE8RVHztvxBmwEiKLCwYUo2nBKHZhQ+PEBet/dw30WiQtUSltXVwVWC9KvQ5PJrmrV5Ibn3P1m8HeHA5noEXLMyHbwl1io8iRPWAK9g6W4PyGGQc5skRvb8GqlqYS1SJ+SsvYGhKbjpjqwChA+AJfkPkEYAcorT8soCPxScQaLRHxWqz foreman4@example.com",
  "length": 2048,
  "fingerprint": "0b:01:1f:15:1e:ae:7a:49:5f:7a:52:8f:91:81:a1:a8"
}

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/988725678/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": "2018-11-15 19:01:28 UTC",
  "updated_at": "2018-11-15 19:01:28 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

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/988725678/ssh_keys/1-user3example-com
{
  "ssh_key": {}
}
200
{
  "id": 1,
  "name": "user3@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIS1Jg1AAiM/LN/1667keKKf3auMLs2wnBP261aj0E59bz/wuhgx7MGgYb2pjEGa8a8O2GznKMaM1fYG1TaE9hI6froHqe41sOZsTRmeYIpyKbDchq+N3xBm6C4BUpCKyTCtQMlpqpzhJyBl11BsbYSvQ8QmgPLOdOD2NZmmTLxtsWW9wyHTwpHK0+x3sO8A6zaiqIIVraZLvUUWxW5NWqgtmxYtF68Mw+/iuaJ3xoWjGLQespx6xrwzkBsr/A2PjG35vdaOs6aq8xXFMTOw+XZBgI/mL58UVsgrZ1+8g5B4pM+P5wxMztejsS8oXX+xLHbj1h/+WDhKEP5Re0b5Kx foreman3@example.com",
  "fingerprint": "be:28:25:ea:7b:50:cb:81:67:4a:16:48:e8:7e:32:5d",
  "user_id": 988725678,
  "length": 2048,
  "created_at": "2018-11-15T19:01:28.499Z",
  "updated_at": "2018-11-15T19:01:28.499Z"
}

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