---
title: "Get Domains Report"
method: POST
path: "/reports/domains"
tags: ["Reports"]
---

# Get Domains Report

`POST /reports/domains`

Get a report on Source Domains.

## Aggregation Formulas

When aggregating results across multiple rows/dimensions, use the following formulas:

- **citation_rate**: `sum(citation_count) / sum(retrieval_count)`
- **retrieval_rate**: `sum(retrieval_count) / sum(total_chat_count)`
- **retrieval_percentage**: `sum(retrieved_chat_count) / sum(total_chat_count)`

## `filters` vs `having`

`filters` are **pre-aggregation** row filters (applied as WHERE before GROUP BY) on the source-row table. Allowed fields: `model_id` (deprecated), `model_channel_id`, `country_code`, `prompt_id`, `tag_id`, `topic_id`, `chat_id`, `domain`, `domain_classification`, `url`, `url_classification`, `mentioned_brand_id`, `mentioned_brand_count`, `gap`.
- Population (`model_id`, `model_channel_id`, `country_code`, `prompt_id`, `tag_id`, `topic_id`, `chat_id`) shrink both numerator and denominator (`total_chat_count`).
- Source-side (`domain`, `domain_classification`, `url`, `url_classification`) and per-row mentioned-brand predicates (`mentioned_brand_id`, `mentioned_brand_count`, `gap`) shrink the source-row scope feeding aggregation. `total_chat_count` is computed from a chat-level table that doesn't carry these columns, so the denominator narrows only on chat-level fields.

`having` are **post-aggregation** row filters (applied as HAVING after GROUP BY). Allowed fields: `model_id` (deprecated), `model_channel_id`, `country_code`, `prompt_id`, `tag_id`, `topic_id`, `chat_id`, `domain`, `domain_classification`, `mentioned_brand_id`, `mentioned_brand_count`, `gap`. They select which aggregated rows are returned and do not affect denominators.

## Query parameters

- `project_id` string — Required if using a company api key

## Request body

- object
  - `project_id` string — Required if using a company api key
  - `limit` number
  - `offset` number
  - `start_date` string, date — full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21
  - `end_date` string, date — full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21
  - `dimensions` string[] — Dimensions to break down the report by.
  - `filters` union[] — Pre-aggregation row filters (applied as WHERE before grouping). Allowed fields: `model_id` (deprecated), `model_channel_id`, `country_code`, `prompt_id`, `tag_id`, `topic_id`, `chat_id`, `domain`, `domain_classification`, `url`, `url_classification`, `mentioned_brand_id`, `mentioned_brand_count`, `gap`. Population fields (model/country/prompt/tag/topic/chat) shrink both numerator and denominator. Source-side fields and per-row mentioned-brand predicates shrink the source-row scope feeding aggregation; `total_chat_count` comes from a chat-level table that doesn't carry these columns, so they narrow the numerator only. Multiple filters are AND'd.
    - union
      - object — Deprecated: use model_channel_id filter instead
        - `field` 'model_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'model_channel_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'tag_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'topic_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'prompt_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'country_code', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'chat_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'domain', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'domain_classification', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required — Built-in classification (CORPORATE, EDITORIAL, INSTITUTIONAL, OTHER, REFERENCE, UGC, COMPETITOR, OWN, RELATED) or a custom domain classification name.
      - object
        - `field` 'url', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'url_classification', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required — Built-in classification (HOMEPAGE, CATEGORY_PAGE, PRODUCT_PAGE, LISTICLE, COMPARISON, PROFILE, ALTERNATIVE, DISCUSSION, HOW_TO_GUIDE, ARTICLE, OTHER) or a custom URL classification name.
      - object
        - `field` 'mentioned_brand_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'mentioned_brand_count', required
        - `operator` 'gt' | 'gte' | 'lt' | 'lte', required
        - `value` integer, required
      - object
        - `field` 'gap', required
        - `operator` 'gt' | 'gte' | 'lt' | 'lte', required
        - `value` integer, required
  - `having` union[] — Post-aggregation row filters (applied as HAVING after grouping). Select which aggregated domain rows are returned. Allowed fields: `model_id` (deprecated), `model_channel_id`, `country_code`, `prompt_id`, `tag_id`, `topic_id`, `chat_id`, `domain`, `domain_classification`, `mentioned_brand_id`, `mentioned_brand_count`, `gap` — population fields require the matching value in `dimensions`. Multiple filters are AND'd.
    - union
      - object — Deprecated: use model_channel_id filter instead
        - `field` 'model_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'model_channel_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'tag_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'topic_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'prompt_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'country_code', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'chat_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'domain', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'domain_classification', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required — Built-in classification (CORPORATE, EDITORIAL, INSTITUTIONAL, OTHER, REFERENCE, UGC, COMPETITOR, OWN, RELATED) or a custom domain classification name.
      - object
        - `field` 'mentioned_brand_id', required
        - `operator` 'in' | 'not_in', required
        - `values` string[], required
      - object
        - `field` 'mentioned_brand_count', required
        - `operator` 'gt' | 'gte' | 'lt' | 'lte', required
        - `value` integer, required
      - object
        - `field` 'gap', required
        - `operator` 'gt' | 'gte' | 'lt' | 'lte', required
        - `value` integer, required
  - `order_by` object[] — Sort results by one or more fields. Multiple entries create a multi-key sort. Direction defaults to desc. When omitted, a default ordering is applied.
    - `field` 'citation_rate' | 'retrieval_count' | 'citation_count' | 'date' | 'week' | 'month', required
    - `direction` 'asc' | 'desc'

## Response `200`

Success

- object — Success
  - `data` object[], required
    - `domain` string, required
    - `classification` string, nullable, required — Built-in classification (CORPORATE, EDITORIAL, INSTITUTIONAL, OTHER, REFERENCE, UGC, COMPETITOR, OWN, RELATED) or the name of a custom domain classification.
    - `prompt` object
      - `id` string, required
    - `model` object — Deprecated: use model_channel instead
      - `id` string, required
    - `model_channel` object
      - `id` string, required
    - `tag` object
      - `id` string, required
    - `topic` object
      - `id` string, required
    - `country_code` string
    - `chat` object
      - `id` string, required
    - `date` string
    - `week` string — Start (Monday) of the ISO week bucket.
    - `month` string — First day of the month bucket.
    - `usage_rate` number, required — Deprecated: use retrieved_percentage or retrieval_rate instead
    - `citation_avg` number, required — Deprecated: use citation_rate instead
    - `retrieved_percentage` number, required
    - `retrieval_rate` number, required
    - `citation_rate` number, required
    - `retrieval_count` number, required — Total number of distinct URL retrievals from this domain across all chats
    - `citation_count` number, required — Total number of citations from this domain
    - `retrieved_chat_count` number, required — Number of distinct chats in which at least one URL from this domain was retrieved
    - `total_chat_count` number, required — Total number of chats in scope for this row, used as the denominator for `retrieval_rate` and `retrieval_percentage`. Pre-aggregation `filters` shrink this count; post-aggregation `having` filters (e.g. `domain`, `domain_classification`) do not.
    - `mentioned_brands` object[], required — Brand IDs mentioned alongside URLs from this domain
      - `id` string, required

---

[API](https://skmtc.net/peec/apis/peec-ai-customer-api.md) · [All operations](https://skmtc.net/peec/apis/peec-ai-customer-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/peec/peec-ai-customer-api/revisions/92840a1bffa7/schema)
