Skip to content
bitzorcas
中EN

Reference

Workflow HTTP API Reference

Current Definition, Runtime, Task, History, Report, and Management routes with authorization, rate limits, timeouts, and error semantics.

Last updated

Workflow HTTP routes start at /api/workflow, all declared by [GenerateEndpoint] on Platform Application commands and queries and grouped by tag: Workflow-Runtime / Workflow-Tasks / Workflow-History / Workflow-Definitions / Workflow-Management / Workflow-Metadata / Workflow-Reports. Write commands carry RateLimitPolicy="userPolicy" plus RequestTimeoutPolicy="WorkflowCommand"/"StandardCommand"; the generator registers them conditionally via RequireService=IWorkflowEngine (IWorkflowTaskCenterStore for the task center) — on hosts without a composed persistence adapter these endpoints simply do not exist. The OpenAPI document from the current build remains the request/response schema source of truth.

1. Common pipeline

Every generated route requires authentication and passes through IAuthorizedRequest module/resource/action authorization; rate-limit and timeout policies come from each command attribute, with runtime writes using the longer WorkflowCommand timeout. No hand-written entry point bypasses the pipeline — new capabilities are new commands or queries, never extra endpoint files.

2. Definitions

MethodRoutePurpose
POST/api/workflow/definitions/deploy snapshot
POST/api/workflow/definitions/validatestatic validation
POST/api/workflow/definitions/simulatein-memory preview
GET/api/workflow/definitions/schemadesigner schema
GET/api/workflow/definitions/{key}/versionsversion list
GET/api/workflow/definitions/versions/{definitionId}one version
GET/api/workflow/definitions/{key}/activeactive definition
GET/api/workflow/definitions/{key}/deploymentsbindings
POST/api/workflow/definitions/{key}/deploymentspublish
POST/api/workflow/definitions/{key}/deployments/grayscaleswitch active and retain previous
POST/api/workflow/definitions/{key}/deployments/complete-grayscalestatus promotion
POST/api/workflow/definitions/{key}/deployments/rollbackrestore previous
GET/api/workflow/definitions/designer-schemadesigner metadata (node ConfigFields/resolver/handler catalogs)
GET/api/workflow/definitions/{key}/draftread draft revision
PUT/api/workflow/definitions/{key}/draftsave draft (optimistic Revision)
DELETE/api/workflow/definitions/{key}/draftdelete draft
POST/api/workflow/definitions/{key}/draft/validatevalidate saved draft
POST/api/workflow/definitions/{key}/draft/simulatesimulate draft path
POST/api/workflow/definitions/{key}/draft/publishauthoritative validation, immutable version + binding update

Grayscale is not percentage routing, and only draft/publish closes the full validation loop — the legacy POST /api/workflow/definitions/ still requires merely compilable JSON.

3. Runtime

MethodRoutePurpose
POST/api/workflow/runtime/instancesstart
POST/api/workflow/runtime/instances/start-at-nodestart at mapped node
GET/api/workflow/runtime/instances/{id}/progressprogress graph
POST/api/workflow/runtime/tasks/{taskId}/completeapprove
POST/api/workflow/runtime/tasks/{taskId}/rejectreject
POST/api/workflow/runtime/tasks/{taskId}/transfertransfer
POST/api/workflow/runtime/tasks/{taskId}/delegatedelegate
POST/api/workflow/runtime/tasks/{taskId}/add-participantadd signer
POST/api/workflow/runtime/tasks/batch-completeproxy-complete without process advance
POST/api/workflow/runtime/instances/{id}/withdrawwithdraw
POST/api/workflow/runtime/instances/{id}/resubmitresubmit
POST/api/workflow/runtime/instances/{id}/terminateterminate
POST/api/workflow/runtime/instances/{id}/cancelcancel
POST/api/workflow/runtime/instances/{id}/resetreset node
POST/api/workflow/runtime/instances/{id}/suspendsuspend
POST/api/workflow/runtime/instances/{id}/resumeresume
POST/api/workflow/runtime/instances/{id}/remindremind
POST/api/workflow/runtime/instances/{id}/priorityupdate priority
POST/api/workflow/runtime/instances/{id}/transfer-applicanttransfer applicant

Actor comes from CurrentUser. There is no HTTP Idempotency-Key contract.

4. Tasks

MethodRoutePurpose
GET/api/workflow/tasks/todotodo page
GET/api/workflow/tasks/todo/countbadge count
GET/api/workflow/tasks/donedone page
GET/api/workflow/tasks/{taskId}detail
POST/api/workflow/tasks/{taskId}/mark-readread marker

Detail is affected by the empty-user defect. Todo defaults to the full-memory data-scope path. Count intentionally omits data scope.

5. History

MethodRoutePurpose
GET/api/workflow/history/instances/{id}/timelinetimeline
GET/api/workflow/history/instances/{id}history summary
GET/api/workflow/history/instances/{id}/trailactivity trail
POST/api/workflow/history/instances/{id}/archivearchive
GET/api/workflow/history/business/{businessKey}/timelineaggregate timeline
GET/api/workflow/history/business/{businessKey}/statusaggregate status

Tenant scope for business-key reads comes from server context and store filters.

6. Reports

/api/workflow/reports includes instances, task-duration, approvers, bottlenecks, rejects, trends, and deployments. Generated endpoints use QUERY and provide /_query POST fallbacks. Trends use QUERY /api/workflow/reports/trends: From and To are both required and From must not be later than To; a missing or reversed range returns Workflow.Report.PeriodInvalid. TenantId comes only from CurrentUser, DefinitionKey is optional, and an unrecognized Granularity currently falls back to Daily. Missing QueryStore can still produce empty success, and trend average duration remains zero.

7. Management

MethodRoutePurpose
POST/api/workflow/management/importimport one legacy instance
GET/api/workflow/management/statisticsengine statistics
DELETE/api/workflow/management/definitions/{id}delete definition
DELETE/api/workflow/management/instances/{id}delete terminal instance
POST/api/workflow/management/tasks/{id}/refresh-candidatesrefresh task candidates
POST/api/workflow/management/roles/{id}/refresh-candidatesrefresh by role

Definition deletion does not check references. Import trusts body TenantId and lacks transaction/idempotency. Restrict and audit these operations.

8. Request example

Complete a task
POST /api/workflow/runtime/tasks/task-123/complete
Authorization: Bearer {token}
Content-Type: application/json
{
"comment": "Approved",
"variables": {
"financeApproved": true
}
}

ProblemDetails mapping is owned by WorkflowResultExtensions and ProblemDetailsMapper. Clients should use stable error identifiers rather than localized detail text.

9. Security checks

  • resource-level authorization on every ID route;
  • trusted tenant and office context;
  • page, time-range, variable, comment, and request-body limits;
  • enhanced audit for delete, reset, start-at-node, import, and transfer;
  • rate limit and timeout on generated as well as hand-written routes.

The workflow.runtime feature is now enforced by WorkflowRuntimeLicenseGuard before every workflow write and background job; this item is delivered.

10. Source and OpenAPI checks

Terminal window
rg -n "GenerateEndpoint|Map(Get|Post|Delete)" src/Platform/Workflow src/Hosts/BitzOrcas.Api/Endpoints/Workflow -g '*.cs'
dotnet run --project src/Hosts/BitzOrcas.Api

Next: standalone embedding

100%

Scroll or use controls to zoom · drag when enlarged · double-click for 100% / 200%