Code Samples #
Copy
curl --request PUT \
--url 'https://app.xcloud.host/api/v1/sites/{uuid}/ssh' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"authentication_mode": "public_key",
"ssh_public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation"
],
"password": "Str0ngP@ssw0rd!"
}'
const response = await fetch('https://app.xcloud.host/api/v1/sites/{uuid}/ssh', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"authentication_mode": "public_key",
"ssh_public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation"
],
"password": "Str0ngP@ssw0rd!"
})
});
const data = await response.json();
console.log(data);
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"authentication_mode": "public_key",
"ssh_public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation"
],
"password": "Str0ngP@ssw0rd!"
}
response = requests.put("https://app.xcloud.host/api/v1/sites/{uuid}/ssh", headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://app.xcloud.host/api/v1/sites/{uuid}/ssh',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_TOKEN',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => '{
"authentication_mode": "public_key",
"ssh_public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation"
],
"password": "Str0ngP@ssw0rd!"
}',
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("PUT"), "https://app.xcloud.host/api/v1/sites/{uuid}/ssh");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
request.Content = new StringContent(@"{
""authentication_mode"": ""public_key"",
""ssh_public_keys"": [
""ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation""
],
""password"": ""Str0ngP@ssw0rd!""
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://app.xcloud.host/api/v1/sites/{uuid}/ssh"))
.header("Authorization", "Bearer YOUR_TOKEN")
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("""
{
"authentication_mode": "public_key",
"ssh_public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation"
],
"password": "Str0ngP@ssw0rd!"
}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response #
Copy
{
"success": true,
"message": "SSH config updated successfully.",
"data": {
"site_user": "xcloud_example",
"authentication_mode": "public_key",
"ssh_keypairs": [
{
"uuid": "e5f6a7b8-c9d0-1234-efab-567890123456",
"name": "deploy-key",
"fingerprint": "SHA256:AbCdEf1234567890exampleFingerprint"
}
]
}
}
{
"success": false,
"message": "Unauthenticated.",
"data": null
}
{
"success": false,
"message": "This action is unauthorized. Your token is missing the required scope.",
"data": null
}
{
"success": false,
"message": "Not found.",
"data": null
}
{
"success": false,
"message": "The given data was invalid.",
"data": null,
"errors": {
"domain": [
"The domain field is required when mode is live."
]
}
}
Updates the SSH/SFTP authentication configuration for the site. When authentication_mode is public_key, provide ssh_public_keys. When authentication_mode is password, provide password. This is an asynchronous operation. Requires the write:sites scope.
Path Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
uuid | string (uuid) | Required | UUID of the site |
Request Body #
Content type: application/json — required
| Field | Type | Required | Description |
|---|---|---|---|
authentication_mode | string | Required | The authentication mode to use for SSH/SFTP access. Allowed: public_key, password |
ssh_public_keys | array of string | Optional | SSH public keys to authorize. Required when `authentication_mode` is `public_key`. |
password | string | Optional | Password for SSH/SFTP access. Required when `authentication_mode` is `password`. |
Example request
Copy
{
"authentication_mode": "public_key",
"ssh_public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@workstation"
],
"password": "Str0ngP@ssw0rd!"
}
Responses #
200 — SSH/SFTP configuration updated #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional | |
data | object | Optional | |
data.site_user | string | Optional | |
data.authentication_mode | string | Optional | Allowed: public_key, password |
data.ssh_keypairs | array of object | Optional |
Example 200 response
Copy
{
"success": true,
"message": "SSH config updated successfully.",
"data": {
"site_user": "xcloud_example",
"authentication_mode": "public_key",
"ssh_keypairs": [
{
"uuid": "e5f6a7b8-c9d0-1234-efab-567890123456",
"name": "deploy-key",
"fingerprint": "SHA256:AbCdEf1234567890exampleFingerprint"
}
]
}
}
401 — Missing or invalid authentication token #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 401 response
Copy
{
"success": false,
"message": "Unauthenticated.",
"data": null
}
403 — Token lacks the required scope #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 403 response
Copy
{
"success": false,
"message": "This action is unauthorized. Your token is missing the required scope.",
"data": null
}
404 — Resource not found or not accessible to your Team #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 404 response
Copy
{
"success": false,
"message": "Not found.",
"data": null
}
422 — Request validation failed #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional | |
errors | object | Optional |
Example 422 response
Copy
{
"success": false,
"message": "The given data was invalid.",
"data": null,
"errors": {
"domain": [
"The domain field is required when mode is live."
]
}
}
