Skip to content

Scenarios

Scenarios (called "plans" in the data model) are sandboxed copies of your live workforce data. This page covers the REST endpoints for creating, editing, submitting for approval, merging and archiving them. For the conceptual workflow, see Scenarios workflow.

New to Flowstate?

Read Live data vs scenarios first — scenarios are the foundation of every "what-if" workflow in Flowstate.

Plan Object

FieldTypeDescription
idstringUnique identifier (CUID format). System-generated. Read-only.
titlestringDisplay name.
descriptionstring | nullOptional context.
statusstringOne of DRAFT, PENDING_APPROVAL, ACTIVE, REJECTED, ARCHIVED.
createdAtdatetime (ISO 8601)When the scenario was created. Read-only.
createdByUserIdstringThe user who created the scenario. Read-only.
submittedAtdatetime | nullWhen the scenario was submitted for approval. Read-only.
submittedByUserIdstring | nullThe user who submitted it. Read-only.
rejectedAtdatetime | nullWhen the scenario was rejected. Read-only.
rejectedByUserIdstring | nullThe user who rejected it. Read-only.
rejectionReasonstring | nullThe reason given for rejection.
assigneesarrayUsers assigned to review and approve.
mergedAtdatetime | nullWhen the scenario was merged. Read-only.

Endpoints

MethodPathDescription
GET/org/:orgId/scenariosList scenarios
GET/org/:orgId/scenarios/:idGet scenario
POST/org/:orgId/scenariosCreate scenario
PATCH/org/:orgId/scenarios/:idUpdate scenario
POST/org/:orgId/scenarios/:id/submitSubmit for approval
POST/org/:orgId/scenarios/:id/approveApprove a pending scenario
POST/org/:orgId/scenarios/:id/rejectReject a pending scenario
POST/org/:orgId/scenarios/:id/mergeMerge an approved scenario into live data
POST/org/:orgId/scenarios/:id/revertDiscard all overlays on a scenario
POST/org/:orgId/scenarios/:id/archiveArchive a scenario
DELETE/org/:orgId/scenarios/:idDelete a scenario
POST/org/:orgId/scenarios/:id/changes/removeRemove a single change overlay

List scenarios

GET /org/:orgId/scenarios

Query parameters

ParameterTypeDefaultDescription
pageinteger1Page number.
limitinteger20Records per page. Max 100.
statusstring--Filter by status. Comma-separated for multiple.
includeArchivedbooleanfalseWhether to include archived scenarios.
createdByMeboolean--Limit to scenarios you created.
sortBystringupdatedAtOne of updatedAt, createdAt, title.
sortDirstringdescasc or desc.

Example

bash
curl -X GET "https://{tenant}.flowstate.inc/api/v1/org/{orgId}/scenarios?status=PENDING_APPROVAL" \
  -H "Authorization: Bearer private_..."

Create a scenario

POST /org/:orgId/scenarios

Request body

FieldTypeRequiredDescription
titlestringYesDisplay name.
descriptionstringNoOptional context.
forkFromScenarioIdstringNoIf set, fork from this scenario. Otherwise fork from live data.

Example

bash
curl -X POST "https://{tenant}.flowstate.inc/api/v1/org/{orgId}/scenarios" \
  -H "Authorization: Bearer private_..." \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Q3 hiring plan",
    "description": "Adds 12 vacancies across Platform and Payments"
  }'

Submit for approval

POST /org/:orgId/scenarios/:id/submit

Moves the scenario from DRAFT to PENDING_APPROVAL and notifies assignees.

Request body

FieldTypeRequiredDescription
assigneeUserIdsstring[]YesUsers who should approve. Must contain at least one user other than the submitter.
notestringNoOptional note for assignees.

Approve a scenario

POST /org/:orgId/scenarios/:id/approve

Moves the scenario from PENDING_APPROVAL to ACTIVE. The caller must be in the scenario's assignee list.

Request body

FieldTypeRequiredDescription
commentstringNoOptional comment recorded with the approval.

WARNING

You cannot approve your own scenario. The server enforces this — submitter and approver must differ.


Reject a scenario

POST /org/:orgId/scenarios/:id/reject

Moves the scenario to REJECTED. The owner can revise and re-submit.

Request body

FieldTypeRequiredDescription
reasonstringYesWhy the scenario was rejected. Surfaced to the owner in their inbox.

Merge a scenario

POST /org/:orgId/scenarios/:id/merge

Applies every overlay in the scenario to live data, transactionally. The scenario must be in ACTIVE status.

Response

json
{
  "data": {
    "success": true,
    "mergeLogId": "clx_merge_log_id",
    "errors": []
  }
}

If success is false, errors contains the reasons. The scenario is left untouched on failure.

WARNING

Merge is destructive. There is no automatic unmerge. To undo, create a new scenario with the inverse changes — the merge log gives you the diff you need.


Revert a scenario

POST /org/:orgId/scenarios/:id/revert

Drops every overlay on the scenario, returning it to a clean fork of its base. The scenario itself remains; only the changes inside it are discarded.


Remove a single change

POST /org/:orgId/scenarios/:id/changes/remove

Removes a single overlay row from the scenario without touching the rest. Useful for selectively rolling back.

Request body

FieldTypeRequiredDescription
entityTypestringYesOne of employee, contractor, vacancy, team, project, aiAgent, allocation.
changeIdstringYesThe ID of the overlay row to remove.

Archive

POST /org/:orgId/scenarios/:id/archive

Moves the scenario to ARCHIVED. Read-only from this point. Merged scenarios are archived automatically.


Delete

DELETE /org/:orgId/scenarios/:id

Hard-deletes a scenario and every overlay it contains. Returns 204 No Content. Cannot be undone — prefer archive for anything you might need to read again.


Querying live data with a scenario context

Every other endpoint in the API accepts a scenarioId query parameter. Pass a scenario's ID and the endpoint returns the merged view — live data with that scenario's overlays applied.

bash
curl -X GET "https://{tenant}.flowstate.inc/api/v1/org/{orgId}/employees?scenarioId=clx_scenario_id" \
  -H "Authorization: Bearer private_..."

This is read-only. To mutate inside a scenario, use the corresponding write endpoint with scenarioId set — for example, POST /employees?scenarioId=... creates the employee inside the scenario rather than as live data.

Where to go next

Flowstate Documentation