Create a rule
const url = 'https://deck.example.com/api/v1/rules';const options = { method: 'POST', headers: {cookie: 'qd_auth=<qd_auth>', 'Content-Type': 'application/json'}, body: '{"action_template":{"target":null,"types":["archive"]},"created_from_card_id":null,"criteria":{"account":null,"from_address":null,"from_domain":null,"list_id":null,"subject_contains":null},"instruction":null,"known_sender_domains":[],"mode":"fuzzy","project":null,"session_ref":null,"topic":null}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://deck.example.com/api/v1/rules \ --header 'Content-Type: application/json' \ --cookie qd_auth=<qd_auth> \ --data '{ "action_template": { "target": null, "types": [ "archive" ] }, "created_from_card_id": null, "criteria": { "account": null, "from_address": null, "from_domain": null, "list_id": null, "subject_contains": null }, "instruction": null, "known_sender_domains": [], "mode": "fuzzy", "project": null, "session_ref": null, "topic": null }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”A grant as the person writes it on the Rules screen or from a card (“Auto-approve matches in future”).
A grant as the person writes it on the Rules screen or from a card (“Auto-approve matches in future”).
object
What a rule allows: action types, and for forwards, resumes and new sessions, the target.
object
The project whose policy governs every action. Without one, each action’s project is found from its target session’s directory or its account.
Responses
Section titled “Responses”A grant.
A grant.
object
What a rule allows: action types, and for forwards, resumes and new sessions, the target.
Shipped with the deck (the sent-mail grant). The person can turn it off but not delete it.
A strict rule’s criteria. A sender criterion needs the card to report DMARC or DKIM passing.
object
A fuzzy match from any other domain is refused.
Example
{ "action_template": { "target": null, "types": [ "archive" ] }, "criteria": { "account": null, "from_address": null, "from_domain": null, "list_id": null, "subject_contains": null }, "mode": "fuzzy", "status": "active"}default
Section titled “default”An error, with its message.
Every error the REST API returns, with an HTTP status.
object
Example generated
{ "error": "example"}