---
title: "Apply Page Optimization"
method: POST
path: "/{brand_id}/site-diagnostics/optimization/apply"
tags: ["site-diagnostics"]
---

# Apply Page Optimization

`POST /{brand_id}/site-diagnostics/optimization/apply`

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.

## Path parameters

- `brand_id` integer, required

## Request body

- ApplyOptimizationRequest — 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.
  - `path` string, required — The page path, e.g. `/about`.
  - `approve_all` boolean — Accept every changed block. Mutually exclusive with `reviews`.
  - `reviews` OptimizationReview[], nullable — 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`.
    - `id` string, required
    - `status` 'approved' | 'rejected', required

## Response `200`

Successful Response

- PathOptimization — Endpoint 2 response: a page's latest optimization run with before/after chunks.
  - `path` string, required
  - `status` 'pending' | 'completed' | 'staged' | 'deployed' | 'retired' | 'outdated' | 'acknowledged', required
  - `summary` OptimizationSummary, required — Per-category chunk counts and the optimized token total for a run.
    - `transformed` integer, required
    - `enriched` integer, required
    - `removed` integer, required
    - `tokens_after` integer, required
  - `chunks` OptimizationChunk[]
    - `id` string, required
    - `order` integer, required
    - `category` 'enriched' | 'transformed' | 'removed', nullable
    - `status` 'pending' | 'approved' | 'rejected', nullable
    - `before` ContentNode[]
      - `type` 'html'
      - `text` string, required
    - `after` ContentNode[]
      - `type` 'html'
      - `text` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/scrunchai/apis/scrunch-data-api.md) · [All operations](https://skmtc.net/scrunchai/apis/scrunch-data-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/scrunchai/scrunch-data-api/revisions/c4fe20c603a3/schema)
