scheduled-tasks — the tenant's scheduled-transition tasks
cyoda-go version 0.9.0
scheduled-tasks
Section titled “scheduled-tasks”scheduled-tasks — the tenant’s scheduled-transition tasks: list the tasks a scheduled workflow transition has armed and that still exist.
SYNOPSIS
Section titled “SYNOPSIS”GET /api/scheduled-tasksContext path prefix is CYODA_CONTEXT_PATH (default /api). Requires Authorization: Bearer <token> except when CYODA_IAM_MODE=mock. HTTP only — there is no gRPC equivalent.
DESCRIPTION
Section titled “DESCRIPTION”A scheduled workflow transition arms a task each time the entity enters the transition’s source state. GET /scheduled-tasks lists the caller’s tenant’s scheduled-transition tasks that still exist: WAITING, RUNNING or FAILED. A task that fired, was declined, expired or was cancelled is removed; its outcome is in the entity’s audit trail (see the audit topic), not here.
With clock control on, a move of the clock fires each due task at its due time, within about one scan interval times the rate; due order holds for due times further apart than that (see cyoda help clock).
Results are sorted by scheduledTime, then taskId, ascending, and paged with an opaque cursor. Filters combine with AND. A modelName, modelVersion or entityId naming an unknown model or entity, or one of another tenant, returns an empty list rather than an error. Any caller of the tenant whose token holds ROLE_M2M may call this endpoint; the tenant is always the token’s — no parameter selects a different one.
PARAMETERS
Section titled “PARAMETERS”All are optional query parameters.
status: return tasks in any of these statuses. Repeat the parameter for several. Accepted values:WAITING,RUNNING,FAILED. Any other value is rejected with400.modelName: return tasks of entities of this model. 1 to 256 characters of valid UTF-8, without NUL.modelVersion: return tasks of entities of this model version. Only together withmodelName— alone it is rejected with400.entityId: UUID — return the tasks of this entity.cursor: opaque, at most 256 characters. PassnextCursorfrom the previous response to fetch the next page; omit for the first page. A cursor that cannot be read is rejected with400, and its value is never echoed back.limit: integer, 1 to 1000 (default 20). A value outside the range is rejected with400, not clamped.
RESPONSE
Section titled “RESPONSE”200 OK, application/json — ScheduledTaskPageDto:
{ "items": [ { "taskId": "3f9b6a106f5e11f08f3a0242ac110002", "entityId": "74807f00-ed0d-11ee-a357-ae468cd3ed16", "modelName": "order", "modelVersion": 1, "sourceState": "PENDING", "transition": "escalate", "status": "WAITING", "scheduledTime": "2025-08-01T10:05:00.000000000Z", "armedTime": "2025-08-01T09:05:00.000000000Z", "attempts": 0, "lostOwners": 0, "nextAttemptTime": "2025-08-01T10:05:00.000000000Z" } ], "pagination": { "hasNext": false }}ScheduledTaskDto fields. Claim tokens, arm tokens and node identities are never returned.
taskId: opaque, stable identifier. The same (entity, source state, transition) keeps the same id when it is armed again.entityId: UUID.modelName,modelVersion: the entity’s model.sourceState: the state the entity must be in for the transition to fire.transition: the transition’s name.status: open value set; accept a value not listed here. Known values:WAITING— due atnextAttemptTime;RUNNING— a node has claimed it and is running it;FAILED— it will not run again and never moves the entity (seefailureReason). A write to the entity insourceStatearms it again; the entity leavingsourceStateremoves it.scheduledTime: when the transition is due.armedTime: when the task was last armed.expiresTime: present when the transition’s schedule setstimeoutMs—scheduledTimeplustimeoutMs.attempts: failed attempts recorded since the task was last armed.lostOwners: times the node running the task was lost since the task was last armed.nextAttemptTime: present whenstatusisWAITING— the earliest time the next attempt may start.lastAttemptTime: present after a failed attempt.lastError: for aFAILEDtask, present with the failure’s text (pairs withfailedTime), even when the text is empty. For every other status, present whenlastAttemptTimeis set, paired with it. Client-safe text — aCODE: detailmessage, a compute node’s own message, orinternal error [ticket: <uuid>].failureReason: present whenstatusisFAILED. Open value set; accept a value not listed here. Known values:UNSAFE_WORK_NOT_COMPLETED— a processor not declaredidempotentwas handed to a compute node and the run did not commit, so it is not repeated;OWNER_LOST_REPEATEDLY— the node running the task was lost too many times;EXPIRED_AFTER_FAILED_ATTEMPTS—expiresTimepassed after a failed attempt or a lost node;RUN_PANICKED— the run failed with an internal error;STOPPED_AFTER_PARTIAL_COMMIT— the run committed the entity into another state and then stopped.failedTime: present whenstatusisFAILED.armedBy: the attributed principal of the write that armed the task —{id, kind},kindone ofuser,service,system. For an on-behalf-of write this is the on-behalf-of user, never the client that holds the token. Present when known.
ERRORS
Section titled “ERRORS”errors.BAD_REQUEST—400— an invalidstatus, an invalidmodelName, amodelVersionwithoutmodelName, an out-of-rangemodelVersionorlimit, or an unreadableentityIdorcursorerrors.UNAUTHORIZED—401— missing or invalid bearer tokenerrors.FORBIDDEN—403— the token lacksROLE_M2M(acyoda tokensigned without--roles ROLE_ADMIN,ROLE_M2M, for example)errors.SERVER_ERROR—500— internal failure; the response carries a ticket id, never the causeerrors.STORAGE_UNAVAILABLE—503— a transient storage outage; retryable
EXAMPLES
Section titled “EXAMPLES”List the first page of WAITING tasks:
curl -s \ -H @- <<<"Authorization: Bearer $TOKEN" \ "http://localhost:8080/api/scheduled-tasks?status=WAITING"List the tasks of one entity:
curl -s \ -H @- <<<"Authorization: Bearer $TOKEN" \ "http://localhost:8080/api/scheduled-tasks?entityId=$ENTITY_ID"Filter to one model version and page through the results:
NEXT=$(curl -s -H @- <<<"Authorization: Bearer $TOKEN" \ "http://localhost:8080/api/scheduled-tasks?modelName=order&modelVersion=1&limit=10" \ | jq -r '.pagination.nextCursor')
curl -s \ -H @- <<<"Authorization: Bearer $TOKEN" \ "http://localhost:8080/api/scheduled-tasks?modelName=order&modelVersion=1&limit=10&cursor=$NEXT"SEE ALSO
Section titled “SEE ALSO”- workflows
- audit
- openapi
- errors.BAD_REQUEST
- errors.UNAUTHORIZED
- errors.SERVER_ERROR
- errors.STORAGE_UNAVAILABLE
See also
Section titled “See also”cyoda help workflows— A workflow definition is a named finite state machine attached to an entity model. Workflows are stored per model reference(entityName, modelVersion). A model may have multiple workflow definitions; the engine selects the matching one per entity using the workflow-levelcriterionfield, on every operation that runs the entity’s workflow (see Workflow-level selection). When nocriterionmatches, the engine uses the default built-in workflow.cyoda help audit— The audit API exposes a per-entity event log covering entity lifecycle changes (EntityChangeevents) and workflow state-machine progression (StateMachineevents). Events are returned in a single deterministic order and support cursor-based pagination.cyoda help openapi— cyoda-go generates its OpenAPI 3.1 specification from the embeddedapi/openapi.yamlfile compiled into the binary at build time. The spec is served at/openapi.jsonwith runtime-patched server URLs. The Scalar API Reference UI is served at/docsand loads the spec from/openapi.json.cyoda help errors BAD_REQUEST— Fired when the server cannot parse or structurally process the incoming request. Common triggers include invalid JSON, unsupported format specifiers, a parameter outside its allowed range, and mutually exclusive parameters set together.cyoda help errors UNAUTHORIZED— Returned when theAuthorizationheader is missing, the bearer token is expired, the token is not signed by one of cyoda’s own key pairs (an identity provider’s token, a user assertion), itsissis notCYODA_JWT_ISSUER, itsaudlacksCYODA_JWT_AUDIENCEwhen that is set, or its claims break the token contract (seecyoda help auth tokens). Also returned when a request reaches a protected route with no identity context established by the auth middleware, and when a compute node’s callback presents a transaction token (X-Tx-Token, gRPCtx-token) that names no callout and try: the detail is then “invalid transaction token” instead of “authentication failed”, and a new bearer token does not help — stop working on that callout (over gRPC it comes in the RPC’s error envelope).cyoda help errors SERVER_ERROR— The server encountered an unclassified internal error. The response body contains aticketUUID that correlates with the server-side error log. No internal details are exposed in the response.cyoda help errors STORAGE_UNAVAILABLE— Raised in three cases, all transient:
Raw formats
Section titled “Raw formats”/help/scheduled-tasks.json— full descriptor (matchesGET /help/{topic}envelope)/help/scheduled-tasks.md— body only