Skip to content

ssh_keys.php

SSH keys management module for handling the creation, retrieval, updating, and deletion of SSH public keys associated with user accounts.

API Methods

Method Action Description
add add ssh key Adds a new SSH key to the account.
delete delete ssh key Deletes an existing SSH key by its ID.
list list ssh keys Returns a list of SSH keys belonging to the user or specified customer.
show show ssh key Retrieves detailed information about a specific SSH key.
update update ssh key Updates an existing SSH key.

ssh_keys/add

Adds a new SSH key to the account.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: add
token ✅ string Authentication token for API access.
id ❌ integer ID of the entity (not used in add).
customer_id ❌ integer Customer identifier (used by administrators).

Request example

curl -s "https://invapi.hostkey.com/ssh_keys.php" -X POST \
--data "action=add" \
--data "token=HOSTKEY_TOKEN"
Success response example
{
"result": "OK",
"action": "add",
"sshkey": {
"id": 123,
"name": "work_laptop",
"public_key": "ssh-rsa AAAAB3Nza...",
"created_at": "2024-05-20T12:00:00Z"
}
}
Error examples
{
"code": -1,
"message": "Error description"
}

ssh_keys/delete

Deletes an existing SSH key by its ID.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: delete
token ✅ string Authentication token for API access.
id ✅ integer The ID of the SSH key to delete.

Request example

curl -s "https://invapi.hostkey.com/ssh_keys.php" -X POST \
--data "action=delete" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Success response example
{
"result": "OK",
"action": "delete",
"sshkey": {
"id": 123,
"status": "deleted"
}
}
Error examples
{
"code": -404,
"message": "SSH key not found"
}

ssh_keys/list

Returns a list of SSH keys belonging to the user or specified customer.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: list
token ✅ string Authentication token for API access.
id ❌ integer ID of the entity (not used in list).
customer_id ❌ integer Customer identifier (used by administrators).

Request example

curl -s "https://invapi.hostkey.com/ssh_keys.php" -X POST \
--data "action=list" \
--data "token=HOSTKEY_TOKEN"
Success response example
{
"result": "OK",
"action": "list",
"sshkeys": [
{
"id": 1,
"name": "personal_key",
"public_key": "ssh-rsa AAAAB3Nza...",
"created_at": "2024-01-01T10:00:00Z"
},
{
"id": 2,
"name": "server_access",
"public_key": "ssh-rsa AAAAB3Nza...",
"created_at": "2024-01-05T15:30:00Z"
}
]
}
Error examples
{
"code": -1,
"message": "Error description"
}

ssh_keys/show

Retrieves detailed information about a specific SSH key.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: show
token ✅ string Authentication token for API access.
id ✅ integer The ID of the SSH key to show.

Request example

curl -s "https://invapi.hostkey.com/ssh_keys.php" -X POST \
--data "action=show" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Success response example
{
"result": "OK",
"action": "show",
"sshkey": {
"id": 123,
"name": "work_laptop",
"public_key": "ssh-rsa AAAAB3Nza...",
"created_at": "2024-05-20T12:00:00Z"
}
}
Error examples
{
"code": -404,
"message": "SSH key not found"
}

ssh_keys/update

Updates an existing SSH key.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update
token ✅ string Authentication token for API access.
id ✅ integer The ID of the SSH key to update.

Request example

curl -s "https://invapi.hostkey.com/ssh_keys.php" -X POST \
--data "action=update" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Success response example
{
"result": "OK",
"action": "update",
"sshkey": {
"id": 123,
"name": "updated_key",
"public_key": "ssh-rsa AAAAB3Nza...",
"updated_at": "2024-05-21T09:00:00Z"
}
}
Error examples
{
"code": -1,
"message": "Error description"
}
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×