Skip to main content

Channel Groups API

Manage the rules that classify traffic into channels (GA4-style channel grouping). Each rule matches against utm_source, utm_medium, and utm_campaign via regex; the rule with the highest priority that matches wins.

Base path: /channel-groups

Default scope: read. Mutations require write (editor or higher).


List Rules

GET /channel-groups?account_id={account_id}
ParameterTypeDefaultDescription
account_idstringrequiredAccount ID
include_inactivebooleanfalseInclude inactive rules
include_defaultsbooleantrueInclude system-default rules

Response:

{
"success": true,
"data": {
"rules": [
{
"id": 12,
"account_id": "acme",
"channel_name": "Paid Search",
"source_pattern": "google|bing",
"medium_pattern": "cpc|ppc|paid",
"campaign_pattern": null,
"priority": 100,
"is_default": false,
"is_active": true,
"created_at": "2025-01-05T10:00:00Z",
"updated_at": "2025-01-05T10:00:00Z"
}
],
"total": 18,
"default_count": 12,
"custom_count": 6
}
}

Default rules have account_id = null and is_default = true. They cannot be modified or deleted, only overridden via higher-priority custom rules.


Create Rule

POST /channel-groups?account_id={account_id}

Required scope: write (editor or higher)

Request Body:

FieldTypeRequiredDescription
channel_namestringYesChannel name (1-50 chars, e.g. "Paid Social")
source_patternstringNoRegex against utm_source (max 255). Null matches any
medium_patternstringNoRegex against utm_medium (max 255). Null matches any
campaign_patternstringNoRegex against utm_campaign (max 255). Null matches any
priorityintegerNoEvaluation priority 0-1000 (default 50). Higher wins
is_activebooleanNoDefault true

Response (201 Created): full rule object (same shape as list response items).


Get Rule

GET /channel-groups/{rule_id}?account_id={account_id}

Returns the rule or 404 if not found.


Update Rule

PATCH /channel-groups/{rule_id}?account_id={account_id}

Required scope: write

All fields from create are optional. Default (system) rules cannot be modified — attempting returns 403.


Delete Rule

DELETE /channel-groups/{rule_id}?account_id={account_id}

Required scope: write. Default rules cannot be deleted (403). Returns 204 No Content.


Get Channel Metrics

GET /channel-groups/stats/channels?account_id={account_id}

Traffic metrics rolled up by the channels resolved through the current rule set.

ParameterTypeDefaultDescription
account_idstringrequiredAccount ID
start_date / end_datedate-Local dates in account timezone
periodstring-Period shortcut (overrides explicit dates). Default 30d when nothing provided
countrystring-Filter by country (ISO 2-letter)
pageinteger1Page number
page_sizeinteger50Items per page (1-100)

Response:

{
"success": true,
"data": {
"channels": [
{
"channel": "Organic Search",
"entrances": 25000,
"engaged_entrances": 20000,
"bounces": 5000,
"bounce_rate": 20.0,
"page_views": 75000,
"microconversions": 3400,
"conversions": 350,
"conversion_rate": 1.4,
"revenue": 28000.00
}
],
"total": 8
}
}

This is similar to GET /stats/channels but limited to the current rule set's channels and without comparison/sort options.