---
title: "Calculate flags for a monitoring workflow"
method: POST
path: "/flag-calculator"
tags: ["FlagCalculator"]
---

# Calculate flags for a monitoring workflow

`POST /flag-calculator`

Calculates flags for a monitoring workflow based on practitioner data and manages flag lifecycle (create/update/deactivate) according to the comparison with existing flags

## Headers

- `tenant-id` string, required
- `user-id` string

## Request body

- FlagCalculatorRequest — Request to calculate flags for a monitoring workflow
  - `monitoringWorkflowId` string, required — ID of the monitoring workflow to calculate flags for
  - `sections` string[] — Array of sections to calculate flags for. If not provided or empty, all sections' flags are calculated

## Response `200`

Successfully calculated flags

- FlagCalculatorResponse — Response from flag calculator operation
  - `flagsCreated` integer — Number of flags created
  - `flagsUpdated` integer — Number of flags updated
  - `flagsDeactivated` integer — Number of flags deactivated
  - `totalFlags` integer — Total number of flags after calculation
  - `monitoringWorkflowId` string — ID of the monitoring workflow

## Other responses

- `400` — Invalid request parameters
- `401` — Unauthorized - Authentication required
- `403` — Forbidden - User does not have required permissions
- `404` — Monitoring workflow not found
- `500` — Internal Server Error - An unexpected error occurred

---

[API](https://skmtc.net/certifyos/apis/certify-api-layer.md) · [All operations](https://skmtc.net/certifyos/apis/certify-api-layer/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/certifyos/certify-api-layer/revisions/3d27e9019c7b/schema)
