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": "2019-09-11 14:31:52 UTC",
      "updated_at": "2019-09-11 14:31:52 UTC",
      "id": 2,
      "name": "user2@example.com",
      "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC73jm3itxuHfeEboe6l/u35KFx3h2de9/PJ5OBblsIYLGC5h+AGw+4Ny8ggLAB5wYw/ks5xMoahAdIZ4yI0ecS09cdTMN7V1oVL/IFdFA+7VSKsK8j1SUbSJjeuX7tbeFYhYx/HG/qmn2x3/10huUqDp3AhdiLTHPV1wVYDlEK/mSoYJOSRns0oyQBYSvmG8TSMdjh6smyrLZU5PWK/Qo922WG8QkzzLmCx5TsSrmDHFbKBXnf88AsG9EVcF9VRxCJYagbCtszHKcc5QV7I7EyDlbP0QmRsfvfi1KPI/ozBcm5SJFIsTLyX/KEi0T8bYYfvKNUTUEkmzpjf6NfE1GF foreman2@example.com",
      "length": 2048,
      "fingerprint": "25:14:96:87:ef:f3:b4:52:83:94:bc:49:0b:0b:63:47"
    }
  ]
}

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

Page number, starting at 1

Validations:

  • Must be a number.

per_page
optional

Number of results per page to return

Validations:

  • Must be a number.

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/988725677/ssh_keys/1-user1example-com
200
{
  "created_at": "2019-09-11 14:31:52 UTC",
  "updated_at": "2019-09-11 14:31:52 UTC",
  "id": 1,
  "name": "user1@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeU1GmZAFEvuifxP84M1R+Lvse5C7KfQ/st3WuBERmGbSwBRtQfbq2wIuyI90bBFuvmU9Ur7PjQ1icqn6QB/r6YypB3KJ6V9vT18REwfjhYaRkgwYipNC+VvUH9J9teRJjRtTgouwmMbcJDrhfynMxpJar4Tg2OccoB5IGRVUFTCS0fdeOdsb9GycAOgeoZTew756dwMKCX6Z9jcNTXRDcppwqaa3hZB0hGAYnzMeaGvHDH6q1UEUMZPje6Z3djNcZRGpipgyWEnK7Jigh6mupCda2LOVW4k7XwjAXfUFOgTLqekculyd8QZq7jhfozu11W0vXtJEZKHa/vq2w1Zh9 foreman1@example.com",
  "length": 2048,
  "fingerprint": "a0:d6:20:f7:85:be:c5:df:e7:a5:e2:67:37:31:96:8c"
}

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/988725680/ssh_keys
{
  "ssh_key": {
    "name": "foreman@example.com",
    "key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIhRoL6PfBRs9YwW3r2/pYeLrxRzEZSUO3Go8JivxMsguEKjJ3byHDPvPpMHhKKSZD/HJY/A+2Ndqp0ElB+t2qs= foreman@example.com"
  }
}
201
{
  "created_at": "2019-09-11 14:31:52 UTC",
  "updated_at": "2019-09-11 14:31:52 UTC",
  "id": 5,
  "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/988725679/ssh_keys/3-user3example-com
{
  "ssh_key": {}
}
200
{
  "id": 3,
  "name": "user3@example.com",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtg/vnAQOrltUERTujEXAbrymn53kOU/yJhQiX33rcTCoQtdSOJW9zmPaE/pUGn7cGWtfZY8GgLNciHirS8ujcxEMsmHZ5ng4HqHq/jFNdwAgDPQtt2rb1NHIxHCCMrOHtqjQKXU3fSg1qMUiEV7dIaRHv3fLmYRCKLZ7Z19kWa6y4NPR6DeXkEhCa3eT0VSUOQmEzcUj0L/Cb+h/iHuB6M7zJmtk9rG4DbXtKU2NJqHfSu5G3t7+reh1kSSLx4mH4jXKH+xOWGG7t2l4dW2IreKeQp0S6UDq9rLToVtHxHkHMxydd4xNIrw3A4e179FwGNZY16cvvob4GpVLq98L9 foreman3@example.com",
  "fingerprint": "b3:35:29:52:b9:37:c2:68:bd:cf:c1:56:66:9e:98:72",
  "user_id": 988725679,
  "length": 2048,
  "created_at": "2019-09-11T14:31:52.855Z",
  "updated_at": "2019-09-11T14:31:52.855Z"
}

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