> ## Documentation Index
> Fetch the complete documentation index at: https://developers.scrunch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Page Optimization Detail

> Fetch the latest optimization run for one page: a summary of how many content blocks were transformed / enriched / removed, the optimized token total, and every block's before/after content.

By default only **reviewed** runs are returned (`completed`, `staged`, `deployed`, `acknowledged`) — i.e. optimizations a human accepted — not raw unreviewed optimizer output. Pass one or more `status` params to opt into other lifecycle states (e.g. `?status=pending`). Each chunk carries its own `status`, so a `rejected` block (its `after` was not accepted) is distinguishable from an `approved` one. Returns 404 when the page has no run in the requested statuses.



## OpenAPI

````yaml /api-reference/openapi.json get /{brand_id}/site-diagnostics/optimization
openapi: 3.1.0
info:
  title: Scrunch Data API
  version: 0.1.0
servers:
  - url: https://api.scrunchai.com/v1
security: []
paths:
  /{brand_id}/site-diagnostics/optimization:
    get:
      tags:
        - site-diagnostics
      summary: Get Page Optimization Detail
      description: >-
        Fetch the latest optimization run for one page: a summary of how many
        content blocks were transformed / enriched / removed, the optimized
        token total, and every block's before/after content.


        By default only **reviewed** runs are returned (`completed`, `staged`,
        `deployed`, `acknowledged`) — i.e. optimizations a human accepted — not
        raw unreviewed optimizer output. Pass one or more `status` params to opt
        into other lifecycle states (e.g. `?status=pending`). Each chunk carries
        its own `status`, so a `rejected` block (its `after` was not accepted)
        is distinguishable from an `approved` one. Returns 404 when the page has
        no run in the requested statuses.
      operationId: getSiteDiagnosticsOptimization
      parameters:
        - name: brand_id
          in: path
          required: true
          schema:
            type: integer
            title: Brand Id
        - name: path
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            title: Path
            description: The page path, e.g. `/about`.
          description: The page path, e.g. `/about`.
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  type: string
                  enum:
                    - pending
                    - completed
                    - staged
                    - deployed
                    - retired
                    - outdated
                    - acknowledged
              - type: 'null'
            description: 'Restrict to these run statuses. Default: reviewed runs only.'
            title: Status
          description: 'Restrict to these run statuses. Default: reviewed runs only.'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PathOptimization'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer:
            - query
components:
  schemas:
    PathOptimization:
      properties:
        path:
          type: string
          title: Path
        status:
          type: string
          enum:
            - pending
            - completed
            - staged
            - deployed
            - retired
            - outdated
            - acknowledged
          title: Status
        summary:
          $ref: '#/components/schemas/OptimizationSummary'
        chunks:
          items:
            $ref: '#/components/schemas/OptimizationChunk'
          type: array
          title: Chunks
          default: []
      type: object
      required:
        - path
        - status
        - summary
      title: PathOptimization
      description: >-
        Endpoint 2 response: a page's latest optimization run with before/after
        chunks.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OptimizationSummary:
      properties:
        transformed:
          type: integer
          title: Transformed
        enriched:
          type: integer
          title: Enriched
        removed:
          type: integer
          title: Removed
        tokens_after:
          type: integer
          title: Tokens After
      type: object
      required:
        - transformed
        - enriched
        - removed
        - tokens_after
      title: OptimizationSummary
      description: Per-category chunk counts and the optimized token total for a run.
    OptimizationChunk:
      properties:
        id:
          type: string
          title: Id
        order:
          type: integer
          title: Order
        category:
          anyOf:
            - type: string
              enum:
                - enriched
                - transformed
                - removed
            - type: 'null'
          title: Category
        status:
          anyOf:
            - type: string
              enum:
                - pending
                - approved
                - rejected
            - type: 'null'
          title: Status
        before:
          items:
            $ref: '#/components/schemas/ContentNode'
          type: array
          title: Before
          default: []
        after:
          items:
            $ref: '#/components/schemas/ContentNode'
          type: array
          title: After
          default: []
      type: object
      required:
        - id
        - order
      title: OptimizationChunk
      description: >-
        One content block's before/after. `category` is null for an unchanged
        block; `status` is the

        reviewer's verdict (`approved`/`rejected`) or `pending` when the run
        isn't reviewed — a rejected

        block's `after` was NOT accepted, so it must be distinguishable from an
        approved one.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ContentNode:
      properties:
        type:
          type: string
          const: html
          title: Type
          default: html
        text:
          type: string
          title: Text
      type: object
      required:
        - text
      title: ContentNode
      description: >-
        A single renderable unit of content. Only `html` is supported (per the
        RFC).
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

## Related topics

- [Apply Page Optimization](/api-reference/site-diagnostics/apply-page-optimization.md)
- [List Opportunity Types](/api-reference/opportunities/list-opportunity-types.md)
- [Site Diagnostics API: Per-page findings and optimization runs](/api-reference/site-diagnostics/overview.md)
