Base path: /v1/promotion/scope/* (requires Authorization, x-app-stage, x-app-uid, company context).
/promotion/scope/tree-childrenLazy-load children for promotion scope hierarchy trees. The root call returns only level-1 nodes (channels or business types). Expand each node in the UI to request the next level (parentType + parentId).
Under a channel, level-2 territories are all company delivery zones (level 3); sales teams and portfolios are filtered by channel when portfolios have customer_channel_id set (null channel on portfolio still matches).
| Parameter | Required | Description |
|---|---|---|
companyId |
Yes | Company id |
tree |
Yes | channel or businessType |
parentType |
Yes | root, channel, businessType, territory, salesTeam |
parentId |
When parent ≠ root | Parent node id |
channelId |
Optional | Ancestor filter (channel tree) |
businessTypeId |
Optional | Ancestor filter (business type tree) |
territoryId |
Optional | Ancestor filter below territory |
search |
Optional | Filter by name/code |
limit / offset |
Optional | Pagination (default limit 200, max 500) |
ActionResult){
"success": true,
"message": "Nodos de canal obtenidos correctamente",
"data": [
{
"id": 1,
"code": "R",
"name": "Retail",
"nodeType": "channel",
"hasChildren": true,
"children": [{ "_placeholder": true }]
}
]
}
/promotion/scope/business-typesShortcut for tree-children with tree=businessType and parentType=root.
/promotion/scope/validateValidates scope payload. When version is 2, runs v2 rules on nested branches (duplicate nodes, registry pairs, ancestor consistency).
{
"version": 2,
"branches": [
{
"nodeType": "branchRoot",
"id": 2,
"code": "IC",
"name": "Ica",
"isDistributionCenter": "Y",
"ancestors": [],
"status": "checked",
"branches": [
{
"nodeType": "branch",
"id": 7,
"code": "NZ",
"name": "Nasca",
"ancestors": { "branchRootId": 2 },
"status": "checked",
"channels": [
{
"nodeType": "channel",
"id": 13,
"code": "01",
"name": "MINORISTA",
"ancestors": { "branchRootId": 2, "branchId": 7 },
"status": "checked"
}
]
}
]
}
]
}
scopeByStep)For is_stepped promotions, each tramo uses the same v2 branches shape inside scopeByStep[stepCode]. Validate each tramo with POST /promotion/scope/validate (body = one tramo’s scope object). On promotion PUT, the backend runs ValidateSteppedPromotionScopeBudgetAction for every tramo pair (scopeByStep[code] + budgetByStep[code]). Eligibility and BEES scope expansion union flatten across all scopeByStep values — see promotion-master.md Stepped scope/budget contract.
{
"success": true,
"data": {
"valid": true,
"errors": [],
"message": "Alcance válido"
}
}
/promotion/scope/branch-channel-matrixReturns operational branches (non-DC with DC ancestor) that have active rows in branch_customer_channels, each with nested channels[].
| Parameter | Required |
|---|---|
companyId |
Yes |
/promotion/scope/distribution-centersLists branches with is_distribution_center = 'Y' for the company.
/promotion/scope/build-previewBody:
{
"companyId": 1,
"pairs": [{ "branchId": 2, "customerChannelId": 10 }]
}
Returns scope v2 payload with nested branches[] (branchRoot → branches → channels).
{
"version": 2,
"branches": [
{
"nodeType": "branchRoot",
"id": 2,
"code": "IC",
"name": "Ica",
"isDistributionCenter": "Y",
"ancestors": [],
"status": "checked",
"branches": [
{
"nodeType": "branch",
"id": 2,
"code": "IC",
"name": "ICA",
"ancestors": {},
"status": "checked",
"channels": [
{
"nodeType": "channel",
"id": 13,
"code": "01",
"name": "MINORISTA",
"ancestors": { "branchRootId": 2, "branchId": 2 },
"status": "checked"
}
]
},
{
"nodeType": "branch",
"id": 7,
"code": "NZ",
"name": "Nasca",
"ancestors": { "branchRootId": 2 },
"status": "checked",
"channels": [
{
"nodeType": "channel",
"id": 13,
"code": "01",
"name": "MINORISTA",
"ancestors": { "branchRootId": 2, "branchId": 7 },
"status": "checked"
}
]
}
]
}
]
}
Audience filters on the promotion document: businessTypes, businessPartnerGroups, paymentTermGroups.
Base path: /v1/base/master/branch-customer-channels
| Method | Path | Description |
|---|---|---|
| GET | / |
List (companyId, optional branch_id) |
| POST | / |
Create link (branch_id, customer_channel_id, codes) |
| DELETE | /{id} |
Remove link |
Branch master field: is_distribution_center (DC roots for scope).
/promotion/limits/concurrent-checkCounts active Couch promotions whose scope v2 selections include the given node.
{
"companyId": 1,
"nodeType": "territory",
"id": 42,
"excludePromotionId": "promo-uuid"
}
{
"success": true,
"data": {
"count": 2,
"nodeType": "territory",
"id": 42
}
}