Rulesets - developer preview

Create and manage resolution rulesets and their child rules.

Base URL: https://api.chargebackstop.com/v1/rulesets/

Authentication: Bearer token via API key.

Required abilities:

  • rulesets:read for GET endpoints

  • rulesets:write for POST, PATCH, and DELETE endpoints

Access scope model:

  • Organisation-level keys can access rulesets for their own organisation only.

  • Admin partner-group keys can access rulesets across all organisations for their partner.

  • Non-admin partner-group keys can access rulesets only for organisations assigned to their group.


POST /v1/rulesets - create ruleset

Creates one ruleset and optionally creates child rules within the same request.

API level: Organisation-level and partner-level Authentication: rulesets:write

Request body

Field
Type
Description

organisation_id

string

Organisation ID

enrolment_ids

array[string]

One or more enrolment IDs

outcome

string

REFUND, CANCEL, REFUND_AND_CANCEL, or ACCEPT_DISPUTE

join_operator

string

AND or OR

is_enabled

boolean

Optional, defaults to true

rules

array[object]

Optional initial rules

circle-info

All selected enrolments must be accessible and must share the same supported enrolment type.

Only one rule of each type is allowed per ruleset.

Amount rules must use USD.

If any embedded rule fails validation, the entire ruleset creation is rolled back.

Example 1 request

Example 1 response


GET /v1/rulesets - list rulesets

Returns a paginated list of accessible rulesets.

API level: Organisation-level and partner-level Authentication: rulesets:read

Query parameters

Parameter
Type
Description

organisation_id

string

Filter by organisation ID

sort

string

-created_at (default), created_at, -updated_at, or updated_at

limit

integer

Number of results per page

offset

integer

Number of results to skip

Example 2 request

Example 2 response


GET /v1/rulesets/{ruleset_id} - get ruleset by ID

Returns one accessible ruleset.

API level: Organisation-level and partner-level Authentication: rulesets:read

Example 3 request

Example 3 response


PATCH /v1/rulesets/{ruleset_id} - update ruleset

Updates one accessible ruleset.

API level: Organisation-level and partner-level Authentication: rulesets:write

Request body

Field
Type
Description

enrolment_ids

array[string]

Optional. One or more enrolment IDs

outcome

string

Optional. REFUND, CANCEL, REFUND_AND_CANCEL, or ACCEPT_DISPUTE

join_operator

string

Optional. AND or OR

is_enabled

boolean

Optional. Whether the ruleset is enabled

circle-info

Send only the mutable fields you want to change. Omitted fields keep their existing values.

rules is not accepted on this endpoint. Update child rules through the nested rule endpoints instead.

All selected enrolments must be accessible and must share the same supported enrolment type.

Example 4 request

Example 4 response


DELETE /v1/rulesets/{ruleset_id} - delete ruleset

Deletes one accessible ruleset and its child rules.

API level: Organisation-level and partner-level Authentication: rulesets:write

circle-info

The response body is empty on success.

Example 5 request

Example 5 response


POST /v1/rulesets/{ruleset_id}/rules - add rule

Adds one rule to an existing accessible ruleset.

API level: Organisation-level and partner-level Authentication: rulesets:write

Example 6 request

Example 6 response


GET /v1/rulesets/{ruleset_id}/rules/{rule_id} - get rule by ID

Returns one accessible rule from an accessible ruleset.

API level: Organisation-level and partner-level Authentication: rulesets:read

Example 7 request

Example 7 response


PATCH /v1/rulesets/{ruleset_id}/rules/{rule_id} - update rule

Updates one accessible rule within an accessible ruleset.

API level: Organisation-level and partner-level Authentication: rulesets:write

Request body

Field
Type
Description

type

string

Must match the existing rule type

parameters

object

Rule parameters for the selected type

circle-info

Rule type cannot be changed.

Amount rules must use USD.

Example 8 request

Example 8 response


DELETE /v1/rulesets/{ruleset_id}/rules/{rule_id} - delete rule

Deletes one accessible rule from an accessible ruleset.

API level: Organisation-level and partner-level Authentication: rulesets:write

circle-info

The response body is empty on success.

Example 9 request

Example 9 response


Error examples

Example 10: forbidden

Example 11: not found

Example 12: invalid currency

Example 13: rules not allowed on ruleset update

Last updated

Was this helpful?