Send a share of live traffic to a branch
POST /Platform/entities/branch-traffic
Send a share of live traffic to a branch.
Runs an A/B experiment: the branch's changes (routing, agents,
workflows, documents) are the variant. Each inbound contact (caller,
sender, chat visitor) is assigned by a stable hash, so the same person
always lands on the same side. A contact assigned to the branch is
handled with the branch's configuration, and everything it produces
(calls, conversations, messages) is still written to main, stamped
with _read_branch so you can compare: the branch name for the
variant, main for the control group (contacts that met the
condition but stayed on main). Several branches can take traffic at
once; their shares never overlap, and changing one never moves another's
contacts.
Takes effect for new contacts within seconds and reaches real callers
immediately, and so does every later edit to the branch. So it needs
the permission to approve changesets (org admins hold it), whether or
not main is protected, and every change is in the audit log. Set
percent to 0, delete the branch, or merge it to end the experiment.
An experiment ended with percent 0 stays listed (with
include_ended) with when it ran, so its results can still be
compared; a share on it resumes it with the same contacts. It is gone
once it is forgotten or its branch is deleted or merged.
Body parameters
branch: str. The experiment branch, which must already hold a change. The main branch, simulation (lab) branches and branches pinned to a point in time cannot take traffic.percent: int. Share of eligible contacts to send to the branch, 0-100; 0 ends the experiment.condition: optional dict. When the experiment applies, as a routing condition (for example{"schedule": {...}}for open hours, or{"event_type": "voice"}). Unset means always.description: optional str. What this experiment tests, in a sentence or two; shown wherever the experiment is listed. Kept when omitted.forget: optional bool. Withpercent0, remove the experiment from the list instead of keeping it as ended.max_contacts: optional int. The most people the experiment may take, so a risky change reaches only a few real contacts. A person already in it keeps coming back to it; the first new person past the limit ends the experiment (aspercent0 would) and goes tomain. Kept when omitted; 0 removes the limit.
Returns
BranchTraffic or null
Example request
curl -X POST "https://api.hilus.ai/Platform/entities/branch-traffic" \
-H "Authorization: Bearer $HILUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'