{"components":{"schemas":{"ErrorResponse":{"properties":{"error_id":{"type":"string"},"instance_id":{"type":"string"},"model":{"type":"string"},"status":{"example":"error","type":"string"}},"type":"object"},"HealthResponse":{"properties":{"status":{"example":"ok","type":"string"},"ts":{"format":"date-time","type":"string"},"uptime_seconds":{"type":"integer"}},"type":"object"},"MetricsResponse":{"properties":{"in_flight":{"type":"integer"},"in_flight_instances":{"additionalProperties":{"type":"string"},"type":"object"},"started_at":{"format":"date-time","type":"string"},"total_completed":{"type":"integer"},"total_errors":{"type":"integer"},"total_requests":{"type":"integer"},"total_waiting":{"type":"integer"},"ts":{"format":"date-time","type":"string"},"uptime_seconds":{"type":"integer"}},"type":"object"},"StartRequest":{"properties":{"context":{"additionalProperties":true,"description":"Initial or additional context key-value pairs.","example":{"amount_exceeds":"no"},"type":"object"},"instance_id":{"description":"Optional: ID of an existing paused instance to resume.","type":"string"},"model":{"description":"Model name without .drawio extension.","example":"payment","type":"string"}},"required":["model"],"type":"object"},"WorkflowResponse":{"properties":{"instance_id":{"type":"string"},"mode":{"enum":["start","resume","continue","callback"],"type":"string"},"status":{"description":"completed = done, waiting = paused at a gate, accepted = running async.","enum":["completed","waiting","accepted"],"type":"string"}},"type":"object"}},"securitySchemes":{"basicAuth":{"description":"HTTP Basic Auth. Enabled only when API_USERNAME and API_PASSWORD are set in CREDENTIALS.txt or environment variables.","scheme":"basic","type":"http"}}},"info":{"contact":{"email":"barbaros.oezdemir@at.ibm.com","name":"Barbaros \u00d6zdemir"},"description":"A lightweight REST API for starting, resuming, and monitoring stateful draw.io workflow instances. Workflows are defined as `.drawio` diagram files and executed by the engine.","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"title":"draw.io Workflow Engine API","version":"1.0.0"},"openapi":"3.0.3","paths":{"/health":{"get":{"description":"Liveness probe. Always accessible \u2014 no authentication required. Suitable for load balancer and Kubernetes readiness probes.","operationId":"health","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}},"description":"Server is healthy."}},"summary":"Health check","tags":["Operations"]}},"/metrics":{"get":{"description":"Runtime counters: total requests, completed, waiting, errored, and currently in-flight instances.","operationId":"metrics","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricsResponse"}}},"description":"Metrics snapshot."},"401":{"description":"Authentication required."}},"security":[{"basicAuth":[]}],"summary":"Runtime metrics","tags":["Operations"]}},"/workflows/start":{"post":{"description":"Start a new workflow instance or resume an existing paused one. Returns HTTP 200 when the workflow completes within this call, or HTTP 201 when it pauses at a gate (manual input, delay, parallel wait).","operationId":"startWorkflow","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowResponse"}}},"description":"Workflow completed."},"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowResponse"}}},"description":"Workflow paused / waiting."},"400":{"description":"Missing or invalid request fields."},"401":{"description":"Authentication required."},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal engine error."}},"security":[{"basicAuth":[]}],"summary":"Start or resume a workflow","tags":["Workflows"]}},"/workflows/{instance_id}":{"get":{"description":"Retrieve full persisted state for a workflow instance: context, history, wait states, and status. The `model` query parameter is required.","operationId":"getWorkflow","parameters":[{"in":"path","name":"instance_id","required":true,"schema":{"type":"string"}},{"example":"payment","in":"query","name":"model","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"State retrieved successfully."},"401":{"description":"Authentication required."},"404":{"description":"Instance not found."},"500":{"description":"Internal engine error."}},"security":[{"basicAuth":[]}],"summary":"Get workflow state","tags":["Workflows"]}},"/workflows/{instance_id}/callback":{"post":{"description":"Deliver an asynchronous event to a waiting instance. Used internally for parallel branch coordination when ENGINE_URL is configured.","operationId":"callbackWorkflow","parameters":[{"in":"path","name":"instance_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRequest"}}},"required":true},"responses":{"200":{"description":"Parent workflow resumed and completed."},"201":{"description":"Branch recorded; still waiting for other branches."},"400":{"description":"Missing model field."},"401":{"description":"Authentication required."},"500":{"description":"Internal engine error."}},"security":[{"basicAuth":[]}],"summary":"Deliver async callback to a waiting instance","tags":["Workflows"]}},"/workflows/{instance_id}/continue":{"post":{"description":"Explicitly advance a paused instance. Intended for form submissions and manual approvals.","operationId":"continueWorkflow","parameters":[{"in":"path","name":"instance_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRequest"}}},"required":true},"responses":{"200":{"description":"Workflow completed."},"201":{"description":"Workflow paused again."},"400":{"description":"Missing model field."},"401":{"description":"Authentication required."},"500":{"description":"Internal engine error."}},"security":[{"basicAuth":[]}],"summary":"Continue a paused workflow","tags":["Workflows"]}}},"security":[],"servers":[{"description":"This server","url":"/"}],"tags":[{"description":"Start, resume, continue, and inspect workflow instances.","name":"Workflows"},{"description":"Server health and runtime metrics.","name":"Operations"}]}
