Skip to main content
Billing rules let you define conditional logic that modifies how sessions are priced. A rule is made up of conditions — criteria that must be true for the rule to fire — and actions — the pricing modifications to apply when they do. Rules are evaluated at session close. When multiple rules match a session, they are applied in priority order (lowest number = highest priority).

Conditions

Actions


Create a billing rule

POST /api/v1/billing/rules
string
required
Display name for the rule.
number
required
Evaluation order. Lower numbers are evaluated first. Must be a positive integer.
object[]
required
Array of condition objects. All conditions must match for the rule to fire.
object[]
required
Array of action objects to apply when conditions are met.
boolean
default:"true"
Whether the rule is active. Inactive rules are stored but never evaluated.
string
Unique identifier for the created rule.
number
Evaluation order for this rule.
boolean
Whether the rule is currently being evaluated.

List billing rules

GET /api/v1/billing/rules Returns all billing rules for your organisation, ordered by priority.
boolean
Filter by active status. Set to true to return only active rules.

Get a billing rule

GET /api/v1/billing/rules/{rule_id}
string
required
The unique identifier of the billing rule.

Update a billing rule

PUT /api/v1/billing/rules/{rule_id} Replaces all fields on a billing rule. Changes apply to sessions closed after the update.
string
required
The unique identifier of the billing rule.
string
required
Updated rule name.
number
required
Updated priority.
object[]
required
Full replacement condition set.
object[]
required
Full replacement action set.
boolean
required
Active status.

Delete a billing rule

DELETE /api/v1/billing/rules/{rule_id}
string
required
The unique identifier of the billing rule to delete.
Returns 204 No Content on success.

Test a billing rule

POST /api/v1/billing/rules/{rule_id}/test Evaluates a rule against a hypothetical session without creating any real charges. Use this to verify that your conditions and actions behave as expected before activating a rule.
string
required
The rule to test.
object
required
Hypothetical session data to test against.
boolean
Whether all conditions matched the hypothetical session.
object[]
Each condition and whether it matched.
object[]
Actions that were applied and a description of the effect.
number
Cost before the rule was applied.
number
Cost after the rule was applied.
number
Difference between base cost and adjusted cost.