Catalog/workflow-fsm-apply-event

Workflow

FSM apply event sequence API

Runs a sequence of events through an FSM from a starting state, returning the final state and an executed trace, throwing on any illegal event. Answers 'Where does this event sequence land?', 'Is this event sequence valid?'.

Price$0.02per request
MethodPOST
Route/v1/workflow/fsm-apply-event
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
fsmstate-machineapplyeventtransitiontraceautomataworkflow
API URLhttps://x402.hexl.dev/v1/workflow/fsm-apply-event
Integration docs
Example request
{
  "states": [
    "idle",
    "running",
    "done"
  ],
  "initial": "idle",
  "transitions": [
    {
      "from": "idle",
      "on": "start",
      "to": "running"
    },
    {
      "from": "running",
      "on": "finish",
      "to": "done"
    }
  ],
  "finals": [
    "done"
  ],
  "events": [
    "start",
    "finish"
  ]
}
Example response
{
  "finalState": "done",
  "isFinal": true,
  "trace": [
    {
      "from": "idle",
      "event": "start",
      "to": "running"
    },
    {
      "from": "running",
      "event": "finish",
      "to": "done"
    }
  ],
  "steps": 2,
  "interpretation": "After 2 event(s) the machine is in 'done' (a final state)."
}
Input schema
{
  "type": "object",
  "required": [
    "states",
    "initial",
    "transitions",
    "events"
  ],
  "properties": {
    "states": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "examples": [
        [
          "idle",
          "running",
          "done"
        ]
      ]
    },
    "initial": {
      "type": "string",
      "examples": [
        "idle"
      ]
    },
    "transitions": {
      "type": "array",
      "examples": [
        [
          {
            "from": "idle",
            "on": "start",
            "to": "running"
          },
          {
            "from": "running",
            "on": "finish",
            "to": "done"
          }
        ]
      ]
    },
    "state": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "examples": [
        [
          "start",
          "finish"
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}