curl --request POST \
--url https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "<string>",
"approve_all": false,
"reviews": [
{
"id": "<string>"
}
]
}
'import requests
url = "https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply"
payload = {
"path": "<string>",
"approve_all": False,
"reviews": [{ "id": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({path: '<string>', approve_all: false, reviews: [{id: '<string>'}]})
};
fetch('https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply', 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.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply",
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([
'path' => '<string>',
'approve_all' => false,
'reviews' => [
[
'id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"approve_all\": false,\n \"reviews\": [\n {\n \"id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"approve_all\": false,\n \"reviews\": [\n {\n \"id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"approve_all\": false,\n \"reviews\": [\n {\n \"id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>",
"status": "pending",
"summary": {
"transformed": 123,
"enriched": 123,
"removed": 123,
"tokens_after": 123
},
"chunks": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Apply Page Optimization
Record that a page’s optimization was acted on off-platform — for when the change was made outside Scrunch (e.g. in Sitecore), so no Scrunch review is needed.
Send exactly one of: approve_all: true to accept every changed block, or a reviews list with per-block verdicts by chunk id (approved keeps our version, rejected keeps the original). A reviews list can be partial — un-verdicted blocks keep the run pending, so blocks can be resolved across several calls. The page is acknowledged automatically once every changed block has a verdict, matching the in-app flow that can’t close a page with an unresolved block.
Applies to the page’s latest run. Returns the run (same shape as the optimization endpoint) — acknowledged once complete, otherwise still pending. Returns 422 when neither or both actions are given, 404 when the page has no run, and 409 for an edge-delivery (AXP-active) page — those go through the edge staging workflow.
curl --request POST \
--url https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "<string>",
"approve_all": false,
"reviews": [
{
"id": "<string>"
}
]
}
'import requests
url = "https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply"
payload = {
"path": "<string>",
"approve_all": False,
"reviews": [{ "id": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({path: '<string>', approve_all: false, reviews: [{id: '<string>'}]})
};
fetch('https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply', 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.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply",
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([
'path' => '<string>',
'approve_all' => false,
'reviews' => [
[
'id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"approve_all\": false,\n \"reviews\": [\n {\n \"id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"approve_all\": false,\n \"reviews\": [\n {\n \"id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrunchai.com/v1/{brand_id}/site-diagnostics/optimization/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"approve_all\": false,\n \"reviews\": [\n {\n \"id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>",
"status": "pending",
"summary": {
"transformed": 123,
"enriched": 123,
"removed": 123,
"tokens_after": 123
},
"chunks": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Body for acknowledging a page's optimization as acted on off-platform.
Exactly one of approve_all or reviews — closing a page is a declared action, so there's
no implicit "accept everything" default.
The page path, e.g. /about.
1Accept every changed block. Mutually exclusive with reviews.
Per-block verdicts, keyed by chunk id — a verdict for every changed block (approved keeps our version, rejected keeps the original). Mutually exclusive with approve_all.
Show child attributes
Show child attributes
Response
Successful Response
Endpoint 2 response: a page's latest optimization run with before/after chunks.
pending, completed, staged, deployed, retired, outdated, acknowledged Per-category chunk counts and the optimized token total for a run.
Show child attributes
Show child attributes
Show child attributes
Show child attributes