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

Examples

GET /api/users/988725680/ssh_keys
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2022-09-06 14:35:05 UTC",
      "updated_at": "2022-09-06 14:35:05 UTC",
      "id": 5,
      "name": "user6@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDb7i6RsDKOxIyYEk/VgLqqQkspXR9K0f/RhQ8S9caS8pVdLHtTWN1ZZAcNVIFvkHFBR8EuBn0MaIR0lucChGvf2bZjP+AzCqiH7mFFfFOmyo58t7VZIde1liohMRJruuy1AsZMrz3GoBBFkUe9wwpWwTn/EQJ9EVp133oA3jYok9jqXHAucr5QYDBn0VNTFmKdSCA3fUmbVOE9ZV9k8HVGAMXtm6QamBHVmLTAF6V+QfXtwgxJESXmCjJbzlkhdJbz+QNn6PQLUbdXMkrPpg4QZXxaatT+xT83mcwebWBSEFoVbFJ4lQMV3VMhlP36oD5rQ9H3N6q3FCboHtFaT/Tv foreman6@example.com",
      "length": 2048,
      "fingerprint": "RosxGWgXLARSlTh+I3okI9S2NqQU1NhnMlaOabFTrl8="
    }
  ]
}

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/988725677/ssh_keys/1-user3example-com
200
{
  "created_at": "2022-09-06 14:35:04 UTC",
  "updated_at": "2022-09-06 14:35:04 UTC",
  "id": 1,
  "name": "user3@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCx0lkrMVgbRwY1jO8eFD1EMvW+5Ya1YCExCa3r+BCMY0LHE5friN5m+J01dB7BFZcIdzMRmnI626btBbsh2ovoJkSbvjWTZuuX3b66Df1nBJDVd0ylyTSDCr1zQ4OEEP/RVo9hvoLjckvd0knACBtcWopR0n06Vavg5d1icWb8n2FqYAKpyjxXglaIP5T8ahxbw3GkfxEEU1eypwvbHBtoxKOnARnVuNTDV995j0S2GHxIs5PU6k2ak68AGaFoHJXbZ6gvfuB1CKjBO9ZmmBMdOjKSUYCxdvJZypWMbYaZx7DEIGNQ1fBlSZ8cTFRgOTvZcn7tfPNmm+EIRtHk8jk1 foreman3@example.com",
  "length": 2048,
  "fingerprint": "Cv9RRsMfOxGGNphJBiUWLshAZBnL7Q1igoC7/FjoDiE="
}

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/988725679/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": "2022-09-06 14:35:04 UTC",
  "updated_at": "2022-09-06 14:35:04 UTC",
  "id": 4,
  "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/988725678/ssh_keys/2-user4example-com
{
  "ssh_key": {}
}
200
{
  "id": 2,
  "name": "user4@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0BcXPtwJaDwyzqZ+Rs35dyblR9uUMgeqY4aTq2G0/3eWoaxTYQLVQdO/jLuBjUFHHvTwWYjejrd6lEbD1dxiZkfbOgbV8HzBRR7EhVWG6Hk5cWvLo0KEncSWEbdJXTokJ13Pb60yKrn7PDl0iBtC/d5XEF3M6qkBk7tkf6XLWPymJcmB45UlmqP8WxRLoQFfQYe5K3fyS2ky3bRgBoym/h7OXOHbn9cwUAVCNlwDg7oLcNpwGRqCbsZ2BAFLs0EWQjKQ4jUGQY6f7FPp9Bj8DwM1LbRAP/zsIAPMiOVKgeY3ggkExWinisvNZLBost/69pW9umVCmQCkr7pPGmaKb foreman4@example.com",
  "fingerprint": "1fS3737n7fI1BSDL/Hhe6mMI07WSmrMYfB6GVY/EnQw=",
  "user_id": 988725678,
  "length": 2048,
  "created_at": "2022-09-06T14:35:04.675Z",
  "updated_at": "2022-09-06T14:35:04.675Z"
}

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