Get your free beta license ↗
API operation · mail group
PATCH

/domains/{name}/mail

First published 3 Oct 20260.1.0Unchanged since publication

Update the domain's mail settings and spam policy

Who may call it
AdministratorResellerCustomer
Token scope, any of
mailall
Answers200 OK

Supply at least one setting to change. The API returns 400 if no setting is supplied or routing is invalid. An administrator, the domain's owner, or the owner's reseller can call this operation with a token that has the mail scope. Only an administrator can set outgoing, hourly_limit, account_hourly_limit, or outbound_ip. A 200 response returns the updated mail object and the mail reload result in reload.

Set routing to local to handle the domain's mail on this server, including mail sent by other domains on the server, and publish its mail records in the DNS zone. Set routing to remote when mail is hosted elsewhere. This server then refuses incoming mail for the domain. For a customer or reseller to set local routing, public DNS must direct the domain's mail to this server. UrbeStack checks A and AAAA records if there is no MX record. An administrator can set local routing before public DNS points here. Setting either mode ends any routing hold and disables automatic routing changes for the domain.

When mail settings are first created, routing starts as local if public DNS directs mail here or if the domain has no MX record and its nameservers are delegated to this server. Setting mail.unpointed_domains to accept also lets the domain start with local routing and no hold. Otherwise, routing starts as remote with mail on hold.

Set web to false to stop the domain's website from sending mail. Set outgoing to false to block all outgoing mail for the domain, including mail sent by accounts and scripts. The hourly_limit and account_hourly_limit fields set the domain-wide and per-account limits, respectively. Each accepts a whole number from 0 to 1000000 messages per hour. Use null or an empty string to restore the server default for either limit. The outbound_ip field selects a sending IP address from dns.ipv4, dns.ipv6, or mail.extra_addresses. Use null or an empty string to clear the override.

Spam filtering is on by default. Set spam to false to deliver mail without spam markings. When filtering is on, UrbeStack rejects mail at or above reject_score. For mail below that threshold, UrbeStack marks messages at or above junk_score as junk and delivers them to Junk if junk_folder is enabled. Both scores accept values from 0 to 100 with up to one decimal place. Use null or an empty string to restore the server default for either score. The junk_score must be below reject_score. Customers can set scores only within the range the administrator configured.

The junk_folder and greylisting fields inherit the server policy by default. Set greylisting to false to remove the first-contact delay. DKIM signing is on by default. Set dkim to false to stop signing if the domain uses external DNS without its DKIM record. UrbeStack keeps the key and record so signing resumes immediately when dkim is set to true.

As commands

Run as root on the server

Parameters

namepath ·DomainNameRequired

Request body

JSON ·MailDomainPatch· 12 fields
account_hourly_limitinteger, 0 to 1000000 or null
Administrator-only default hourly sending limit for each mail account in the domain.
dkimboolean
Whether to sign the domain's outgoing mail with DKIM. Set to false if the domain uses external DNS and its zone lacks the DKIM record.
greylistingboolean
hourly_limitinteger, 0 to 1000000 or null
Administrator-only limit on outgoing messages per hour for the domain. Use null for the server default or 0 for no limit.
junk_folderboolean
Whether messages marked as spam are moved to Junk.
junk_scorenumber or null
Minimum score for marking a message as spam, or null for the server default. Customers must choose a score within the administrator's allowed range.
outbound_ipstring, up to 45 characters or null
Administrator-only setting for which of the server's IP addresses to use for outgoing mail. Use null for the server default.
outgoingboolean
Administrator-only setting that blocks all outgoing mail for the domain when set to false.
reject_scorenumber or null
Minimum spam score at which a message is rejected.
routingstring, one of local, remote
With local, this server hosts the mailboxes and the domain's DNS zone contains the mail records. With remote, mail is hosted elsewhere.
spamboolean
Whether spam filtering is enabled for the domain.
webboolean
Whether the domain's website can send mail.

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X PATCH "$API/domains/example.com/mail" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "account_hourly_limit": 1,
    "dkim": true,
    "greylisting": true,
    "hourly_limit": 1,
    "junk_folder": true,
    "junk_score": 1,
    "outbound_ip": "text",
    "outgoing": true,
    "reject_score": 1,
    "routing": "local",
    "spam": true,
    "web": true
  }'
