curl --request POST \
--url https://api.branchpilot.ai/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template": "lead-routing",
"name": "Lead routing EU"
}
'{
"slug": "<string>",
"name": "<string>",
"type": "route",
"created": true,
"status": "live",
"live_version": 123,
"url": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"levels": [
"<string>"
],
"labels": [
"<string>"
],
"publish_error": "plan_limit",
"message": "<string>",
"upgrade_url": "<string>"
}{
"slug": "<string>",
"name": "<string>",
"type": "route",
"created": true,
"status": "live",
"live_version": 123,
"url": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"levels": [
"<string>"
],
"labels": [
"<string>"
],
"publish_error": "plan_limit",
"message": "<string>",
"upgrade_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Create a decision
Creates a decision and publishes its version 1, from one of three shapes told apart by the
fields present: a catalogue template (template), a one-sentence description drafted by the
LLM (describe), or an explicit definition (name, type, instructions and the
options / levels / labels).
Idempotent on the slug (given, or derived from the name): when the decision already exists it
is returned untouched with created: false. A connector configuration therefore always maps
to the same decision, created on the first run, and the app stays the source of truth.
When the plan’s live-decision limit is reached, the decision is created as a draft:
status is draft, publish_error is plan_limit and message says what to do.
curl --request POST \
--url https://api.branchpilot.ai/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template": "lead-routing",
"name": "Lead routing EU"
}
'{
"slug": "<string>",
"name": "<string>",
"type": "route",
"created": true,
"status": "live",
"live_version": 123,
"url": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"levels": [
"<string>"
],
"labels": [
"<string>"
],
"publish_error": "plan_limit",
"message": "<string>",
"upgrade_url": "<string>"
}{
"slug": "<string>",
"name": "<string>",
"type": "route",
"created": true,
"status": "live",
"live_version": 123,
"url": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"levels": [
"<string>"
],
"labels": [
"<string>"
],
"publish_error": "plan_limit",
"message": "<string>",
"upgrade_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
An API key created in Settings → API keys (bp_live_… or bp_test_…).
Body
One of three shapes, told apart by the fields present — template, describe, or a definition.
Required with a definition. Optional with a template (its name by default) or a description (drafted otherwise). The slug is derived from it, so the same name always maps to the same decision.
120Explicit identifier; derived from the name by default.
64^[a-z0-9]+(-[a-z0-9]+)*$Publish version 1 right away.
Key of a catalogue template (see GET /templates).
Locale of the template.
en, fr What the decision should do, in plain words. The options and the question are drafted by the LLM in the language of the description; type may be imposed.
2000Required with a definition, optional with describe.
route, score, classify Definition — the closed question asked about the input.
Definition — what the input contains and, optionally, its declared fields.
Show child attributes
Show child attributes
Route decisions — 2 to 255 options. Also accepted as one comma- or line-separated string.
An option, a level or a label. A plain string is both the key and the description.
Score decisions — 2 to 10 levels, lowest first.
An option, a level or a label. A plain string is both the key and the description.
Classify decisions — 1 to 50 labels.
An option, a level or a label. A plain string is both the key and the description.
Response
A decision with this slug already existed and is returned as is.
route, score, classify false when a decision with this slug already existed and is returned untouched.
live, draft The decision in the app.
Route decisions — option keys.
Score decisions — level labels, lowest first.
Classify decisions — label keys.
Present when version 1 could not be published.
plan_limit Present when the decision is not live — what to do next.