/domains/{name}/mail/filters/{id}
0.1.0Unchanged since publicationUpdate a mail filter
mailallSupply at least one setting. Each supplied setting replaces its previous value. Supplying rules replaces the entire rule list. You can change match on its own. Use all to require every rule to match or any to require at least one match. If supplied, name must contain 1 to 64 printable ASCII characters. rules and action use the same formats and limits as POST /domains/{name}/mail/filters.
Use position to move the filter within its list. Positions start at 1, and position cannot exceed 100. A position past the end moves the filter to the end. The API returns 400 if no setting is supplied or a setting is invalid, and 404 if id does not identify a filter on the domain. UrbeStack compiles the updated filter with Pigeonhole and reports any compilation error. The 200 response contains the updated filter in filter.
Administrators, the domain's owner and the owner's reseller can call this operation with a token that has the mail scope.
As a command
Run as root on the serverParameters
namepath ·DomainNameRequiredidpath ·integerRequiredactionMailFilterActionmatchstring, one of all, anynamestring, up to 64 characterspositioninteger, 1 to 100rulesarray of MailFilterRuleExample
See the API overview for how to set $API and $TOKEN.curl -sS -X PATCH "$API/domains/example.com/mail/filters/1" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"action": {
"action": "folder",
"target": "https://example.com/new"
},
"match": "all",
"name": "alice",
"position": 1,
"rules": [
{
"field": "from",
"op": "contains",
"value": 8443
}
]
}'200 OK{
"filter": {
"action": {
"action": "folder",
"target": "https://example.com/new"
},
"address": "info@example.com",
"created_at": "2026-09-09T10:15:00Z",
"domain": "example.com",
"id": 1,
"name": "alice",
"position": 1,
"rules": {}
}
}Errors
27 errors, each a status and a sentence400--id is required400<what> must be a whole number from 0 to <max>400<what> must be text without control characters, 1 to <max> characters400A filter needs one to twenty rules400A rule is an object with field, op and value400A rule's field is one of from, to, subject, header, body400A rule's operator is one of contains, not-contains, equals, begins, ends, matches400Domain name required400Domain name too long400Invalid IPv4 address400Invalid IPv6 address400Invalid domain name400Invalid id400Invalid mail address400Invalid mail address: local part over 64 characters400Invalid mail address: no local part400Invalid mail address: the local part may hold letters, digits, dots, _ + and -400Invalid port400Invalid setting key400Nothing to change400The action is an object with action and, for folder and redirect, target400The action is folder, discard, redirect or stop400match is all or any401Authentication required404Filter <id> not found404No such filter: <id>404Setting '<key>' not foundurbestack.com/docs/api/patch-domains-name-mail-filters-id/