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

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Breakdown

> Ranks the values of one dimension for a period: top pages, entry and exit pages, sources, referrers, channels, UTM campaign fields, countries, regions, cities, browsers, operating systems, devices, languages, custom events or AI assistants. Each row has visitors, pageviews, sessions, bounce rate, average duration, revenue, conversions, conversion rate, its share of all visitors, and its change in visitors when `compare` is set. Use `sort` to rank by revenue or conversion rate instead of visitors ("which campaign earns the most"), `search` to match part of a value, and a row's `key` as a filter value in other calls. Takes `range` (a preset) or `from` and `to`, optional `compare` and `filters`. Includes days the site imported from another tool (its Plausible history: daily totals, visitors counted per day) unless `imported` is false; hostnames, regions and cities start on the first recorded day. Money is integer minor units (cents) in `currency`; rates are 0..1; durations are seconds; timestamps are ISO-8601 UTC.



## OpenAPI

````yaml /api-reference/openapi.json get /sites/{siteId}/breakdown/{dimension}
openapi: 3.1.0
info:
  title: CrispStats API
  version: 1.0.0
  description: >-
    Read-only access to a site's analytics. Authenticate with an API key as a
    bearer token (`Authorization: Bearer cs_sk_…`); the demo site `demo` can be
    read without one. Money is integer minor units in the stated `currency`,
    rates are 0..1, durations are seconds and timestamps are ISO-8601 UTC.
    Limits: a daily allowance per key from the plan, plus 20 requests per 10
    seconds; without a key, 500 requests a day. Every key in a workspace also
    counts toward a workspace ceiling of 5 times the plan's daily allowance,
    shared with the MCP server, where each JSON-RPC request in a POST counts
    once and a batch may hold at most 20 requests. Every response carries
    `X-RateLimit-*` headers, and a 429 carries `Retry-After`.
servers:
  - url: https://crispstats.com/api/v1
security:
  - apiKey: []
  - {}
tags:
  - name: Sites
  - name: Analytics
  - name: Raw data
