Api referencePolicies
Set decision rules
Replaces this scope's rules and instructions only when ifVersion matches its current version.
PUT
Replaces this scope's rules and instructions only when ifVersion matches its current version. A stale version returns a conflict. More specific scopes replace defaults; atLeast floors remain binding. Identical rule matches in one scope are rejected.
apiKeyheader
x-api-key<token>kind*stringValue in
"organization""mailbox""apiKey""agent"id*stringLength
1 <= lengthapplication/json- body
presets*array<>rules*array<|>instructions?string|nullifVersion*PolicyVersionRange
0 <= value <= 9007199254740991PolicySnapshot
application/json- response
presets*array<>rules*array<|>instructions?string|nullversion*PolicyVersionRange
0 <= value <= 9007199254740991import { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.policies.setPolicy({ "kind": "organization", "id": "example", "presets": [ "example" ], "rules": [ { "match": {}, "decide": "run" } ], "ifVersion": 0});Example Response
{ "presets": [ "string" ], "rules": [ { "match": { "kind": "send", "effect": "read", "channel": "sms", "integration": "string", "tool": "string", "subject": "agent" }, "note": "string", "decide": "run", "atLeast": null } ], "instructions": "string", "version": 0}