Trigger + scope + actions. Build automations the same way the UI does, simulate against last-30-day data, then enable when it looks right.
A Rule is a trigger + scope + actions trio. The trigger watches for things like a competitor undercut, a margin drop, or a stale scrape; the scope limits which SKUs it touches; the actions decide what happens when it fires (in-app alert, email, propose price, auto-apply).
/api/rulesCookie sessionCreate an automation rule.
curl -X POST https://app.priceroom.com/api/rules \
-H "Content-Type: application/json" \
-H "Cookie: pr_session=..." \
-d '{
"name": "Match cheapest competitor −1%",
"enabled": false,
"cooldownMinutes": 360,
"when": {
"trigger": "competitor_undercut",
"competitorDeltaPct": 1.0
},
"scope": { "mode": "all" },
"marginFloor": { "pct": 15 },
"actions": [
{ "type": "alert_inapp", "severity": "high" },
{ "type": "propose_price", "formula": "min_competitor_minus_1pct" }
]
}'/api/rulesCookie sessionList all rules in the tenant.
/api/rules/[id]Cookie sessionFetch a single rule.
/api/rules/[id]Cookie sessionPartial update — every field optional.
/api/rules/[id]Cookie sessionSoft-delete the rule.
Two endpoints that let you understand exactly what a rule will do before flipping its switch.
/api/rules/[id]/simulateCookie sessionDry-run the rule across up to 25 in-scope products. Returns whether each would fire and the proposed price (if any).
curl -X POST https://app.priceroom.com/api/rules/RULE_ID/simulate \
-H "Content-Type: application/json" \
-H "Cookie: pr_session=..." \
-d '{}'{
"firstFive": [
{
"sku": "WH-1000XM5",
"wouldFire": true,
"proposedCents": 28910,
"reason": "mediamarkt.de at 29200; floor respected (margin 18.4%)"
},
{
"sku": "AIRP-PRO-2",
"wouldFire": false,
"reason": "no competitor observation in 30d"
}
]
}/api/rules/[id]/toggleCookie sessionFlip the enabled state. Audit-logged.
The exhaustive enums used by `when.trigger` and `actions[].type`. All values are stable across versions of the public API.
TriggersCookie or BearerWhich events can fire a rule.
ActionsCookie or BearerWhat a rule can do when it fires.
Every 4xx/5xx returns a stable JSON error. Use code for programmatic branching.
{
"error": {
"code": "invalid_api_key",
"message": "The provided API key is invalid or revoked.",
"requestId": "req_01HTX9..."
}
}