Create SSH Key
curl --request POST \
--url https://api.tenbytecloud.com/v1/user-resource/ssh_keys \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "<string>",
"public_key": "<string>"
}
'import requests
url = "https://api.tenbytecloud.com/v1/user-resource/ssh_keys"
payload = {
"name": "<string>",
"public_key": "<string>"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', public_key: '<string>'})
};
fetch('https://api.tenbytecloud.com/v1/user-resource/ssh_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbytecloud.com/v1/user-resource/ssh_keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbytecloud.com/v1/user-resource/ssh_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.tenbytecloud.com/v1/user-resource/ssh_keys")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbytecloud.com/v1/user-resource/ssh_keys");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("apikey", "<api-key>");
request.AddJsonBody("{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbytecloud.com/v1/user-resource/ssh_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'public_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"uuid": "3f8f4c5a-2c6d-4f0a-9a3a-8c9f6e3f1a2b",
"name": "laptop-mbp",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMockPublicKeyData user@host",
"user_id": 268,
"created_at": "2025-01-12T09:21:33Z"
}User
Create SSH Key
Create a new SSH public key. The public_key is immutable once created.
POST
/
user-resource
/
ssh_keys
Create SSH Key
curl --request POST \
--url https://api.tenbytecloud.com/v1/user-resource/ssh_keys \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "<string>",
"public_key": "<string>"
}
'import requests
url = "https://api.tenbytecloud.com/v1/user-resource/ssh_keys"
payload = {
"name": "<string>",
"public_key": "<string>"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', public_key: '<string>'})
};
fetch('https://api.tenbytecloud.com/v1/user-resource/ssh_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbytecloud.com/v1/user-resource/ssh_keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbytecloud.com/v1/user-resource/ssh_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.tenbytecloud.com/v1/user-resource/ssh_keys")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbytecloud.com/v1/user-resource/ssh_keys");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("apikey", "<api-key>");
request.AddJsonBody("{\n \"name\": \"<string>\",\n \"public_key\": \"<string>\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbytecloud.com/v1/user-resource/ssh_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'public_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"uuid": "3f8f4c5a-2c6d-4f0a-9a3a-8c9f6e3f1a2b",
"name": "laptop-mbp",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMockPublicKeyData user@host",
"user_id": 268,
"created_at": "2025-01-12T09:21:33Z"
}⌘I