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

Examples

GET /api/users/988725831/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2021-05-18 16:09:03 UTC",
      "updated_at": "2021-05-18 16:09:03 UTC",
      "id": 5,
      "name": "user9@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDch3UALb545N2wVyKGXjt7CF+PQwuOH+DCGS66xe2Ql2DS42X8jGtPh1u7ZRNcj9HjIUwQP4s4qhg3q6U3wvpYczYZYGsia4DtTLa9cUJ1fuI0RbH/z3rhCkoLQkGYfzro5xTxjwzNl2wXgGJXAvcnfzwmkggGqcj3WwkibtEu896GTLeSPxgEcXSymJYnsLlykGG40mTjNixhHFrGL+uxAEQePOjbcnpN04QcHuzY8ZiMf7dl+Uz8BfSNtQbMVpe0y+FG8EKEUN/2UIys3MidcViL1DX5qkbDaDvQtvTFNaSvhoRf1Jn9KPJhAoWJD+jnTnuhy/ZxbpX//4U25jqB foreman8@example.com",
      "length": 2048,
      "fingerprint": "RCeGoCzwYtKTMcMx1kuUFHNqQJcZndK8nQcspaGgOKM="
    }
  ]
}

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, ‘all’ to return all results

Validations:

  • Must match regular expression /\A([1-9]\d|all)\Z$/.

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/988725828/ssh_keys/1-user6example-com
200
{
  "created_at": "2021-05-18 16:09:03 UTC",
  "updated_at": "2021-05-18 16:09:03 UTC",
  "id": 1,
  "name": "user6@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3Zt9FKoKipNYCjrhAJ/q9Wc6jGHhm/5w6MLOu5Uwa+YwnjnbceXFa0b9H52QLzgkHDc51p/yr0dmRlNzk5UeFUzBfXgyv7Dewcaod6Gn58jqV43/URbTgxNK1cry6gVTNnkVQ7Y9vzSFBXlQ3n9kuL6YqR+jX+f6KRikaeGcljPoPFGji1AW/uGkNMTRm6aXgih3gAtsJUI0wr8uZAfT2EHGdFFlpP3WQmY7qY3iYJR8VBvZQD2FbVQvOvxztMbNbejh31Kfa6i7BbPTcou8O2lN3iLSKobKr+rl3PipRMAndCpvxATUrKfJr3D7RZ7Vx2c+4Jj4q/iSarzYDGCyp foreman5@example.com",
  "length": 2048,
  "fingerprint": "RSbtBCDgW1Hejo+g9rhAfnpAeJrEHIvlyYqSTxCf0F8="
}

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/988725829/ssh_keys
{
  "ssh_key": {
    "name": "foreman@example.com",
    "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com"
  }
}
201
{
  "created_at": "2021-05-18 16:09:03 UTC",
  "updated_at": "2021-05-18 16:09:03 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/988725830/ssh_keys/4-user8example-com
{
  "ssh_key": {}
}
200
{
  "id": 4,
  "name": "user8@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnwN2xTM3qGGM1L/kSp0fpmab6h/VEoZ305TkF6NSnM3lVIeV5ZWJlLmeZtzcm1KpAqv+fnwhis25oGoLYlARRjp0wLLMO7TpZxcp/Qcz4E3qE93WBqE1wxpoCEx2bxpziiwuMJwxOy/vHwX1VrhDOB26Phi9O7K0/hqtEOM0Rm88sh8PanP7KybtAidxljjqddNWRYDCroOlZ+BEqW4mnPNDbure9ELAT8ifKgchdTcqOJWT2t0JYrq1xDl6P8JFXyWHO6iL6ys93UoKWXlX17J/OxxRkm0/taqOMdjxgaPByzCkbH/r9tJyW8Kxskehjy54UWiuvTwSVADlVjZ6d foreman7@example.com",
  "fingerprint": "PIdJAqp0Kwpwnrn14w6XuP3McpoOQOS0lt0ia8cGm+c=",
  "user_id": 988725830,
  "length": 2048,
  "created_at": "2021-05-18T16:09:03.657Z",
  "updated_at": "2021-05-18T16:09:03.657Z"
}

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