Add a New License Found flag's state(s) to the practitioner's states to credential
POST/flags/:id/add-state-to-credential
For a new_credential_found flag on state-licenses, DEA or CDS: appends the flag's single state (always taken from the flag's metaData.state; the request's states must be absent/empty) to statesToCredential. For a compact-license flag (no single state; coverage is metaData.coveredStates, a list): the request's states is required, and must be a non-empty subset of the flag's own coveredStates — a state already on the practitioner is accepted and treated as a no-op, so a retry after a partial success is never rejected — every requested state is added. Either way, states are written to statesToCredential on the practitioner's tenant record (or roster record when only that one carries the list), the flag is marked seen with the note (for an outreachInProgress flag the status is left and the note is recorded on its history), then the state(s) are added to the active monitoring workflow and its flags are recalculated, which closes the flag. Allowed on open, needsVerification, sentToCommittee and outreachInProgress flags. For state-licenses/DEA/CDS, a seen flag answers 409 unless the state is already present, in which case the call only finishes the workflow update (a retry after PARTIAL_SUCCESS) and the note is not recorded. For compact-license, a seen flag never 409s: the flag stays seen and is not re-moved, but any requested state not yet added is still written and the workflow updated — a reviewer can come back and add previously-unselected covered states while the flag is seen. A closed flag always answers 409. Returns 200 with a per-step outcome even when a follow-up step failed: status is FAILED when the practitioner record was not updated, PARTIAL_SUCCESS when it was but the flag or workflow step failed, SUCCESS otherwise. Safe to retry while the flag is not closed: a state already present is not written again and a seen flag is not moved again. Permission checks run before any write. Callers without the needs-verification permission get 404 for needsVerification and internal-only flags, as on GET /flags/{id}/details. Gated by flags.add-state-to-credential.enabled (default true); returns 404 while disabled.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 409
Per-step outcome; inspect status
Bad Request - the note is missing, blank or longer than 2000 characters, the flag is not a new_credential_found flag, it carries no state (or, for compact-license, no covered states), states was supplied for a non-compact flag, states is missing/empty for a compact-license flag, or a requested state is not in the compact flag's coveredStates
Unauthorized - authentication is required; the JWT is missing or invalid
Forbidden - the caller lacks UPDATE_PRACTITIONER, the permission to move this flag to seen from its current status (to close it, for an outreachInProgress flag), or (for a needsVerification flag) the needs-verification permission. Nothing is written.
Not Found - no such flag for this tenant, the flag is hidden from the caller (needsVerification or internal-only without the needs-verification permission), or the endpoint is disabled
Conflict - the flag is closed; it is a state-licenses/DEA/CDS flag that is seen and the state is not already present (compact-license flags never 409 while seen); its status is unreadable; or its practitioner could not be resolved