States
A claim is always in one of four states:| State | Description |
|---|---|
OPEN | Accepting events. The fulfillment condition is evaluated on every POST /v1/events. |
PENDING | Fulfillment condition was satisfied, or the activity window elapsed. Waiting for the review window to expire before final resolution. |
CONFIRMED | The claim was confirmed. Terminal state. |
FAILED | The claim failed. Terminal state. |
Transitions
All transitions happen in one of two ways:-
Event submission — when you call
POST /v1/eventswith aclaim_idand the fulfillment condition evaluates totrue, the claim transitionsOPEN → PENDINGwithscheduled_outcome = CONFIRMEDin the same atomic database operation. -
Scheduled jobs — pg_cron jobs run every minute and check time-based conditions:
activity_windowelapsed →OPEN → PENDING(usingtimeout_outcome)review_windowelapsed →PENDING → CONFIRMEDorPENDING → FAILED
Key fields
status_since
Timestamp of when the claim entered its current status. For OPEN claims this equals the creation time. All time-window calculations (activity_window, review_window) are measured from status_since of the relevant state, not from claim creation.
scheduled_outcome
Set when a claim enters PENDING. Tells you what the final resolution will be once the review window expires:
CONFIRMED— claim is confirmed (set when fulfillment condition was satisfied)FAILED— claim fails (set when activity/expiration window fired andtimeout_outcome = "fail")nullwhile the claim isOPEN
Contract windows
All windows are defined in seconds on the contract:Event submission rules
- Only
OPENclaims accept events. Submitting to any other status returnsCLAIM_NOT_OPEN(422). - Events are evaluated as a set — order does not matter, only presence. Submitting the same event type twice has no additional effect on condition evaluation.
- The fulfillment condition is re-evaluated from scratch on every submission against the full event log, including the new event.
System-generated events
The platform appends synthetic events to the claim’s event log at each time-based transition. These are visible inGET /v1/claims/:id:
| Event type | When appended |
|---|---|
activity_window_elapsed | activity_window expires → claim transitions OPEN → PENDING |
review_window_elapsed | review_window expires → claim transitions PENDING → CONFIRMED or PENDING → FAILED |
Race conditions
If your system submits events concurrently, a race is possible: two submissions arrive close together, the first satisfies the condition and transitions the claim toPENDING, and the second arrives after. The second submission returns CLAIM_NOT_OPEN.
Handle this by checking the claim status before deciding whether to create a new claim: