Email Rules

Create a rule

Saves a rule as version 1, from a compile response or a tree you wrote. The tree is checked against the column contract. New rules start in observe, where what the rule matches is recorded and nothing is granted; draft is not evaluated. The caller is the rule's author, and the rule never reaches mail the author cannot read. Needs mail:read, a credential acting as a member with their full access (API keys, agent keys and narrowed tokens are refused), and the email rules feature on the organization.

post/email-rules

Request

  • Base URL
    https://api.primitive.dev/v1
  • URL
    https://api.primitive.dev/v1/email-rules
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

Optional client-supplied idempotency key. Retrying a request with the same key returns the original result instead of performing the action a second time; if omitted the server derives one from the canonical payload hash. Safe to retry network failures without duplicating side effects.

Request body

namestring required

A short name for the rule.

state'draft' | 'observe'

observe (the default) records what the rule would match and grants nothing; draft is not evaluated.

englishstring required

The plain-English description the rule was compiled from.

explanationstring required

What the rule matches, in plain English.

assumptionsstring[]

Readings chosen where the description was open to more than one.

warningsstring[]

Parts of the description the rule does not express.

compiled_bystring

Who produced the tree, as the caller states it (not verified): the compile response's compiled_by, or member when you wrote or edited it yourself. Defaults to member.

Response

Create a rule

successtrue required

Changes

No operation changes recorded.