Skip to main content
See Offline policy for what the rules mean, what devices do with them and what wede checks.

Authentication

An API key of your organisation, or a session of a user of your organisation. Reading needs policies:view and changing needs policies:manage, which administrators, technical staff and API keys have. GET /v1/policies/current also accepts any credential with sync:write, so every device that syncs can read the policy in use. The policy is the same for production and the sandbox.

The policy in use

GET /v1/policies/current The document devices keep and apply, with its sha256. Both are null when no policy is in use.
string
SHA-256 of policy in canonical JSON (object keys sorted at every level, no spaces). Rules come sorted by operation type and currency, so the same rules always give the same document.

Create a version

POST /v1/policies
string
required
1 to 120 characters.
array
required
1 to 200 rules, one per operation type and currency: operation_type (an operation type of your catalog), currency (3 letters), max_amount_minor (whole number, minor units) and, optionally, cumulative with max_amount_minor, max_count or both. Any other field is refused.
boolean
true makes this version the one in use at once. Default false.
201 Created
A version never changes once saved: to change a rule, create the next version.

Choose the version in use

POST /v1/policies/{id}/activate makes a version the one in use; the previous one is kept. Devices receive it at their next sync. An archived version cannot be used again (409 archived). POST /v1/policies/{id}/archive stops a version and takes it out of the list. Archiving the version in use leaves no policy in use: devices stop applying limits once they sync. Both return the version.

List and read

GET /v1/policies returns the versions of your organisation in data, the newest first; add archived=true to include the archived ones. GET /v1/policies/{id} returns one version.

Decisions

GET /v1/policies/decisions The decisions wede checked, the newest first, with a count per result in summary.
boolean
true returns only the decisions that did not match.
string
production (default) or sandbox, with a session. With an API key, the environment of the key.
integer
1 to 500. Default 100.
string
What the device decided: allowed, declined (with rule) or no_policy.
integer
What the device had accepted for this type and currency since its last sync, before this operation. cumulative_count is the number.
string
ok, or the reason it did not match: over_max_amount, over_cumulative_amount, over_cumulative_count, declined_but_sent, unknown_version, policy_altered, cumulative_missing, cumulative_chain or decision_invalid. See What wede checks.
An operation is never refused or delayed because of its decision: it is kept like any other.

Errors