563848e0ecc0
Run synchronous flag calculation for a monitoring workflow
Evaluates practitioner data against a monitoring workflow and creates, updates, or deactivates flags based on the difference from the current flag state, returning counts of flags created, updated, deactivated, and a total. Call this endpoint to trigger on-demand, synchronous flag calculation for a single monitoring workflow — do not use it for bulk or event-driven recalculation, which separate Kafka-driven consumers handle instead. If the workflow's status is REVIEWED_BY_CERTIFYOS, the endpoint accepts the request but performs no flag evaluation, does not update lastFlagCalculationTimestamp, and returns all-zero counts (verified: calculateFlagsWithTenantId returns early for workflows whose status is in MonitoringWorkflowConstants.COMPLETED_WORKFLOW_STATUSES). The monitoring workflow identified by monitoringWorkflowId must already exist and belong to the tenant identified by the required tenant-id header, or the call returns 404. Pass sections in the request body to limit calculation to a subset of the accepted section names; omitting it or passing an empty array calculates flags across all sections, and any unrecognized section name is silently ignored rather than rejected. The X-Monitoring-Api-Key header is only enforced while the monitoring.api-key-enabled kill-switch is turned on (off by default) — when enforced, a missing or mismatched key returns 401. On a real (non-no-op) evaluation, lastFlagCalculationTimestamp is written back to the monitoring workflow record. Repeated calls re-evaluate flags from current practitioner data each time — the call is safe to retry after a transient error, but successive successful calls may produce different flag counts if the underlying practitioner data changed between calls.
Headers
Shared secret checked against the monitoring.api-key configuration property. Only enforced while the monitoring.api-key-enabled kill-switch is turned on (off by default); when enforcement is enabled, a missing or mismatched key returns 401.
Tenant ID that the monitoring workflow identified by monitoringWorkflowId must belong to; required on every call.
Optional ID of the calling user, used to attribute service-to-service calls. When omitted, no user context is attached to the operation.
Request body
Example request
{
"monitoringWorkflowId": "mw_1234567890",
"sections": [
"licenses",
"educationTraining"
]
}Response
A summary of the flag calculation outcome: how many flags were created, updated, and deactivated, plus the resulting total. All four counters are 0 when the workflow's status is REVIEWED_BY_CERTIFYOS — flag evaluation is skipped for that status (see the operation description).
Example response
{
"flagsCreated": 5,
"flagsUpdated": 3,
"flagsDeactivated": 2,
"totalFlags": 8,
"monitoringWorkflowId": "mw_1234567890"
}