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

# Apply Page Optimization

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

## Request

- Base URL: `https://api.scrunchai.com/v1`
- URL: `https://api.scrunchai.com/v1/{brand_id}/site-optimization/optimization/apply`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/scrunch/apis/scrunch-data-api/docs/:brand_id/site-optimization/optimization/apply/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Changes

- **2026-11-03** `e37811b6bc07`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/scrunch/apis/scrunch-data-api/changes/:brand_id/site-optimization/optimization/apply/post.md)

---

[API](https://skmtc.dev/scrunch/apis/scrunch-data-api.md) - [All operations](https://skmtc.dev/scrunch/apis/scrunch-data-api/llms.txt) - [OpenAPI document](https://skmtc.dev/scrunch/apis/scrunch-data-api/revisions/3c6aa69a6595?raw)
