Version 2.4.7.20261116085428 · latest

CC rules cc-rules

Ordered combinations of matchers and filters; a site can pick one rule group.

Pick an endpoint to see its example call on the right.

ProtectionAuthentication: User (some parameters admin only)6 endpoints

Authentication

Send the X-API-Key header (create a key on the API Keys page; the key is shown only once at creation). An Authorization: Bearer token obtained by logging in also works.

X-API-Key

Authentication failures return 401; forbidden returns 403 (code such as insufficient_scope).

Conventions

Paging uses page (from 1) and page_size; sort with sort=field or sort=-field.

Times are RFC 3339 (UTC); amounts are in cents.

Writes return 200/201/204 on success; duplicates of a unique key return 409.

GET/api/v2/cc-rulesList CC rule groups

Authentication: User (some parameters admin only)

Query parameters

FieldTypeDescription
pageinteger Page number, starting from 1
Default 1
page_sizeinteger Items per page
Default 20
sortstring Sort fields, comma-separated; prefix `-` for descending, e.g. `-created_at,id`
tenant_idinteger Admin only: filter by tenant (a malformed value returns 422). Ignored for tenant credentials, which only see their own tenant's data
enabledboolean Filter by enabled state.
namestring Filter by name substring.
ownerstring platform = platform objects only; tenant = tenant objects only.
Values ["platform","tenant"]
POST/api/v2/cc-rulesCreate CC rule group

Authentication: User (some parameters admin only)

Request body application/json

FieldTypeDescription
desstring Remark; empty if omitted (omitting it on update also clears it, since the update replaces the whole object).
enabledboolean Whether enabled
Default true
expected_updated_atstring Optimistic lock, update only - the updated_at as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. Ignored on create.
itemsRequiredCcRuleItem[] Rule items, executed in order; the count is limited by the setting protect.cc_rule_items_max.
nameRequiredstring Name
show_tointeger[] Tenants that can see a platform rule group; empty = visible to all tenants, otherwise only the listed tenants can see it and select it as a site's cc_level. Returned to admins only.
sortinteger Panel sort order (smaller first).
tenant_idinteger Owning tenant; null = platform object (built-in or created by an admin, read-only for tenants).
visibleboolean Shown in the site's rule group drop-down.
Default true
POST/api/v2/cc-rules/batch-enableBatch enable or disable CC rule groups

Authentication: User (some parameters admin only)

Request body application/json

FieldTypeDescription
enabledRequiredboolean Whether enabled
Default true
idsRequiredinteger[] IDs of the objects to change, at most 100.
GET/api/v2/cc-rules/{id}Get CC rule group

Authentication: User (some parameters admin only)

PUT/api/v2/cc-rules/{id}Update CC rule group

Authentication: User (some parameters admin only)

Request body application/json

FieldTypeDescription
desstring Remark; empty if omitted (omitting it on update also clears it, since the update replaces the whole object).
enabledboolean Whether enabled
Default true
expected_updated_atstring Optimistic lock, update only - the updated_at as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. Ignored on create.
itemsRequiredCcRuleItem[] Rule items, executed in order; the count is limited by the setting protect.cc_rule_items_max.
nameRequiredstring Name
show_tointeger[] Tenants that can see a platform rule group; empty = visible to all tenants, otherwise only the listed tenants can see it and select it as a site's cc_level. Returned to admins only.
sortinteger Panel sort order (smaller first).
tenant_idinteger Owning tenant; null = platform object (built-in or created by an admin, read-only for tenants).
visibleboolean Shown in the site's rule group drop-down.
Default true
DELETE/api/v2/cc-rules/{id}Delete CC rule group

Authentication: User (some parameters admin only)

CC rules object

FieldTypeDescription
builtinboolean Built-in object; cannot be deleted.
read-only
created_atstring Created at
read-only
desstring Remark; empty if omitted (omitting it on update also clears it, since the update replaces the whole object).
enabledboolean Whether enabled
Default true
errorsFieldError[] Why each remaining item was not changed; field is /ids/<index>, code as in the single-item update (not_found, readonly and so on).
expected_updated_atstring Optimistic lock, update only - the updated_at as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. Ignored on create.
idinteger Record ID
read-only
idsRequiredinteger[] IDs of the objects to change, at most 100.
itemsCcRuleItem[] Rule items, executed in order; the count is limited by the setting protect.cc_rule_items_max.
namestring Name
ruleset_idstring Compiled ruleset id: cc.level.<name> for platform groups (referenced by the site's cc_level and guard.default_cc_level); cc.user.r<id> for tenant groups (selectable as cc_level by the tenant's own sites; sites on a package need custom_cc_rule).
read-only
show_tointeger[] Tenants that can see a platform rule group; empty = visible to all tenants, otherwise only the listed tenants can see it and select it as a site's cc_level. Returned to admins only.
sortinteger Panel sort order (smaller first).
tenant_idinteger Owning tenant; null = platform object (built-in or created by an admin, read-only for tenants).
read-only
updatedinteger[] IDs that were set (including those already in the target state), in request order.
updated_atstring Updated at
read-only
visibleboolean Shown in the site's rule group drop-down.
Default true

Responses and errors

Success returns the resource JSON directly (HTTP 2xx); failures return application/problem+json (code, detail, plus errors on validation failures); lists carry items + total.

Success
{
  "id": 1,
  "name": "example"
}
List
{
  "items": [
    {
      "id": 1
    }
  ],
  "page": 1,
  "page_size": 20,
  "total": 1
}
Error
{
  "code": "validation_failed",
  "detail": "Invalid request parameters",
  "errors": [
    {
      "code": "required",
      "field": "/name",
      "message": "name is required"
    }
  ],
  "request_id": "0123456789abcdef",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "about:blank"
}
Get started

Try the live demo

Open the live demo, or contact us for a quote and the install command