Skip to content

Commit d012cdb

Browse files
fix: update brand-vs-competitors API doc to reflect single-query and aggregate mode
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 29f2e35 commit d012cdb

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

docs/llmo-brandalf-apis/brand-vs-competitors-api.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Brand vs Competitors API
22

3-
Returns aggregated competitor mention/citation data for a site. Internally performs two PostgREST queries: first discovers execution dates from `brand_presence_executions`, then queries the `brand_vs_competitors_by_date` view with those dates.
3+
Returns aggregated competitor mention/citation data for a site. Queries the `brand_vs_competitors_by_date` view directly with date-range filters. Supports an `aggregate` mode that rolls up across category/region for chart-ready totals.
44

55
---
66

@@ -75,6 +75,8 @@ Category/region filters still apply *before* aggregation, so `aggregate=true&cat
7575

7676
## Response Format
7777

78+
**Default** (per category/region):
79+
7880
```json
7981
{
8082
"competitorData": [
@@ -94,6 +96,25 @@ Category/region filters still apply *before* aggregation, so `aggregate=true&cat
9496
}
9597
```
9698

99+
**With `aggregate=true`** (rolled up — no `categoryName`/`regionCode`):
100+
101+
```json
102+
{
103+
"competitorData": [
104+
{
105+
"siteId": "c2473d89-e997-458d-a86d-b4096649c12b",
106+
"brandId": "019cb903-1184-7f92-8325-f9d1176af316",
107+
"brandName": "Acme Corp",
108+
"model": "chatgpt",
109+
"executionDate": "2026-03-01",
110+
"competitor": "Competitor Inc",
111+
"totalMentions": 120,
112+
"totalCitations": 18
113+
}
114+
]
115+
}
116+
```
117+
97118
---
98119

99120
## Error Responses

0 commit comments

Comments
 (0)