POST /api/contracts/templates/:id/deploy
One-call deploy. Loads the template's definition, stamps created_by to the caller's ZID, validates against the live operator registry, and inserts a row in contracts.
Auth
Bearer with operator role or higher on the target state machine.
Request
{ "slug": "my-iot-fleet" }
| Field | Type | Required |
|---|---|---|
slug | string | yes — your state machine's slug |
Response — 201
{
"ok": true,
"contract": { ... },
"template_id": "force-threshold-alarm"
}
The contract object is the same shape as POST /api/chain/:slug/contracts.
Errors
| Status | Body | Cause |
|---|---|---|
400 | Required: slug … | slug missing |
400 | validator message | template's definition fails on the live operator set |
403 | forbidden | role < operator |
404 | Template not found | bad template id |
404 | Machine not found | slug doesn't resolve |