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

/domains/{name}/mail/smarthost

First published 3 Oct 20260.1.0Unchanged since publication

Set the smarthost for the domain's outgoing mail

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

Supply the relay hostname in host. port defaults to 587, and tls defaults to true, which requires TLS. A nonempty user must contain 1 to 128 visible ASCII characters (U+0021 through U+007E). A nonempty password must contain 1 to 256 characters from the same range. Invalid user or password characters or lengths return 400.

Omit password to keep the stored password. Send an empty string or null to remove it. The 200 response contains name and smarthost. The smarthost object reports whether a password is stored through has_password and omits the password itself.

Only administrators with a token that has the mail scope can call this operation.

As a command

Run as root on the server

Parameters

namepath ·DomainNameRequired

Request body

JSON ·MailSmarthostSet· 5 fields
hoststring, up to 254 charactersRequired
passwordstring, up to 256 characters or null
Smarthost password. Omit this field to keep the current password, or set it to null or an empty string to remove it.
portinteger, 1 to 65535
tlsboolean
userstring, up to 128 characters

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X PUT "$API/domains/example.com/mail/smarthost" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "host": "text",
    "password": "Sup3r-Secret-Passphrase",
    "port": 8443,
    "tls": true,
    "user": "alice"
  }'
Response · 200 OK
{
  "name": "alice",
  "smarthost": {
    "has_password": true,
    "host": "text",
    "port": 8443,
    "tls": true,
    "user": "alice"
  }
}

Errors

32 errors, each a status and a sentence
400'<zone>' is not a zone this machine knows: timedatectl list-timezones names them
400--host is required unless --clear is given
400<what> must be text without control characters, 1 to <max> characters
400A new job is queued or running
400Domain name required
400Domain name too long
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid boolean
400Invalid domain name
400Invalid port
400Invalid setting key
400Job parameters must be an object
400PHP <version> cannot be the default: it is hidden from new choices on this server
400PHP <version> cannot be the default: it is not installed on this server
400The smarthost password must be printable, up to 256 characters
400The smarthost user must be printable, up to 128 characters
400Unknown job type
400Unknown setting '<key>'
400jobs.keep_days (<keep>) may not be smaller than jobs.show_days (<show>): a job cannot be shown longer than it is kept; 0 keeps them for good
401Authentication required
404Setting '<key>' not found
409<key> cannot take that value: <SECOND>{<k>}{on} <sp> (<k>). <SECOND>{<k>}{move}, or choose another
409<key> cannot take that value: the panel listens on port <port> (panel.port). Move the panel first, or choose another
409<s.subject> cannot take port <port>:
409<s.subject> cannot take port <port>: <why>
409<s.subject> cannot take port <port>: it is the panel's port (panel.port)
409A change is already armed for revert (
409Sharing is required with this license.
409The panel cannot take port <port>:
409The panel cannot take port <port>: <why>
409These are the nameservers of a distribution network with several nodes, and every node lists the same ones. To remove a nameserver or move it to another node, use the actions beside its name on DNS zones › Nameservers & addresses, or urbestack-dns-nameserver
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/put-domains-name-mail-smarthost/