Create SSH Public Key
curl --request POST \
--url https://api.dispersed.com/v1/ssh-public-keys \
--header 'Content-Type: application/json' \
--data '
{
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host",
"is_default": true,
"name": "Work Laptop"
}
'import requests
url = "https://api.dispersed.com/v1/ssh-public-keys"
payload = {
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host",
"is_default": True,
"name": "Work Laptop"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host',
is_default: true,
name: 'Work Laptop'
})
};
fetch('https://api.dispersed.com/v1/ssh-public-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dispersed.com/v1/ssh-public-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([
'public_key' => 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host',
'is_default' => true,
'name' => 'Work Laptop'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dispersed.com/v1/ssh-public-keys"
payload := strings.NewReader("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host\",\n \"is_default\": true,\n \"name\": \"Work Laptop\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}HttpResponse<String> response = Unirest.post("https://api.dispersed.com/v1/ssh-public-keys")
.header("Content-Type", "application/json")
.body("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host\",\n \"is_default\": true,\n \"name\": \"Work Laptop\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dispersed.com/v1/ssh-public-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host\",\n \"is_default\": true,\n \"name\": \"Work Laptop\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"fingerprint": "<string>",
"is_default": true,
"object": "ssh_public_key",
"public_key": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"account": "<string>",
"account_uuid": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"uuid": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}SSH Public Keys
Create SSH Public Key
POST
/
v1
/
ssh-public-keys
Create SSH Public Key
curl --request POST \
--url https://api.dispersed.com/v1/ssh-public-keys \
--header 'Content-Type: application/json' \
--data '
{
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host",
"is_default": true,
"name": "Work Laptop"
}
'import requests
url = "https://api.dispersed.com/v1/ssh-public-keys"
payload = {
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host",
"is_default": True,
"name": "Work Laptop"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host',
is_default: true,
name: 'Work Laptop'
})
};
fetch('https://api.dispersed.com/v1/ssh-public-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dispersed.com/v1/ssh-public-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([
'public_key' => 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host',
'is_default' => true,
'name' => 'Work Laptop'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dispersed.com/v1/ssh-public-keys"
payload := strings.NewReader("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host\",\n \"is_default\": true,\n \"name\": \"Work Laptop\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}HttpResponse<String> response = Unirest.post("https://api.dispersed.com/v1/ssh-public-keys")
.header("Content-Type", "application/json")
.body("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host\",\n \"is_default\": true,\n \"name\": \"Work Laptop\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dispersed.com/v1/ssh-public-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host\",\n \"is_default\": true,\n \"name\": \"Work Laptop\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"fingerprint": "<string>",
"is_default": true,
"object": "ssh_public_key",
"public_key": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"account": "<string>",
"account_uuid": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"uuid": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}Body
application/json
SSH public key in OpenSSH format
Minimum string length:
1Example:
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host"
Whether this key should be set as the default SSH public key.
Example:
true
Optional label for this SSH public key
Maximum string length:
100Example:
"Work Laptop"
Response
SSH public key created successfully
Available options:
ssh_public_key ⌘I