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": "2021-11-26 09:57:33 UTC",
      "updated_at": "2021-11-26 09:57:33 UTC",
      "id": 5,
      "name": "user6@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC67QNsOpzfZfsvXYGac4fppAISkodVtZ6rlpT+/2b4MkmuwUyXThc1qsMV/sWG5Fjb5XrBWBr+/g1K8ZYDbvu2nEJ/20x9lo/NjGrJk+kMMuyzyQkvBY09n/8kxtEqW+yUqsWChgx5aTc36Cxm7IGLadSrFeKMfvWr1n28sueyKIlPKg5Ir5h+T5IGiuJD1iMqRCbGzwLLZZS0fjg4UKcgcb02XsXFSoHJcnwIifc3qPC05qQQFiTXtEDJMnv3FUCz4GkNxNb1boMyI1AHWjBTBX7YgFcwxBY/2QtzpJt1RRTdolUlFOwndblp1Vop+NsOTpfII/pcKlnczquhF/2B foreman6@example.com",
      "length": 2048,
      "fingerprint": "aB+pZA04nuWMmqX1ZcYh4Wo9C2m80kNibBO0bEnZto0="
    }
  ]
}

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. ‘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/988725678/ssh_keys/3-user4example-com
200
{
  "created_at": "2021-11-26 09:57:32 UTC",
  "updated_at": "2021-11-26 09:57:32 UTC",
  "id": 3,
  "name": "user4@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH7dq4YOWsN2O/mdvXH7z33nsToS/cmzaBM+L13DQ9GAVu6xUE5N1cln/Sl9V5cYZOQw1HJ3WtdTotUL24iKK7Xa+e2Aa8eCeax+ouaMdsaVn+1wSsJQcaALb0kb9WudxqkS6CFheBeiVpS4v50dCpp3gG9Q78z64ZWMznRac4wV+kJaRAD4qFREzqFgxdJkBZz9bNfIpMM8aVgzYl4HJ6rvsGM/KWodaLmWE2igXH1bYAyrXBSnz4TioXUlfDjtwwRcTgYpN8DmjTRTRNgPFbBFzOP0C0QPC8EgyHd9v0tJFjM3Cvs7Y/NRRh9Lm5+i6vk5K/nMxGrZx2U+ad4Wbz foreman4@example.com",
  "length": 2048,
  "fingerprint": "KDBeriRjM/9f25gEhno96CgBBJYg9MvUnv70AllRGX0="
}

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/988725677/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-11-26 09:57:30 UTC",
  "updated_at": "2021-11-26 09:57:30 UTC",
  "id": 2,
  "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/988725679/ssh_keys/4-user5example-com
{
  "ssh_key": {}
}
200
{
  "id": 4,
  "name": "user5@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSHGmLpYNmctSY8Zkm3Qr0bAjf7oRg3PxgBLLW5Il8dorLPz05nOnkk704Oh03JkWqX4tLJHDqHzqJ32SNGeUKPUj2e7DgcjJPcYd7UsuYs6IzukR5HUoiu8SRxkjAtd6+4dx+hfuj779YiX97JIvCaic2unmpenLqZ/DgVXmEFzOjK5fnPDkWU0LBMFxAV07ATuhqTB9fQUjJrT+JALa67SDSLBXa14gxCOeuWUzkhMJ5/8GLokDnw1G6H8f/9qX9tbUbrq9izThlB1l/1uvveBuCQlXalcocDVplTfVMQ1Or78YxI+XVixB94S2TveSMc9IXspkQ7YhD/v9JBzm5 foreman5@example.com",
  "fingerprint": "UUiQamj9wTUjm2pXM7hzeJXioY4CDOXCl5gMgpBdUew=",
  "user_id": 988725679,
  "length": 2048,
  "created_at": "2021-11-26T09:57:32.977Z",
  "updated_at": "2021-11-26T09:57:32.977Z"
}

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