SSH keys
Register an SSH key
Adds a public key to your account. Instances you create after this call get this key. Instances that already exist keep the key they were created with. Registering the same public key again creates a new ID. A trailing newline is accepted and preserved.
The key must be one OpenSSH public key line, for example the content
of ~/.ssh/id_ed25519.pub, with no authorized_keys options in front
of it. Ed25519, ECDSA (P-256, P-384, P-521), the security-key types
sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-nistp256@openssh.com,
and RSA keys of 2048 bits or more are accepted. Other key types,
certificates, and RSA keys shorter than 2048 bits get 400.
POST
/
ssh-keys
Register an SSH key
curl --request POST \
--url https://api.hivecompute.ai/v1/ssh-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETCectK27yhdmuct8RFCynCjeWek5/ShKk6ISJZFSx+ you@laptop"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETCectK27yhdmuct8RFCynCjeWek5/ShKk6ISJZFSx+ you@laptop'
})
};
fetch('https://api.hivecompute.ai/v1/ssh-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hivecompute.ai/v1/ssh-keys"
payload = { "content": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETCectK27yhdmuct8RFCynCjeWek5/ShKk6ISJZFSx+ you@laptop" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "[{\"property\":\"size\",\"constraints\":[\"size must not be greater than 200\"]}]",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing API token",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "You do not have access to this resource.",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Too Many Requests",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred.",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}Authorizations
Body
application/json
Was this page helpful?
⌘I
Register an SSH key
curl --request POST \
--url https://api.hivecompute.ai/v1/ssh-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETCectK27yhdmuct8RFCynCjeWek5/ShKk6ISJZFSx+ you@laptop"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETCectK27yhdmuct8RFCynCjeWek5/ShKk6ISJZFSx+ you@laptop'
})
};
fetch('https://api.hivecompute.ai/v1/ssh-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hivecompute.ai/v1/ssh-keys"
payload = { "content": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETCectK27yhdmuct8RFCynCjeWek5/ShKk6ISJZFSx+ you@laptop" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "[{\"property\":\"size\",\"constraints\":[\"size must not be greater than 200\"]}]",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing API token",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "You do not have access to this resource.",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Too Many Requests",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred.",
"request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}