For the complete documentation index, see llms.txt. This page is also available as Markdown.

Scheduling Rule Sets

Configure deterministic scheduling rules that filter appointment slots before they reach the agent.

Scheduling rule sets define workspace-scoped configuration for the deterministic scheduling rules engine. Each rule set binds an agent kind and rule kind to a typed parameter block that controls how the engine filters appointment slots.

Rule sets are scoped to a workspace. The combination of agent kind and rule kind is unique per workspace - each workspace can have at most one rule set per (agent kind, rule kind) pair.

Endpoints

All endpoints are scoped to a workspace: /v1/{workspace_id}/scheduling-rule-sets

Method
Path
Description

GET

/

List scheduling rule sets

GET

/{rule_set_id}

Get one scheduling rule set

POST

/

Create a scheduling rule set

PATCH

/{rule_set_id}

Partially update a scheduling rule set

DELETE

/{rule_set_id}

Delete a scheduling rule set

List Scheduling Rule Sets

Returns a paginated list of scheduling rule sets for the workspace.

List scheduling rule sets

get

List all scheduling rule sets for the workspace. Optional filters: agent_kind (tms / ketamine / general), is_active. Used by the agent-engine rules engine and by operators inspecting config.

Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
Query parameters
agent_kindstring · enum · nullableOptionalPossible values:
is_activeboolean · nullableOptional
limitinteger · max: 100OptionalDefault: 10
continuation_tokenintegerOptionalDefault: 0
Responses
200

Successful Response

application/json
has_morebooleanRequired
continuation_tokeninteger · nullableOptional
totalinteger · nullableOptional
get/v1/{workspace_id}/scheduling-rule-sets

Permissions: Workspace.view

Get One Scheduling Rule Set

Returns a single scheduling rule set by ID.

Get one scheduling rule set

get

Fetch one rule set by id. Returns 404 when the row doesn't exist in this workspace (the RLS policy means cross-workspace lookups surface as 404, never as a row from the wrong workspace).

Permissions: Workspace.view.

Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
rule_set_idstring · uuidRequired
Responses
200

Successful Response

application/json

Wire shape for a single rule set. params stays as dict here (not the discriminated union) so add-a-new-kind doesn't break older clients still on the previous SDK version — the SDK's typed helpers can re-validate into RuleParams when needed.

idstring · uuidRequired
workspace_idstring · uuidRequired
agent_kindstring · enumRequiredPossible values:
rule_kindstring · enumRequiredPossible values:
is_activebooleanRequired
created_bystring · uuid · nullableRequired
created_atstring · date-time · nullableRequired
updated_atstring · date-time · nullableRequired
get/v1/{workspace_id}/scheduling-rule-sets/{rule_set_id}

Permissions: Workspace.view

Create a Scheduling Rule Set

Creates a new scheduling rule set. The rule_kind is determined by the discriminator field inside params.

Create a scheduling rule set

post

Create one rule set for (agent_kind, rule_kind). Returns 409 if a row already exists for that key — use PATCH on the existing row or DELETE first.

Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
Body
agent_kindstring · enumRequiredPossible values:
paramsone ofRequired

Per-rule-kind typed parameters. The rule_kind discriminator field selects the params shape; one row per (agent_kind, rule_kind) per workspace.

or
or
or
or
or
is_activebooleanOptionalDefault: true
Responses
201

Successful Response

application/json

Wire shape for a single rule set. params stays as dict here (not the discriminated union) so add-a-new-kind doesn't break older clients still on the previous SDK version — the SDK's typed helpers can re-validate into RuleParams when needed.

idstring · uuidRequired
workspace_idstring · uuidRequired
agent_kindstring · enumRequiredPossible values:
rule_kindstring · enumRequiredPossible values:
is_activebooleanRequired
created_bystring · uuid · nullableRequired
created_atstring · date-time · nullableRequired
updated_atstring · date-time · nullableRequired
post/v1/{workspace_id}/scheduling-rule-sets

Permissions: Workspace.update

Errors:

  • 409 - A rule set already exists for this (agent kind, rule kind). Update the existing row or delete it first.

  • 422 - Invalid request body or rule kind discriminator

Update a Scheduling Rule Set

Partially updates an existing rule set. Only params and is_active can be changed. agent_kind and rule_kind are immutable - to change either, create a new rule set and delete the old one.

When updating params, send the complete params object for the rule kind. Partial updates within params are not supported. At least one field must be provided.

Partially update a scheduling rule set

patch

