Code Samples #
Copy
curl --request POST \
--url 'https://app.xcloud.host/api/v1/sites/{uuid}/pagespeed/scan' \
--header 'Authorization: Bearer YOUR_TOKEN'
const response = await fetch('https://app.xcloud.host/api/v1/sites/{uuid}/pagespeed/scan', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
});
const data = await response.json();
console.log(data);
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.post("https://app.xcloud.host/api/v1/sites/{uuid}/pagespeed/scan", headers=headers)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://app.xcloud.host/api/v1/sites/{uuid}/pagespeed/scan',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
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("POST"), "https://app.xcloud.host/api/v1/sites/{uuid}/pagespeed/scan");
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}/pagespeed/scan"))
.header("Authorization", "Bearer YOUR_TOKEN")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response #
Copy
{
"success": true,
"message": "PageSpeed scan queued.",
"data": {
"site": {
"uuid": "1a2b3c4d-5e6f-7890-abcd-1234567890ef",
"name": "my-wordpress-site"
},
"scan_uuid": "f8a9c2d1-1234-4abc-9def-1234567890ab",
"strategies": [
"mobile",
"desktop"
],
"scan_queued_at": "2026-05-14T10:00:00Z"
}
}
{
"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": "A PageSpeed scan is already running for this site. Please wait or retry in a few minutes.",
"data": null
}
Queues a New PageSpeed Insights run for both mobile and desktop strategies. Returns 202 with a scan_uuid that links the two strategy runs. Returns 409 if a scan is already running for this site (within the last 10 minutes). After completion, poll GET /sites/{uuid}/pagespeed for the latest results. Requires the write:sites scope and the site:manage-update Team permission.
Path Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
uuid | string (uuid) | Required | UUID of the site |
Responses #
202 — Scan queued #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional | |
data | object | Optional | |
data.site | object | Optional | |
data.site.uuid | string (uuid) | Optional | |
data.site.name | string | Optional | |
data.scan_uuid | string (uuid) | Optional | |
data.strategies | array of string | Optional | |
data.scan_queued_at | string (date-time) | Optional |
Example 202 response
Copy
{
"success": true,
"message": "PageSpeed scan queued.",
"data": {
"site": {
"uuid": "1a2b3c4d-5e6f-7890-abcd-1234567890ef",
"name": "my-wordpress-site"
},
"scan_uuid": "f8a9c2d1-1234-4abc-9def-1234567890ab",
"strategies": [
"mobile",
"desktop"
],
"scan_queued_at": "2026-05-14T10:00:00Z"
}
}
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
}
409 — A scan is already running #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 409 response
Copy
{
"success": false,
"message": "A PageSpeed scan is already running for this site. Please wait or retry in a few minutes.",
"data": null
}
