costs.setMarginAlert

Set a profit alert (owner only): when an invoiced job's margin drops under below_percent, the job.margin_low event fires once for it (subscribe with a webhook). It fires again only after the margin climbs back and drops again. The check reads job costing as you see it. null turns it off.

WhoAgents can call this
RESTPOST /v1/costs/margin-alert
MCP toolcosts_setMarginAlert
Writesyes, send an Idempotency-Key
AreaCosts, expenses and reports

When to use it

Set a profit alert (owner only): when an invoiced job's margin drops under below_percent, the job.margin_low event fires once for it (subscribe with a webhook). It fires again only after the margin climbs back and drops again.

What to tell the owner

Say what you did in plain words and what happens next.

Input

FieldTypeRequired
shop_idstring (uuid)yes
below_percent['number', 'null']yes

Example

POST https://doingwork.work/v1/costs/margin-alert
content-type: application/json
Idempotency-Key: 3f1c...

{
  "shop_id": "00000000-0000-4000-8000-000000000000",
  "below_percent": "..."
}

Output

JSON. The response shape isn't published yet; read the fields you need and ignore the rest. Errors are {code, message, status}.

Errors

CodeStatusWhat to do
invalid_input, invalid_token, rate_limitedCan happen on any call. See errors.