Update params and/or is_active on an existing rule set. agent_kind and rule_kind are immutable — to change either, create a new rule set and delete the old one.

Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
rule_set_idstring · uuidRequired
Body

Partial update — fields not provided are unchanged. params must be the full per-kind shape (no patch within params); send the whole RuleParams or omit.

paramsone of · nullableOptional
or
or
or
or
or
is_activeboolean · nullableOptional
Responses
200

Successful Response

application/json

Wire shape for a single rule set. params stays as dict here (not the discriminated union) so add-a-new-kind doesn't break older clients still on the previous SDK version — the SDK's typed helpers can re-validate into RuleParams when needed.

idstring · uuidRequired
workspace_idstring · uuidRequired
agent_kindstring · enumRequiredPossible values:
rule_kindstring · enumRequiredPossible values:
is_activebooleanRequired
created_bystring · uuid · nullableRequired
created_atstring · date-time · nullableRequired
updated_atstring · date-time · nullableRequired
patch/v1/{workspace_id}/scheduling-rule-sets/{rule_set_id}

Permissions: Workspace.update

Errors:

  • 404 - Rule set not found in this workspace

  • 422 - Empty update body, or the params discriminator does not match the existing rule's kind

Delete a Scheduling Rule Set

Permanently deletes a scheduling rule set. The deletion is recorded in the audit log.

Delete a scheduling rule set

delete

Hard-delete. The audit log retains the deletion record.

Authorizations
AuthorizationstringRequired

API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.

Path parameters
workspace_idstring · uuidRequired
rule_set_idstring · uuidRequired
Responses
204

Successful Response

No content

delete/v1/{workspace_id}/scheduling-rule-sets/{rule_set_id}

No content

Permissions: Workspace.update

Errors:

  • 404 - Rule set not found in this workspace

Rule Set Model

Field
Type
Description

id

UUID

Unique identifier

workspace_id

UUID

Workspace this rule set belongs to

agent_kind

string

Agent kind: tms, ketamine, or general

rule_kind

string

Rule kind (see Rule Kinds below)

params

object

Per-rule-kind typed parameters

is_active

boolean

Whether this rule is active

created_by

UUID or null

Entity that created this rule set

created_at

datetime or null

Creation timestamp

updated_at

datetime or null

Last update timestamp

Rule Kinds

The params object uses a discriminated union keyed by rule_kind. Each rule kind has its own parameter shape.

clinic_open_hours

Defines clinic open hours by weekday. Days not present mean the clinic is closed that day.

Field
Type
Description

rule_kind

"clinic_open_hours"

Discriminator

timezone

string

Timezone identifier (e.g., America/New_York)

monday

object or null

{start, end} in HH:MM 24-hour format

tuesday

object or null

{start, end} in HH:MM 24-hour format

wednesday

object or null

{start, end} in HH:MM 24-hour format

thursday

object or null

{start, end} in HH:MM 24-hour format

friday

object or null

{start, end} in HH:MM 24-hour format

saturday

object or null

{start, end} in HH:MM 24-hour format

sunday

object or null

{start, end} in HH:MM 24-hour format

tms_mapping_release

Controls how long before a TMS mapping appointment its slot is released back to the pool.

Field
Type
Description

rule_kind

"tms_mapping_release"

Discriminator

reservation_window_hours

integer (0-720)

Hours before mapping appointment to release the slot

weekend_skip

boolean

Whether to skip weekends in the countdown (default true)

tms_session_grid

Restricts TMS session start times to fixed minute-of-hour boundaries so sessions run back-to-back without gaps.

Field
Type
Description

rule_kind

"tms_session_grid"

Discriminator

interval_minutes

integer (5-120)

Interval between session starts

boundary_minutes

array of integers

Allowed minute-of-hour values (0-59), at least one required

ketamine_block_overlap

Blocks follow-up appointments within a clinical safety window after a ketamine session.

Field
Type
Description

rule_kind

"ketamine_block_overlap"

Discriminator

window_days

integer (1-365)

Days after a ketamine session to block follow-up appointments

ninety_day_rolling

Caps appointments per patient within a rolling time window.

Field
Type
Description

rule_kind

"ninety_day_rolling"

Discriminator

days

integer (1-365)

Rolling window length in days

concurrent_start_block

Prevents two slots from starting at the same time within a scope. No additional parameters beyond the discriminator.

Field
Type
Description

rule_kind

"concurrent_start_block"

Discriminator

Example

Create a clinic open hours rule:

Update params on an existing rule:

Disable a rule without deleting it:

Last updated

Was this helpful?