curl --request POST \
--url 'https://api.nsr.stateset.com/api/v1/rules' \
--header "X-API-Key: $STATESET_NSR_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"body": [
{
"args": [],
"negated": true,
"predicate": "string"
}
],
"confidence": 7.5,
"description": "Two-person tent, green — replacement for damaged pole set.",
"effect": {
"0": "p",
"1": "e",
"2": "r",
"3": "m",
"4": "i",
"5": "t"
},
"head_args": [
"string"
],
"head_predicate": "string",
"name": "Two-Person Tent",
"test_cases": [
{
"expected_output": {},
"input_bindings": {},
"name": "Two-Person Tent",
"should_fire": true
}
]
}'
Create (or upsert) an organization policy rule.
POSTing a name that already exists atomically REPLACES that rule — this is how a policy pack is re-uploaded without stacking duplicates. Lint errors (e.g…
POST
/
api
/
v1
/
rules
curl --request POST \
--url 'https://api.nsr.stateset.com/api/v1/rules' \
--header "X-API-Key: $STATESET_NSR_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"body": [
{
"args": [],
"negated": true,
"predicate": "string"
}
],
"confidence": 7.5,
"description": "Two-person tent, green — replacement for damaged pole set.",
"effect": {
"0": "p",
"1": "e",
"2": "r",
"3": "m",
"4": "i",
"5": "t"
},
"head_args": [
"string"
],
"head_predicate": "string",
"name": "Two-Person Tent",
"test_cases": [
{
"expected_output": {},
"input_bindings": {},
"name": "Two-Person Tent",
"should_fire": true
}
]
}'
POSTing a name that already exists atomically REPLACES that rule — this is
how a policy pack is re-uploaded without stacking duplicates. Lint errors
(e.g. RULE007 unbound head variable) reject the write with 400; soft
lint_warnings are returned alongside a successful create.
Required scope: write
Request body
CreateRuleRequest
RuleAtomRequest[]
required
number (float)
string
object
string[]
required
string
required
string
required
RuleTestCaseRequest[]
Response
No response body. Rule created or replaced; body carries id and any lint_warnings.Status codes
| Code | Meaning |
|---|---|
201 | Rule created or replaced; body carries id and any lint_warnings |
400 | Lint error — the rule was not installed |
401 | Unauthorized — missing or invalid credentials |
402 | Tenant rule quota exhausted |
403 | Forbidden — the key/token lacks the required scope |
429 | Rate limited — see Retry-After / X-RateLimit-Reset |
curl --request POST \
--url 'https://api.nsr.stateset.com/api/v1/rules' \
--header "X-API-Key: $STATESET_NSR_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"body": [
{
"args": [],
"negated": true,
"predicate": "string"
}
],
"confidence": 7.5,
"description": "Two-person tent, green — replacement for damaged pole set.",
"effect": {
"0": "p",
"1": "e",
"2": "r",
"3": "m",
"4": "i",
"5": "t"
},
"head_args": [
"string"
],
"head_predicate": "string",
"name": "Two-Person Tent",
"test_cases": [
{
"expected_output": {},
"input_bindings": {},
"name": "Two-Person Tent",
"should_fire": true
}
]
}'
Last modified on August 31, 2026