Get an SSH key
curl --request GET \
--url {schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id} \
--header 'Authorization: Bearer <token>'import requests
url = "{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}', 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 => "{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"sha256": "<string>",
"value": "<string>",
"label": "<string>",
"active": true,
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}SSH
Get an SSH key
Retrieves the specified SSH public key.
GET
/
users
/
{user_id}
/
ssh-keys
/
{key_id}
Get an SSH key
curl --request GET \
--url {schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id} \
--header 'Authorization: Bearer <token>'import requests
url = "{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}', 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 => "{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/users/{user_id}/ssh-keys/{key_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"sha256": "<string>",
"value": "<string>",
"label": "<string>",
"active": true,
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the user.
Example:
"d81c8ee2-44b3-429f-b944-a33ad7437690"
The ID of the SSH key.
Response
OK
The ID of the SSH key.
The SHA-256 fingerprint of the public key.
The SSH public key in the OpenSSH authorized keys format.
A human-readable name for the key.
Whether the key can be used for authentication.
The ID of the user who owns the key.
The date and time when the key was added.
The date and time when the key was last updated.
Was this page helpful?