Response · 200 OK
{
  "mail": {
    "account_hourly_limit": 1,
    "accounts": [
      {
        "address": "info@example.com",
        "autoresponder": {
          "body": "text",
          "end": "text",
          "interval_days": 1,
          "start": "text",
          "subject": "text"
        },
        "created_at": "2026-09-09T10:15:00Z",
        "domain": "example.com",
        "home": "text",
        "hourly_limit": 1,
        "id": 1,
        "local_part": "text",
        "login_suspended": 1,
        "outgoing_suspended": 1,
        "quota_mb": 1,
        "updated_at": "text",
        "usage": {
          "messages": 1,
          "storage_kb": 1,
          "storage_limit_kb": 1
        }
      }
    ],
    "certificate": {
      "covers_mail": true,
      "covers_webmail": true,
      "installed": true
    },
    "check_resolvers": [
      "text"
    ],
    "default_address": {},
    "delegated_here": "yes",
    "dkim": [
      {}
    ],
    "dkim_selector": "text",
    "domain": "example.com",
    "filters": [
      {
        "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": {}
      }
    ],
    "forwarders": [
      {
        "address": "info@example.com",
        "created_at": "2026-09-09T10:15:00Z",
        "destinations": [
          "text"
        ],
        "domain": "example.com",
        "id": 1,
        "local_part": "text"
      }
    ],
    "hold": 1,
    "hold_checked_at": "text",
    "hold_ended_at": "text",
    "hold_ended_by": "text",
    "hold_nameservers": [
      "text"
    ],
    "hold_since": "text",
    "hourly_limit": 1,
    "lists": [
      {
        "created_at": "2026-09-09T10:15:00Z",
        "domain": "example.com",
        "entry": "text",
        "id": 1,
        "kind": "profile"
      }
    ],
    "outbound_ip": "text",
    "outgoing_suspended": 1,
    "policy": {
      "dkim": 1,
      "enabled": 1,
      "greylisting": 1,
      "junk_folder": 1,
      "junk_score": 1,
      "reject_score": 1
    },
    "public_nameservers": [
      "text"
    ],
    "records": [
      {
        "content": "text",
        "key": "panel.port",
        "name": "alice",
        "type": "rebuild",
        "zone": "text"
      }
    ],
    "routing": "text",
    "server_addresses": [
      "text"
    ],
    "server_policy": {},
    "smarthost": {
      "has_password": true,
      "host": "text",
      "port": 8443,
      "tls": true,
      "user": "alice"
    },
    "spam": {},
    "user": "alice",
    "web_sending": 1,
    "webmail_url": "text",
    "zone": "text"
  }
}

Errors

27 errors, each a status and a sentence
400--name is required
400<ip> is not one of this server's addresses (dns.ipv4, dns.ipv6, mail.extra_addresses)
400<what> must be a whole number from 0 to <max>
400<what> must be text without control characters, 1 to <max> characters
400A score is a number, with up to two decimals
400Domain name required
400Domain name too long
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid boolean
400Invalid domain name
400Invalid mail address
400Invalid mail address: local part over 64 characters
400Invalid mail address: no local part
400Invalid mail address: the local part may hold letters, digits, dots, _ + and -
400Invalid port
400Invalid setting key
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Nothing to change
400Routing is local or remote
400The junk score must be below the reject score
400Username '<value>' is reserved
400routing must be local or remote
401Authentication required
404No such domain: <name>
404Setting '<key>' not found
409The mail of <name> is not received here yet: its MX record
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.1.0 on 3 Oct 2026.
urbestack.com/docs/api/patch-domains-name-mail/