Code Samples #
Copy
curl --request GET \
--url 'https://app.xcloud.host/api/v1/sites/{uuid}/web-rules' \
--header 'Authorization: Bearer YOUR_TOKEN'
const response = await fetch('https://app.xcloud.host/api/v1/sites/{uuid}/web-rules', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
});
const data = await response.json();
console.log(data);
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.get("https://app.xcloud.host/api/v1/sites/{uuid}/web-rules", headers=headers)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://app.xcloud.host/api/v1/sites/{uuid}/web-rules',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_TOKEN'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("GET"), "https://app.xcloud.host/api/v1/sites/{uuid}/web-rules");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
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}/web-rules"))
.header("Authorization", "Bearer YOUR_TOKEN")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response #
Copy
{
"success": true,
"message": "Web rules retrieved successfully.",
"data": {
"items": [
{
"uuid": "11aa22bb-33cc-44dd-55ee-66ff77aa88bb",
"rule_type": "header",
"category": "headers",
"config": {
"action": "set",
"header_name": "X-Frame-Options",
"header_value": "SAMEORIGIN",
"always_apply": true
},
"sort_order": 0,
"created_at": "2026-01-10T00:00:00Z",
"updated_at": "2026-01-10T00:00:00Z"
},
{
"uuid": "22bb33cc-44dd-55ee-66ff-77aa88bb99cc",
"rule_type": "redirect",
"category": "redirects",
"config": {
"source": "/old",
"destination": "https://example.com/new",
"redirect_type": 301,
"keep_query_string": true
},
"sort_order": 1,
"created_at": "2026-01-11T00:00:00Z",
"updated_at": "2026-01-11T00:00:00Z"
}
],
"counts": {
"headers": 1,
"redirects": 1,
"total": 2
}
}
}
{
"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
}
Returns the custom web-Server rules attached to a site: HTTP header rules (set or unset response headers) and redirect rules (with optional conditions on host, URI, Query arg, or device). Returned in render order (sort_order) then newest-first. Requires the read:sites scope.
Path Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
uuid | string (uuid) | Required | UUID of the site |
Responses #
200 — List of web rules #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional | |
data | object | Optional | |
data.items | array of object | Optional | |
data.counts | object | Optional | |
data.counts.headers | integer | Optional | |
data.counts.redirects | integer | Optional | |
data.counts.total | integer | Optional |
Example 200 response
Copy
{
"success": true,
"message": "Web rules retrieved successfully.",
"data": {
"items": [
{
"uuid": "11aa22bb-33cc-44dd-55ee-66ff77aa88bb",
"rule_type": "header",
"category": "headers",
"config": {
"action": "set",
"header_name": "X-Frame-Options",
"header_value": "SAMEORIGIN",
"always_apply": true
},
"sort_order": 0,
"created_at": "2026-01-10T00:00:00Z",
"updated_at": "2026-01-10T00:00:00Z"
},
{
"uuid": "22bb33cc-44dd-55ee-66ff-77aa88bb99cc",
"rule_type": "redirect",
"category": "redirects",
"config": {
"source": "/old",
"destination": "https://example.com/new",
"redirect_type": 301,
"keep_query_string": true
},
"sort_order": 1,
"created_at": "2026-01-11T00:00:00Z",
"updated_at": "2026-01-11T00:00:00Z"
}
],
"counts": {
"headers": 1,
"redirects": 1,
"total": 2
}
}
}
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
}
