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

Examples

GET /api/users/980190963/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2018-07-24 12:58:20 UTC",
      "updated_at": "2018-07-24 12:58:20 UTC",
      "id": 1,
      "name": "user1@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsVcKEFO1HFq7mN0dwigsR4W9ey72/NWkZKVvqeO72qBXr1l2zFhK8lRL0KzksLkysBlYVD6j4s03supjjlNg9rrgYICkXREo2YB/yGfGV6OT8/x2wXmLWUVRiLyC5zUNTYP5mfL87Np3W2bWVqbv6pciI0L9k40smlwRjzrMFcMaiul368uWZEUuQjzypZ9xLewTVjAvm/eJ4P8M6Yvp6Yf30kyIB+icrea6zOcDpxCC95jaXQzgq1UXKnxbxN6yg4x9y+O/SgUq7yAorPRJDZbuCCoLkP9I3bKqucPTupAFWaI01zvL8pBxeBMctfZU2u2hD1UvtlAZz3wigpfup foreman1@example.com",
      "length": 2048,
      "fingerprint": "ca:fb:4b:aa:16:b6:62:92:d2:ee:ff:11:b2:0d:3a:fb"
    }
  ]
}

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/980190966/ssh_keys/5-user4example-com
200
{
  "created_at": "2018-07-24 12:58:21 UTC",
  "updated_at": "2018-07-24 12:58:21 UTC",
  "id": 5,
  "name": "user4@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMteeGCl0hs0oCgji1Dao0ilZwtwt0eUDVRyQHVYpTmRRuqxqws3r04Qy/pZM2dy+kWUYY2ZiP4amAEnBvN8vyls6pI6G95Nr2VVu9KO4OGDitXoCB6m9J8Ho906ziCMxSqmNcHvQT3e1B5UOMyw38YESNB2GccMrgSUD4ospGcpip7ev9kovhoSQkqLiIqbPo+qJ/x99UVocBqY7Pq7Sq3vfRbrPtrp89H8IVd+zLzWY1n9EVeRwTq6JaHjL2od/P3O7dEqDSF6/RmyS/hz8ZVVU0GfKmBH/E5noeQ9QGxcafBeCmdcCCI8mEiu6qkH/Cn/2QxsrKn5nYM88oi0ET foreman4@example.com",
  "length": 2048,
  "fingerprint": "cd:76:19:8f:2c:eb:e6:4b:cd:e8:01:ab:6b:f8:bd:05"
}

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/980190964/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-07-24 12:58:21 UTC",
  "updated_at": "2018-07-24 12:58:21 UTC",
  "id": 3,
  "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/980190965/ssh_keys/4-user3example-com
{
  "ssh_key": {}
}
200
{
  "id": 4,
  "name": "user3@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs6GnGI4WUEk7EXtKiPHZxYbsONEg2xaSa6E65dVCEsBp/Qwt2FhOTBOb0apc7neeX8wY4HCj1m5uk5YPvnoR97At3wHirWAja575NoVv9VhjBXXsIL+1FKxdUX2/t2GfcldvCPh/TWBIO1oZDcvpTVQ0/JsncfYH3q/nSynOx+6hi023wcPVTf3oxBIUN8TiX/vr/Cv+yC3lggDil5BYdKacvNlcBwTOrIp0VXQtQJY7+FvJHHmk3EFKp73upZxT+IeMoUhtsDDdLz6TNwYCLkc9dCSSZ52celDP9SqDMMnu7MVoWF+/p3ZriNcbjUmtVMRiWcX/OFSgiH4Cl/7TD foreman3@example.com",
  "fingerprint": "a3:4e:1f:1b:f5:e8:51:58:bf:2a:0d:69:7b:c8:66:99",
  "user_id": 980190965,
  "length": 2048,
  "created_at": "2018-07-24T12:58:21.143Z",
  "updated_at": "2018-07-24T12:58:21.143Z"
}

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