API reference
Rules
Booking rules simulation
| Method | Path | Summary |
|---|---|---|
GET | /v1/account/rules/catalog | Facts the rules can use, rule templates, and plain-language warnings for the draft rules |
POST | /v1/account/rules/simulate | "Try it": run booking rules against described facts or a past call |
Facts the rules can use, rule templates, and plain-language warnings for the draft rules#
GET /v1/account/rules/catalog
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
playbookId | string (pb_… ID) | Yes | ID (pb_…) |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
facts | array<object> | Yes | — |
facts[].group | enum | Yes | One of: "collected", "caller_record", "call_context", "availability", "tool". |
facts[].key | string | Yes | — |
facts[].label | string | Yes | — |
facts[].options | array<object> | No | — |
facts[].options[].label | string | Yes | — |
facts[].options[].value | string | Yes | — |
facts[].phrases | object | No | — |
facts[].phrases.false | string | Yes | — |
facts[].phrases.true | string | Yes | — |
facts[].type | enum | Yes | One of: "boolean", "number", "enum", "text". |
facts[].unit | enum | No | One of: "days", "seconds", "slots", "hour". |
rules | array<object> | Yes | — |
rules[].description | string | Yes | — |
rules[].ruleId | string | Yes | — |
rules[].ruleNumber | integer | Yes | — |
templates | array<object> | Yes | — |
templates[].description | string | Yes | — |
templates[].id | string | Yes | — |
templates[].rule | any | Yes | — |
templates[].title | string | Yes | — |
warnings | array<object> | Yes | — |
warnings[].code | string | Yes | — |
warnings[].fix | object | No | — |
warnings[].fix.kind | string | Yes | — |
warnings[].fix.label | string | Yes | — |
warnings[].message | string | Yes | — |
warnings[].ruleId | string | null | Yes | — |
warnings[].severity | enum | Yes | One of: "error", "warning". |
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
bash
curl -X GET "$ANSWERSTACK_API_URL/v1/account/rules/catalog?playbookId=pb_2ZPh7XbT0v9Ao4iJ3qK1mN8sRgE" \
-H "Authorization: Bearer $ACCESS_TOKEN""Try it": run booking rules against described facts or a past call#
POST /v1/account/rules/simulate
Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token). Bearer token: Authorization: Bearer <token> (An API token (ans_pat_ or ans_svc_). Only routes that list a scope here accept one, and only with that scope.).
Request body
application/json, required.
| Field | Type | Required | Description |
|---|---|---|---|
callId | string (call_… ID) | No | ID (call_…) |
facts | map | No | — |
facts.{key} | string | number | boolean | null | No | Any key. |
playbookId | string (pb_… ID) | No | ID (pb_…) |
rules | array<any> | No | Up to 200 items. |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
action | any | null | Yes | — |
callRuleFired | string | null | Yes | — |
facts | map | Yes | — |
facts.{key} | string | number | boolean | null | No | Any key. |
matchedRuleId | string | null | Yes | — |
outcome | string | Yes | — |
perRule | array<object> | Yes | — |
perRule[].description | string | Yes | — |
perRule[].matched | boolean | Yes | — |
perRule[].reason | string | Yes | — |
perRule[].ruleId | string | Yes | — |
perRule[].ruleNumber | integer | Yes | — |
perRule[].status | enum | Yes | One of: "matched", "not_matched", "disabled", "not_reached". |
warnings | array<object> | Yes | — |
warnings[].code | string | Yes | — |
warnings[].fix | object | No | — |
warnings[].fix.kind | string | Yes | — |
warnings[].fix.label | string | Yes | — |
warnings[].message | string | Yes | — |
warnings[].ruleId | string | null | Yes | — |
warnings[].severity | enum | Yes | One of: "error", "warning". |
withheldFacts | array<string> | Yes | — |
Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.
Example
bash
curl -X POST "$ANSWERSTACK_API_URL/v1/account/rules/simulate" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"callId": "call_2ZPh7XbT0v9Ao4iJ3qK1mN8sRgE",
"facts": {},
"playbookId": "pb_2ZPh7XbT0v9Ao4iJ3qK1mN8sRgE",
"rules": [
{}
]
}'