> ## 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 Opportunity Type Detail

> One opportunity type's detail: the whole-type header (projected lift and per-state page counts) plus one paginated window of its affected pages, each with its pipeline `state` and the before/after content chunks inline.

Use `state` to filter the page window (`all`, `pending`, `reviewed`, `staged`, `deployed`) and `limit`/`offset` to page through it — the header counts always span the whole type. Returns 404 when the brand has no opportunities of this type.



## OpenAPI

````yaml /api-reference/openapi.json get /{brand_id}/opportunities/by-type/{best_practice_id}
openapi: 3.1.0
info:
  title: Scrunch Data API
  version: 0.1.0
servers:
  - url: https://api.scrunchai.com/v1
security: []
paths:
  /{brand_id}/opportunities/by-type/{best_practice_id}:
    get:
      tags:
        - opportunities
      summary: Get Opportunity Type Detail
      description: >-
        One opportunity type's detail: the whole-type header (projected lift and
        per-state page counts) plus one paginated window of its affected pages,
        each with its pipeline `state` and the before/after content chunks
        inline.


        Use `state` to filter the page window (`all`, `pending`, `reviewed`,
        `staged`, `deployed`) and `limit`/`offset` to page through it — the
        header counts always span the whole type. Returns 404 when the brand has
        no opportunities of this type.
      operationId: getOpportunityTypeDetail
      parameters:
        - name: brand_id
          in: path
          required: true
          schema:
            type: integer
            title: Brand Id
        - name: best_practice_id
          in: path
          required: true
          schema:
            type: string
            title: Best Practice Id
        - name: state
          in: query
          required: false
          schema:
            enum:
              - all
              - pending
              - reviewed
              - staged
              - deployed
            type: string
            description: Restrict the affected-page window to this pipeline state.
            default: all
            title: State
          description: Restrict the affected-page window to this pipeline state.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 25
            title: Limit
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
            title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpportunityTypeDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer:
            - query
components:
  schemas:
    OpportunityTypeDetail:
      properties:
        best_practice_id:
          type: string
          title: Best Practice Id
        name:
          type: string
          title: Name
        checking:
          type: string
          title: Checking
        bucket:
          type: string
          enum:
            - hygiene
            - transformation
            - enrichment
          title: Bucket
        action:
          type: string
          title: Action
        site_impact_pp:
          anyOf:
            - type: number
            - type: 'null'
          title: Site Impact Pp
        site_impact_unavailable_reason:
          anyOf:
            - type: string
              enum:
                - not_in_scored_run
                - no_scored_run
            - type: 'null'
          title: Site Impact Unavailable Reason
        metric:
          type: string
          enum:
            - citeability
            - retrievability
          title: Metric
        page_count:
          type: integer
          title: Page Count
        pending_count:
          type: integer
          title: Pending Count
        reviewed_count:
          type: integer
          title: Reviewed Count
        staged_count:
          type: integer
          title: Staged Count
        deployed_count:
          type: integer
          title: Deployed Count
        offset:
          type: integer
          title: Offset
        limit:
          type: integer
          title: Limit
        filtered_total:
          type: integer
          title: Filtered Total
        pages:
          items:
            $ref: '#/components/schemas/OpportunityTypePageReview'
          type: array
          title: Pages
      type: object
      required:
        - best_practice_id
        - name
        - checking
        - bucket
        - action
        - site_impact_pp
        - metric
        - page_count
        - pending_count
        - reviewed_count
        - staged_count
        - deployed_count
        - offset
        - limit
        - filtered_total
        - pages
      title: OpportunityTypeDetail
      description: >-
        One opportunity type's detail view: catalog header, per-state counts,
        and a page of its

        affected pages. The header and every count span the WHOLE type
        (independent of the state filter

        and pagination); only `pages` is the sliced, state-filtered window that
        carries chunk diffs.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OpportunityTypePageReview:
      properties:
        opportunity_id:
          type: string
          title: Opportunity Id
        target_url:
          type: string
          title: Target Url
        path:
          type: string
          title: Path
        run_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Run Id
        state:
          type: string
          enum:
            - pending
            - reviewed
            - staged
            - deployed
            - rejected
          title: State
        expected_lift_pp:
          type: number
          title: Expected Lift Pp
        chunks:
          items:
            $ref: '#/components/schemas/OpportunityTypeChunkDiff'
          type: array
          title: Chunks
      type: object
      required:
        - opportunity_id
        - target_url
        - path
        - state
        - expected_lift_pp
      title: OpportunityTypePageReview
      description: >-
        A page affected by one opportunity type, with its optimizer_v2 run state
        and the type's diffs.
    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
    OpportunityTypeChunkDiff:
      properties:
        chunk_id:
          type: string
          title: Chunk Id
        original_html:
          type: string
          title: Original Html
        optimized_html:
          type: string
          title: Optimized Html
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
        verdict:
          anyOf:
            - type: string
              enum:
                - approved
                - rejected
            - type: 'null'
          title: Verdict
      type: object
      required:
        - chunk_id
        - original_html
        - optimized_html
      title: OpportunityTypeChunkDiff
      description: >-
        One before/after block of a page, scoped to the opportunity type under
        review.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

## Related topics

- [List Opportunity Types](/api-reference/opportunities/list-opportunity-types.md)
- [Opportunities API: Ranked fixes by projected site lift](/api-reference/opportunities/overview.md)
- [Get Site Audit Score](/api-reference/audit-scores/get-site-audit-score.md)
