Receive Emails: Rules
Rule Options
Everything a rule can use: fields with their operators, actions, providers and limits. Use it to build a rule editor.
POST
https://g.sendcorex.com/v1command: rule_optionsArguments
This endpoint takes no arguments.
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "rule_options"
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Response
{
"type": "SUCCESS",
"results": [
{
"command": "rule_options",
"id": "0",
"type": "SUCCESS",
"data": {
"fields": {
"from": "text",
"from_domain": "domain",
"provider": "enum",
"received_hour": "number",
"has_attachment": "bool"
},
"operators": {
"text": [
"contains",
"not_contains",
"is",
"…"
],
"enum": [
"is_any_of",
"is_none_of"
]
},
"actions": {
"move": "folder",
"keep_inbox": "",
"label": "label",
"snooze": "hours",
"auto_reply": "template"
},
"providers": {
"microsoft_365": "Microsoft 365",
"google_workspace": "Google Workspace",
"icloud": "iCloud",
"other": "Other / own server"
},
"limits": {
"rules": 100,
"conditions": 20,
"actions": 12,
"value": 2000,
"regex": 300,
"list_items": 500
}
}
}
]
}Errors
HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.
- 401
TOKEN_EXPIREDThe access token has expired. Call Refresh Token and repeat the request.
- 401
INVALID_TOKENThe token is malformed, unknown or revoked.
- 429
RATE_LIMITEDMore than 15 requests/s or 15 in flight for the same IP + mailbox. Wait the number of seconds in Retry-After.
- CMD
INTERNALServer error. The detail is only written to the server log.