# Instructions for Fluent Acl (Access Control List) API
Always reference the Acl API specifications for more details.
1. when `type` is `record`, provide the `table` and `field` properties, `appliesTo` is only applicable to `record` type ACL too but optional and `name` is not applicable.
2. `roles` property is an array whose entries are a role name string (a non-GUID string is resolved by role name at build time, e.g. `'itil'`), a sys_id, or a Role object. If using a new role, use the Role object. If using an existing role, its name is enough (or its sys_id). Do not wrap the name in `Now.ref('sys_user_role', { name: 'ex_role' })`: the ACL build writes that entry as a fresh random sys_id without the name key, so it never resolves.
3. The `script` property is optional and should only be used for advanced ACLs where the condition cannot be expressed using just the `roles` and `condition` fields.
4. a `named ACL` can be created by providing a value for the `$id` , `type` and `name` properties.
5. For ACL updates, do not modify the `script` property unless explicitly specified.
6. `type` must be one of the 14 supported object types: `record` (table rows and fields), `pd_action` (Predictive Decision actions), `rest_endpoint`, `ui_page`, `processor`, `graphql`, `client_callable_flow_object`, `client_callable_script_include`, `ux_data_broker` (UX data broker scripts), `ux_page`, `ux_route` (use for workspace ACLs), and — SDK v4.12.0+ — `aiux_page`, `aiux_widget`, `aiux_experience`. TypeScript does not enforce this list — the declared type also accepts an arbitrary string — so verify the value yourself. The three `aiux_*` types are named types: `name` is REQUIRED for them (omitting it is a compile error), unlike `ux_page`/`ux_route`.
7. The object type is immutable: after an ACL rule is created you cannot change its `type`. Delete the ACL and create a new one with the correct type.
8. Create one ACL per operation — separate rules for `read`, `write`, `create`, `delete`, and so on. An ACL requires at least one of `roles`, `securityAttribute`, `condition`, or `script`, and all of the ones you specify must evaluate true to grant access.
9. Use `operation: 'query_match'` or `operation: 'query_range'` for query ACLs, which restrict the query operators a user may apply to a sensitive column. `query_match` governs the "safe" operators that fetch specific records (`EQUALS`, `NOT_EQUALS`, `IN`, `NOT_IN`, `SAMEAS`, `NSAMEAS`, `ANYTHING`, `ISEMPTYSTRING`, `ISEMPTY`, `ISNOTEMPTY`, `ISNULL`, `ISNOTNULL`); `query_range` governs range/pattern operators that can be exploited to extract data (`STARTS_WITH`, `CONTAINS`, `>=`, `<=`, `BETWEEN` and similar), and also restricts sorting by the column. The operator names are platform behavior only — never pass them to the `Acl` API; just set `operation`, plus `table` and `field`.
10. `decisionType: 'deny'` ACLs (Deny-Unless) evaluate before `'allow'` ACLs and never grant access on their own — always pair a Deny-Unless ACL with at least one matching Allow ACL.
11. **SDK v4.13.6 — per-role protection policy.** A plain `roles` entry inherits the ACL's own `protectionPolicy`: the build writes that value onto every `sys_security_acl_role` record, so you never repeat it per role. Only when one role must diverge, use the object form `{ role: 'admin', protectionPolicy: 'read' }`. `protectionPolicy: ''` on a role entry explicitly marks that role as NOT protected even though the ACL is; the empty string is valid only on a role entry — the ACL-level `protectionPolicy` stays `'read'` or `'protected'`.
