API Reference: Collection Rules
Read and author Collection validation and lock rules, see the active rules before writing, and dry-run a record write against them.
Overview
A Collection rule decides which record writes a Collection accepts. A validation rule refuses a create or update whose result breaks a condition, for example "a posted entry's debits must equal its credits". A lock rule refuses changes to a record while a condition holds on it, for example "a posted entry cannot change except its memo". Rules are enforced inside the record write on every path: the API, imports, Wizards, automations, integrations, and Ask Simply. There is no bypass flag.
Rules attach to a root STANDARD Collection and govern every record in its hierarchy, including subtypes and SMART members. Every identifier on the wire is a public Simply ID: the Collection (dataCollectionSimplyId), the rule (dataCollectionRuleSimplyId), and every field and Collection inside a definition. Numeric database IDs are never accepted or returned.
Authentication and Authority
Rules are Collection schema. Reads need Collection schema access (TEAM_ADMIN_DC_SCHEMA); an OAuth token also needs schema:read. Team Admins, and System Admins acting in the Team, hold it while the Team has it.
Writes need a signed-in person with Collection schema edit access. A lock rule binds Team Admins too, so the permission belongs only with people who may lock records, and API keys, session tokens, and OAuth clients cannot call the write endpoints; AI clients propose rule changes through a reviewed configuration change set (see Change sets), and the Team User who plans or applies it must hold Collection schema edit access. An API key writes rules only when its own permissions include Collection schema edit access.
On a production-managed Team a direct rule write is refused with 409 SCHEMA_CHANGE_REQUIRES_REVIEW. Submit one reviewed configuration change set instead (see Change sets). It publishes exactly one Team-owned rule through the managed environment path, preserving all other target rules, Collection settings, and fields.
Endpoints
| Method | Path | SDK | Purpose |
|---|---|---|---|
GET | /v1/data-collections/{dataCollectionSimplyId}/rules | s360.dataCollections.listRules(...) | List the Collection's rules, active and inactive. |
POST | /v1/data-collections/{dataCollectionSimplyId}/rules | s360.dataCollections.createRule(...) | Create a rule (201). |
GET | /v1/data-collections/{dataCollectionSimplyId}/rules/{dataCollectionRuleSimplyId} | s360.dataCollections.getRule(...) | Read one rule. |
PATCH | /v1/data-collections/{dataCollectionSimplyId}/rules/{dataCollectionRuleSimplyId} | s360.dataCollections.updateRule(...) | Change any subset of key, name, message, definition, rank, or active state. |
POST | /v1/data-collections/{dataCollectionSimplyId}/rules/{dataCollectionRuleSimplyId}/deactivate | s360.dataCollections.deactivateRule(...) | Stop enforcing a rule and keep it. |
DELETE | /v1/data-collections/{dataCollectionSimplyId}/rules/{dataCollectionRuleSimplyId} | s360.dataCollections.deleteRule(...) | Delete a rule and release the fields it reads. |
The Rule Object
{
"dataCollectionRuleSimplyId": "R7KQ-2M4D-9XPA",
"dataCollectionSimplyId": "JRNL-4K2M-8QWE",
"ruleKey": "posted-lock",
"kind": "LOCK",
"name": { "en": "Posted entries are locked" },
"message": { "en": "A posted entry cannot change. Post a reversing entry instead." },
"definition": {
"schemaVersion": 1,
"kind": "LOCK",
"when": { "logic": "AND", "conditions": [{ "type": "FIELD", "fieldSimplyId": "FLD1-POST-0001", "operator": "EQUALS", "value": true }] },
"allowedFieldSimplyIds": ["FLD1-MEMO-0001"],
"protectedChildren": [{ "dataCollectionSimplyId": "LINE-4K2M-8QWE", "linkDataFieldSimplyId": "FLD1-ENTR-0001" }]
},
"displayRank": 1,
"isActive": true,
"summary": "While Posted equals true, the record is locked: only Memo can change, and it cannot be deleted, archived, restored or merged. Lines records linked through Entry are locked too.",
"referencedFields": [
{ "dataFieldSimplyId": "FLD1-POST-0001", "dataCollectionSimplyId": "JRNL-4K2M-8QWE", "name": "Posted", "dataType": "BOOLEAN" }
],
"ownerBlueprint": null,
"optionLabels": [],
"createdAt": "2026-10-06T15:00:00.000Z",
"updatedAt": "2026-10-06T15:00:00.000Z"
}
ruleKeyis a stable Team-local key (lowercase words joined by-,_, or.), unique on the Collection. A deleted rule frees its key.nameandmessageare TranslatedText with a non-empty English value. A refusal shows the message in the request'sAccept-Language, English otherwise.referencedFieldslists every field the rule reads, including allowed and protected link fields. Those fields cannot be deleted or retyped while the rule exists (409 COLLECTION_RULE_DEPENDENCY).ownerBlueprintnames the connected Blueprint (slug,name) that ships the rule, or isnullfor a Team rule. Show a Blueprint rule read-only; see Rules a Blueprint ships.optionLabelslists each stored option value the summary names (dataFieldSimplyId,value,label), in the request'sAccept-Language. An editor can use it to name a stored option it can no longer look up, such as one retired from its Custom List.
Definitions
A definition is versioned (schemaVersion: 1, contract @s360/contracts/collection-rules).
- VALIDATION:
on(CREATE,UPDATE, or both), optionalwhen, requiredrequire. Judged on the record after every write in the transaction. - LOCK:
when,allowedFieldSimplyIds, and optionalprotectedChildren. Judged on the record before the write. A record created in the same transaction is never locked within it. WithlockedFieldSimplyIdsthe rule is a field lock: only those fields are held (leaveallowedFieldSimplyIdsempty, noprotectedChildren), the rest of the record stays editable and the record can still be deleted, archived, or restored. - REVIEW:
whenonly, judged on the record as saved (noTRANSITION). It refuses no write. On a Collection with record approval, a write by an actor who cannot approve the Collection's records (APPROVE_DATA_RECORDS, or Team Admin) is approved at once unless some activeREVIEWrule holds; then it waits for review as before. With noREVIEWrule, every such write waits for review. Approval-only fields, explicit approval actions, and the integration sync policy are unchanged.
A condition is { "logic": "AND" | "OR", "negate"?: boolean, "conditions": [...], "groups"?: [...] }. Its leaves are the filter FIELD (including one hop through linkedFieldSimplyId) and REFERENCED_BY conditions, plus:
FIELD_COMPARE: two fields, either one hop through a link.AGGREGATE_COMPARE:SUMorCOUNTover live records that link to this record (sourceCollectionSimplyId,relationshipFieldSimplyId,sourceFieldSimplyIdfor SUM, optionalfilterConditions), compared with aNUMBER(non-integers as exact decimal strings), a field, or a second aggregate.TRANSITION(validation only): the field changes intoto, optionally fromfrom. A create counts as a change from empty.
Custom-list values are option record Simply IDs, not labels. AGGREGATED and SCORE fields cannot be operands.
Create a Rule
const { data: rule } = await s360.dataCollections.createRule('JRNL-4K2M-8QWE', {
ruleKey: 'balanced-when-posted',
name: { en: 'Posted entries balance' },
message: { en: 'A posted entry needs equal debits and credits.' },
definition: {
schemaVersion: 1,
kind: 'VALIDATION',
on: ['CREATE', 'UPDATE'],
when: { logic: 'AND', conditions: [{ type: 'TRANSITION', fieldSimplyId: 'FLD1-POST-0001', to: [true] }] },
require: {
logic: 'AND',
conditions: [
{
type: 'AGGREGATE_COMPARE',
left: { type: 'AGGREGATE', aggregation: 'SUM', sourceCollectionSimplyId: 'LINE-4K2M-8QWE', relationshipFieldSimplyId: 'FLD1-ENTR-0001', sourceFieldSimplyId: 'FLD1-DEBT-0001' },
operator: 'EQUALS',
right: { type: 'AGGREGATE', aggregation: 'SUM', sourceCollectionSimplyId: 'LINE-4K2M-8QWE', relationshipFieldSimplyId: 'FLD1-ENTR-0001', sourceFieldSimplyId: 'FLD1-CRDT-0001' },
},
],
},
},
});
A PATCH keeps every omitted value, then validates the merged rule again; reactivating a rule the schema no longer supports is refused. A definition must keep the rule's kind; create a new rule to change it.
Errors
An invalid rule returns 400 VALIDATION_ERROR with every problem in details.errors:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Collection rule definition does not match the Collection schema.",
"details": {
"errors": [
{ "path": "definition.require.conditions.0.left.sourceFieldSimplyId", "code": "AGGREGATE_VALUE_NOT_NUMERIC", "message": "SUM needs a numeric field.", "dataFieldSimplyId": "FLD1-MEMO-0001" }
]
}
}
}
| Code | Meaning |
|---|---|
INVALID_REQUEST / INVALID_DEFINITION | The body or definition does not match the contract. |
UNSUPPORTED_COLLECTION | Rules attach only to root STANDARD Collections. |
COLLECTION_NOT_FOUND, FIELD_NOT_FOUND, LINK_FIELD_INVALID | A named Collection or field is not where the rule reads it. |
FIELD_TYPE_NOT_SUPPORTED, OPERANDS_NOT_COMPARABLE, OPERATOR_NOT_SUPPORTED, AGGREGATE_VALUE_NOT_NUMERIC | The compared values do not fit together. |
TRANSITION_VALUE_INVALID, TRANSITION_NOT_ALLOWED | A TRANSITION value is not valid for its field, or a lock rule uses TRANSITION. |
RULE_KEY_TAKEN, RULE_KIND_IMMUTABLE | The key is used on this Collection, or an update changes the kind. |
SETTLEMENT_COLLECTION | A validation rule on a Collection that payment settlement records charges in (see below). |
Other refusals: 403 PERMISSION_DENIED (no Collection schema access, or no edit access for a write), 404 NOT_FOUND, 409 SCHEMA_CHANGE_REQUIRES_REVIEW (production-managed Team), 409 COLLECTION_RULE_BLUEPRINT_OWNED (a rule a Blueprint ships, see below).
Rules a Blueprint ships
A Blueprint can ship Collection rules. They are keyed <blueprint slug>.<rule> (for example digital-publishing.released-edition-identity) and are added, changed, and removed only by Blueprint installs and upgrades. While that Blueprint is connected, the API and change sets refuse to change, deactivate, or delete one, or to create or rename a rule into that key namespace, with COLLECTION_RULE_BLUEPRINT_OWNED. They are listed and enforced like any other rule; their ownerBlueprint names the Blueprint.
Payment settlement Collections
When a stored payment method is charged, Simply360 records the successful charge as a new record after the money has moved. A validation rule there could refuse that record and leave the charge unrecorded. So a validation rule is refused on a root Collection whose hierarchy holds a Collection that settlement writes to: a Financial Transaction Collection, any Collection's default transaction Collection, or the target Collection of a CHARGE_PAYMENT automation action. Lock rules are allowed there; payments check them before charging.
That refusal is an early warning, because a charge can be routed to a Collection after a rule is saved. The real guard runs at charge time: before calling the payment provider, a CHARGE_PAYMENT action resolves the Collection it will record the charge in (its target Collection, else the participation's transaction Collection) and, when that Collection's root has an active validation rule, fails with 409 SETTLEMENT_COLLECTION_HAS_VALIDATION_RULES without charging. The action is recorded as failed; deactivate the rule or route charges elsewhere, then run the payment again.
What Writers See
GET /v1/data-collections/{dataCollectionSimplyId}/write-profile (MCP describe_collection_for_write) returns collectionRules: each active rule that governs the Collection, with its kind, name, refusal message, a plain-English summary, and the readable fields it reads. It is available to anyone who can read the Collection; fields and Collections the caller cannot read are not named. The MCP Team schema resource lists the same rules per Collection.
In every rule summary, a choice code or a Custom List option value reads as its label, in the request's Accept-Language with an English fallback (English over MCP). A Custom List option keeps its name after it is retired from the list. A value with no known label is shown as stored. The write profile and the Team schema resource label only the values of fields the caller can read, as they name only those fields; a Custom List option name is the same name the caller sees when picking a value in that field. The rules endpoints, which need Collection schema access, label every value.
A refused record write returns one of four codes with details.violations[{ ruleSimplyId, kind, message, dataFieldSimplyIds, recordSimplyId }]: 409 RECORD_LOCKED, 422 COLLECTION_RULE_VIOLATION, 409 COLLECTION_RULE_UNENFORCEABLE (a stored rule no longer matches the schema), and 409 COLLECTION_RULE_WRITE_CONFLICT (retry).
Dry-run a write
The MCP tool validate_data_record_write runs the whole create or update through the record writer inside a transaction that is always rolled back: required fields, unique values, availability policies, the record limit, and Collection rules. It returns valid, applied: false, dryRun: "WRITE_ROLLED_BACK", collectionRuleViolations, and, when the write would be refused, refusal { statusCode, code, message, details }. Nothing is written and no notification, webhook, or automation runs. Like any create attempt, a CREATE dry run reserves one Simply ID that is never used. A payload with a staged File upload is checked without running the writer (dryRun: "CHECKS_ONLY"). A violation names only the fields and records the caller can read (a submitted or readable field, the written record, or a linked record the caller can read); anything else is left out. Every dry run is logged with the Team, Collection, caller, and outcome.
Change Sets, MCP, and Ask Simply
The reviewed path for AI clients is a configuration change set with one DATA_COLLECTION UPDATE resource for the Collection and one of these operations:
{ "resourceType": "DATA_COLLECTION", "action": "UPDATE", "resourceSimplyId": "JRNL-4K2M-8QWE",
"properties": { "operation": "CREATE_COLLECTION_RULE", "rule": { "ruleKey": "...", "name": { "en": "..." }, "message": { "en": "..." }, "definition": { } } } }
CREATE_COLLECTION_RULE:rule, optionaldisplayRankandisActive.UPDATE_COLLECTION_RULE:dataCollectionRuleSimplyIdand the complete replacementrule; omitteddisplayRank/isActivekeep their values.DEACTIVATE_COLLECTION_RULEandDELETE_COLLECTION_RULE:dataCollectionRuleSimplyId.
Each must be the sole desired resource, without bounded record operations. The rule is validated while planning and again at apply, and both steps require the acting Team User to be a current member of the Team with Collection schema edit access (CONFIGURATION_CHANGESET_PERMISSION_DENIED otherwise, including for an OAuth client acting for someone without it and for an actor without a Team membership). Hosted MCP and Ask Simply plan these through plan_team_configuration_change and read rules with list_collection_rules and get_collection_rule. On a production-managed Team the accepted plan is applied on the authoring twin and published through normal signed environment hops. The selected rule's portable preimage must match the review; local numeric IDs and timestamps may differ. Each hop replaces only that rule and its exact derived field links. A successful retry uses the same change set/effect's verified receipt and retains the generated rule Simply ID; changed authoring state refuses with MANAGED_PUBLICATION_AUTHORING_DRIFT. Refresh the review after resolving the drift. To activate, use UPDATE with the complete rule and isActive: true.
Billing and Cost
Rules and their authoring are not billable and create no usage events. A rule check runs inside the record write it guards; a Collection without rules costs one indexed lookup per write.