paths:
  /sites/{siteId}/breakdown/{dimension}:
    get:
      tags:
        - Analytics
      summary: Breakdown
      description: >-
        Ranks the values of one dimension for a period: top pages, entry and
        exit pages, sources, referrers, channels, UTM campaign fields,
        countries, regions, cities, browsers, operating systems, devices,
        languages, custom events or AI assistants. Each row has visitors,
        pageviews, sessions, bounce rate, average duration, revenue,
        conversions, conversion rate, its share of all visitors, and its change
        in visitors when `compare` is set. Use `sort` to rank by revenue or
        conversion rate instead of visitors ("which campaign earns the most"),
        `search` to match part of a value, and a row's `key` as a filter value
        in other calls. Takes `range` (a preset) or `from` and `to`, optional
        `compare` and `filters`. Includes days the site imported from another
        tool (its Plausible history: daily totals, visitors counted per day)
        unless `imported` is false; hostnames, regions and cities start on the
        first recorded day. Money is integer minor units (cents) in `currency`;
        rates are 0..1; durations are seconds; timestamps are ISO-8601 UTC.
      operationId: getBreakdown
      parameters:
        - name: siteId
          in: path
          required: true
          description: >-
            The site's id, from GET /sites. `demo` is a public demo site that
            needs no key.
          schema:
            type: string
          example: demo
        - name: dimension
          in: path
          required: true
          description: The dimension to break down by.
          schema:
            type: string
            enum:
              - page
              - entry_page
              - exit_page
              - hostname
              - channel
              - source
              - referrer
              - utm_source
              - utm_medium
              - utm_campaign
              - utm_term
              - utm_content
              - country
              - region
              - city
              - browser
              - os
              - device
              - language
              - event
              - ai_assistant
        - name: range
          in: query
          required: false
          description: >-
            Preset period: today (today), yesterday (yesterday), 24h (last 24
            hours), 7d (last 7 days), 30d (last 30 days), 90d (last 90 days),
            mtd (month to date), last_month (last month), ytd (year to date),
            12m (last 12 months), all (all time). Defaults to 30d. Use either
            this or from and to.
          schema:
            type: string
            enum:
              - today
              - yesterday
              - 24h
              - 7d
              - 30d
              - 90d
              - mtd
              - last_month
              - ytd
              - 12m
              - all
        - name: from
          in: query
          required: false
          description: >-
            Start day of a custom period, YYYY-MM-DD, inclusive, UTC. Requires
            `to`.
          schema:
            type: string
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
        - name: to
          in: query
          required: false
          description: >-
            End day of a custom period, YYYY-MM-DD, inclusive, UTC. Requires
            `from`.
          schema:
            type: string
            format: date
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
        - name: compare
          in: query
          required: false
          description: >-
            Also return the comparison period: "previous" (the period just
            before, same length) or "year" (same period a year earlier).
            Defaults to none.
          schema:
            type: string
            enum:
              - previous
              - year
              - none
        - name: filter
          in: query
          required: false
          description: >-
            Narrow the data. Repeat the parameter to add filters; all must
            match. Format: dimension:op:value, for example country:is:DE.
            Dimensions: page, entry_page, exit_page, hostname, channel, source,
            referrer, utm_source, utm_medium, utm_campaign, utm_term,
            utm_content, country, region, city, browser, os, device, language,
            event, ai_assistant. Operators: is, is_not, contains.
          schema:
            type: array
            items:
              type: string
          style: form
          explode: true
          example:
            - country:is:DE
        - name: imported
          in: query
          required: false
          description: >-
            Include days imported from another tool (a site's Plausible history,
            daily totals before the first day this site recorded itself).
            Defaults to true. Pass false for recorded days only. Imported days
            are always left out while a filter is on.
          schema:
            type: boolean
        - name: sort
          in: query
          required: false
          description: Metric to rank by, highest first.
          schema:
            default: visitors
            type: string
            enum:
              - visitors
              - pageviews
              - revenue
              - conversionRate
              - bounceRate
        - name: limit
          in: query
          required: false
          description: How many rows to return (1 to 100, default 10).
          schema:
            default: 10
            type: integer
            minimum: 1
            maximum: 100
        - name: offset
          in: query
          required: false
          description: How many rows to skip, for paging.
          schema:
            default: 0
            type: integer
            minimum: 0
            maximum: 100000
        - name: search
          in: query
          required: false
          description: Only values that contain this text.
          schema:
            type: string
            minLength: 1
            maxLength: 100
      responses:
        '200':
          description: >-
            The report. Every report states the period it covers and carries a
            one-sentence `summary`.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Report'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  headers:
    X-RateLimit-Limit:
      description: Requests allowed per day for this caller.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left today.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: When the daily allowance resets, as Unix seconds.
      schema:
        type: integer
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  schemas:
    Report:
      type: object
      description: >-
        A report. The fields depend on the endpoint and are described in its
        description.
      properties:
        range:
          $ref: '#/components/schemas/Range'
        summary:
          type: string
          description: The headline figures in one sentence, already formatted.
      additionalProperties: true
    Range:
      type: object
      required:
        - preset
        - from
        - to
        - label
      properties:
        preset:
          type: string
        from:
          type: string
          format: date-time
          description: Inclusive start.
        to:
          type: string
          format: date-time
          description: Exclusive end.
        label:
          type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - invalid_request
                - unauthorized
                - forbidden
                - not_found
                - method_not_allowed
                - rate_limited
                - internal_error
            message:
              type: string
              description: What went wrong and how to fix it.
            fields:
              type: object
              additionalProperties:
                type: string
              description: 'On validation errors: the problem with each parameter.'
  responses:
    InvalidRequest:
      description: A parameter is missing or not valid. `fields` says which.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request
              message: >-
                range: Invalid option: expected one of
                "today"|"yesterday"|"24h"|"7d"|"30d"|"90d"|"mtd"|"last_month"|"ytd"|"12m"|"all"
    Unauthorized:
      description: No key was sent for a site that needs one, or the key is not valid.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: >-
                That API key is not valid. It may have been revoked or expired.
                Create a new one in your workspace settings, under API keys.
    Forbidden:
      description: The key lacks the read scope or is limited to another site.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: forbidden
              message: That API key is limited to one site, and this is not it.
    NotFound:
      description: The site, funnel or visitor does not exist, or this key cannot read it.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: That site was not found, or this key does not have access to it.
    RateLimited:
      description: The caller is over its rate limit.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Too many requests at once. Wait 4 seconds and try again.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An API key that starts with cs_sk_, created in your workspace settings,
        under API keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.