Compliance

Base URL: $BUSINESS_API

The object

classstring · optional

one of audit_logs, readings, invoices, sessions

retention_daysinteger · optional
is_defaultboolean · optional
expired_beforestring (date-time) · optional
expired_countinteger · optional
marked_atstring (date-time) · optional
The object
{
  "class": "audit_logs",
  "retention_days": 1,
  "is_default": true,
  "expired_before": "2026-11-19T09:30:00Z",
  "expired_count": 1,
  "marked_at": "2026-11-19T09:30:00Z"
}

Get the retention schedule

Logs

GET /compliance/retention

Returns the tenant's data retention period for each record class (audit_logs, readings, invoices, sessions), with is_default showing whether the built-in period applies (365, 1825, 3650 and 90 days respectively). When the background sweep has run, each class also shows the cutoff before which records are past retention, how many there are, and when they were marked. Requires compliance:read.

Returns

200 Get the retention schedule

Show attributes
dataarray of RetentionClass · optional
Show child attributes
classstring · optional

one of audit_logs, readings, invoices, sessions

retention_daysinteger · optional
is_defaultboolean · optional
expired_beforestring (date-time) · optional
expired_countinteger · optional
marked_atstring (date-time) · optional

Errors 400 · 401

Permissions compliance:read · Roles: admin, owner

curl -X GET "$BUSINESS_API/compliance/retention" \
  -H "Authorization: Bearer sk_test_..."
Response 200
{
  "data": [
    {
      "class": "audit_logs",
      "retention_days": 1,
      "is_default": true,
      "expired_before": "2026-11-19T09:30:00Z",
      "expired_count": 1,
      "marked_at": "2026-11-19T09:30:00Z"
    }
  ]
}

Update retention days per class

Logs

PUT /compliance/retention

Sets the retention period of the classes sent in classes; classes left out keep their current value, and the response is the full schedule. Each class must be one of audit_logs, readings, invoices or sessions, and retention_days must be between 1 and 36500; any invalid entry rejects the whole request with 400 before anything is saved. The change is written to the audit log, and the background sweep only marks expired records, it does not delete audit events. Requires compliance:retention.

Body application/json

classesarray of object · required
Show child attributes
classstring · required
retention_daysinteger · required

Returns

200 Update retention days per class

Show attributes
dataarray of RetentionClass · optional
Show child attributes
classstring · optional

one of audit_logs, readings, invoices, sessions

retention_daysinteger · optional
is_defaultboolean · optional
expired_beforestring (date-time) · optional
expired_countinteger · optional
marked_atstring (date-time) · optional

Errors 400 · 401

Permissions compliance:retention · Roles: admin, owner

curl -X PUT "$BUSINESS_API/compliance/retention" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "classes": [
    {
      "class": "class",
      "retention_days": 1
    }
  ]
}'
Response 200
{
  "data": [
    {
      "class": "audit_logs",
      "retention_days": 1,
      "is_default": true,
      "expired_before": "2026-11-19T09:30:00Z",
      "expired_count": 1,
      "marked_at": "2026-11-19T09:30:00Z"
    }
  ]
}