Base path: /v1/promotion/budget
Headers: Authorization: Bearer <token>, x-app-stage, x-app-uid
Company: query companyId on GET; body company_id on POST/PUT (same as scope validate).
/v1/promotion/budget/{promotionUuid}Returns Couch-shaped budget v1 read model (allocations + consumed counters from PostgreSQL).
Query: companyId (required)
Response (200):
{
"success": true,
"message": "OK",
"data": {
"version": 1,
"currency": "PEN",
"promotionTotal": {
"monetaryCap": 100000,
"monetaryConsumed": 0,
"monetaryRemaining": 100000,
"assignedUnitsCap": 5000,
"assignedUnitsConsumed": 0,
"assignedUnitsRemaining": 5000
},
"nodes": []
}
}
/v1/promotion/budget/{promotionUuid}/kpisControl KPIs (utilization %, remaining, 7-day burn rate, status band).
Query: companyId (required), period (optional, e.g. month)
/v1/promotion/budget/validateCross-checks budget v1 payload against scope v2 selections and hierarchy rules.
Body:
{
"company_id": 1,
"budget": {
"version": 1,
"promotionTotal": { "monetaryCap": 1000, "assignedUnitsCap": 100 },
"nodes": []
},
"scope": { "version": 2, "trees": { "byChannel": { "selections": [] } } }
}
Response (200): data.valid true/false; data.errors[] when invalid.
/v1/promotion/budget/reserveInternal / order pipeline. Reserves budget headroom before order persist.
Body (example):
{
"company_id": 1,
"idempotencyKey": "order-uuid:promo-uuid",
"promotionUuid": "…",
"monetaryDelta": 12.5,
"assignedUnitsDelta": 1,
"customerCode": "C001",
"matchedNodeKeys": ["territory:42"]
}
422: insufficient budget — includes dimension, nodeKey, cap, consumed, requestedDelta, utilizationPercent.
/v1/promotion/budget/commitBody: { "company_id": 1, "idempotencyKey": "…" }
/v1/promotion/budget/releaseReverses a reserved entry on cancel/failure.
/v1/promotion/budget/{promotionUuid}Upserts allocations (draft configuration). Also applied via PUT /v1/promotion/promotions/{uuid} with budget on the promotion document.
SaveGoalOrderAction calls ApplyPromotionBudgetToOrderAction when the order payload includes promotionBudgetApplications[] (per promo: promotionUuid, monetaryDelta, assignedUnitsDelta, optional customerCode). GProc promo paths should perform an equivalent post-check until native integration.