The contract lifecycle
Every operation below is a real route on the live surface (the
contracts reference carries each one with its curl). A contract lives at
/api/chain/<machine>/contracts/<id> — it belongs to your machine, and every state-changing
operation lands on your audit chain.
Deploy
# from a template
curl -sX POST https://zeqsdk.com/api/contracts/templates/force-threshold-alarm/deploy \
-H "Authorization: Bearer $ZEQ_KEY" -H "Content-Type: application/json" \
-d '{"slug":"YOUR_MACHINE"}'
# or a hand-written definition
POST /api/chain/YOUR_MACHINE/contracts/custom # body carries { definition: … }
Try before you fire
Dry-run answers "what would happen?" with no audit rows, no fires, no cost:
POST /api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/dry-run
GET /api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/preview # cheap owner poll (the IDE uses it)
GET /api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/next-fires # predicted next N fires for time triggers
Fire and flow
POST /api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/transition # drive an edge with an input payload
POST /api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/fire-now # fire a due trigger immediately
POST /api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/skip-next # skip the next scheduled fire
Time-based triggers (one-shot, recurring, cron-style) are driven by your machine's Zeqond clock; condition triggers evaluate on posted readings, as in the anatomy example.
Pause, freeze, resume
POST …/pause # stop firing, keep scheduling state
POST …/freeze # hard stop; the row stays so audit history is preserved
POST …/resume
Versions and rollback
Editing a contract (PATCH …/contracts/:id) overwrites the live row and bumps
current_version_no; every prior version stays retrievable, and rollback re-inserts an old
version as the new head — history is never rewritten:
GET …/versions # list
GET …/versions/:n # one
POST …/rollback # restore a version as a NEW version
Trust but verify
GET …/integrity # stored hash vs live re-hash — public, catches tampering
GET …/audit # the contract's audit trail (ZeqProof per proof-required fire)
POST …/verify # re-verify a fire's proof
Every proof-required fire is an envelope on the machine's hash-linked chain, sealed by Proof of Elapsed Zeqonds.
Move it
GET …/export # portable envelope of definition + metadata
POST …/contracts/import # into another machine — runtime state starts clean
Watch it live
GET /api/chain/YOUR_MACHINE/events # filterable contract-event feed
GET /api/chain/YOUR_MACHINE/events/stream # server-sent events, push on every insert
GET …/contracts/CONTRACT_ID/transitions/stream # one contract's transitions, live
Read next
- Anatomy — states, transitions, conditions, proofs.
- The contracts reference — every route above, with full curls.
- Channels — put a page in front of your contract.