> ## 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.

# Export Sitemap Pages

> Download every page matching the supplied filters as CSV or XLSX. Uses the same filters as the list endpoint but skips pagination.

With `include_metrics=true` (the default), each row also includes totals over the selected date range for `agent_traffic`, `citations`, and `ai_referrals`, plus a percent-change column comparing the first and last buckets of the range — matching the totals and trend percentages shown in the sitemap UI.

Limits:
- Maximum 10,000 rows per export.
- Maximum 366-day window for `start_date`/`end_date`.

The response sets `Content-Disposition` with a `sitemap-{brand_id}-{YYYY-MM-DD}.{csv|xlsx}` filename.



## OpenAPI

````yaml /api-reference/openapi.json get /{brand_id}/sitemap/export
openapi: 3.1.0
info:
  title: Scrunch Data API
  version: 0.1.0
servers:
  - url: https://api.scrunchai.com/v1
security: []
paths:
  /{brand_id}/sitemap/export:
    get:
      tags:
        - sitemap
      summary: Export Sitemap Pages
      description: >-
        Download every page matching the supplied filters as CSV or XLSX. Uses
        the same filters as the list endpoint but skips pagination.


        With `include_metrics=true` (the default), each row also includes totals
        over the selected date range for `agent_traffic`, `citations`, and
        `ai_referrals`, plus a percent-change column comparing the first and
        last buckets of the range — matching the totals and trend percentages
        shown in the sitemap UI.


        Limits:

        - Maximum 10,000 rows per export.

        - Maximum 366-day window for `start_date`/`end_date`.


        The response sets `Content-Disposition` with a
        `sitemap-{brand_id}-{YYYY-MM-DD}.{csv|xlsx}` filename.
      operationId: exportSitemapPages
      parameters:
        - name: brand_id
          in: path
          required: true
          schema:
            type: integer
            title: Brand Id
            description: The unique identifier for the brand.
          description: The unique identifier for the brand.
        - name: format
          in: query
          required: false
          schema:
            type: string
            enum:
              - csv
              - xlsx
            default: csv
            description: >-
              Output format. `csv` returns a UTF-8 (BOM) CSV stream. `xlsx`
              returns a binary Excel workbook.
            title: Format
          description: >-
            Output format. `csv` returns a UTF-8 (BOM) CSV stream. `xlsx`
            returns a binary Excel workbook.
        - name: mapped_site_id
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: >-
              Explicit sitemap (mapped site) identifier to export. Defaults to
              the latest finished crawl for the brand and optional `domain`.
            title: Mapped Site Id
          description: >-
            Explicit sitemap (mapped site) identifier to export. Defaults to the
            latest finished crawl for the brand and optional `domain`.
        - name: domain
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Filter to a specific domain when the brand has multiple registered
              sites.
            title: Domain
          description: >-
            Filter to a specific domain when the brand has multiple registered
            sites.
        - name: max_depth
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 0
              - type: 'null'
            description: Maximum URL path depth to include. `0` returns root pages only.
            title: Max Depth
          description: Maximum URL path depth to include. `0` returns root pages only.
        - name: path_prefix
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by segment-aligned URL path prefix.
            title: Path Prefix
          description: Filter by segment-aligned URL path prefix.
        - name: is_priority
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Filter to (or exclude) priority pages.
            title: Is Priority
          description: Filter to (or exclude) priority pages.
        - name: has_optimized_content
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Filter to (or exclude) pages with active AXP optimized content.
            title: Has Optimized Content
          description: Filter to (or exclude) pages with active AXP optimized content.
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Case-insensitive substring match against the page URL or title.
            title: Search
          description: Case-insensitive substring match against the page URL or title.
        - name: include_metrics
          in: query
          required: false
          schema:
            type: boolean
            default: true
            description: >-
              Include per-page totals and percent-change columns for
              `agent_traffic`, `citations`, and `ai_referrals` over the selected
              date range.
            title: Include Metrics
          description: >-
            Include per-page totals and percent-change columns for
            `agent_traffic`, `citations`, and `ai_referrals` over the selected
            date range.
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            description: Metrics start date (YYYY-MM-DD). Defaults to 30 days ago.
            title: Start Date
          description: Metrics start date (YYYY-MM-DD). Defaults to 30 days ago.
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            description: Metrics end date (YYYY-MM-DD). Defaults to today.
            title: End Date
          description: Metrics end date (YYYY-MM-DD). Defaults to today.
      responses:
        '200':
          description: Streamed export file.
          content:
            text/csv:
              schema:
                type: string
                description: UTF-8 (BOM) CSV. First row is the column header.
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
                description: XLSX workbook.
        '400':
          description: Invalid date range, or export would exceed the 10,000-row cap.
        '404':
          description: No matching sitemap crawl found for this brand.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer:
            - query
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````