Skip to main content
PUT
Update Rule

Authorizations

Authorization
string
header
required

Use Tuner API key (tr_api_...) or user session token. Find your API key in Workspace Settings > API Keys.

Path Parameters

rule_id
integer
required

ID of the rule

agent_id
string
required

Tuner's numeric agent ID, or your Agent ID from Agent Settings > Agent Connection. Digits-only values are read as the numeric ID.

workspace_id
integer
required

Workspace ID. Find this in Workspace > General Settings.

Body

application/json

Schema for updating a rule.

Leave a field out to keep its current value. For every field except output_description, null is the same as leaving it out.

condition_tree
RuleConditionGroup · object | null

The condition a call must match. The root is always a group (AND or OR) of predicates and nested groups, even for a single condition, and every node needs a type (group or predicate). Build each predicate from an item in List Rule Conditions: for an eval, a data extraction field or a voice metric, lhs is the item's name, source its source_type and field_id its id; for a latency percentile, lhs is the item's id (such as "p90_latency"); for Call Outcome, Call Intent, Call Duration, Call Cost, Call Outcome Type and Call Ended Reason, lhs is call_outcome, call_intent, call_duration, call_cost, call_outcome_type or call_ended_reason; for Extra Metadata, lhs is metadata.<key>. op is a word (eq, neq, gt, gte, lt, lte, exists, not_exists, contains, starts_with), not the symbol List Rule Conditions returns. eq, neq, contains and starts_with on text ignore case. exists and not_exists work on any field, even where List Rule Conditions doesn't list them. A field with no value for the call counts as not existing. A field the analysis skipped, such as an eval that didn't run or the intent of a call whose outcome stopped the analysis, matches only not_exists, not even neq. Groups nest at most 10 levels deep, and a tree holds at most 50 conditions. Replaces the rule's whole condition. Leave it out to keep the current condition.

Example:
output_type
enum<string>

Whether a matching call gets a label or a red flag. Any other value returns a 422.

Available options:
label,
red_flag
output_tag_name
string | null

Tag applied to matching calls.

Required string length: 1 - 200
Example:

"Missed disclosure"

output_description
string | null

Optional note explaining what this rule is for. Leave it out to keep the current note. Send null to remove it (it is then returned as null), or "" to set it to an empty string.

Example:

"Flags calls where the required disclosure was missed."

state
enum<string> | null

paused rules don't run on new calls. A rule Tuner paused (it has a paused_reason) needs a working condition before it can be set back to active.

Available options:
active,
paused
Example:

"paused"

Response

Successful Response

Response schema for a rule.

id
integer
required

Tuner's ID for this rule.

output_type
string
required

Whether matching calls get a label or a red flag.

output_tag_name
string
required

Tag applied to matching calls.

state
string
required

active when the rule runs on new calls, paused when it doesn't.

Example:

"active"

created_at
string<date-time>
required

When the rule was created.

updated_at
string<date-time>
required

When the rule was last updated.

condition_tree
Condition Tree · object | null

The rule's conditions: a group of predicates and nested groups, in the format condition_tree takes when you create or update a rule. For an eval, a voice metric or a data extraction field, lhs is the item's current name. null only for an older rule whose condition could not be converted; it never matches.

Example:
output_description
string | null

Note explaining what this rule is for.

paused_reason
string | null

Why Tuner paused this rule, such as Eval deleted when the eval its condition used was deleted. Null when it is active or a person paused it.

Example:

null