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

/mail/check/fix

First published 7 Nov 20260.2.27Unchanged since publication

Apply a fix from the server hostname's mail record check

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

Set record to a key from the check, such as mail-spf, mail-dmarc, mail-a or host-spf. Record keys contain 1 to 64 lowercase letters, digits or hyphens. Set action to publish, restore or spf-add. An invalid record key format or action returns 400. If the hostname is a hosted domain, UrbeStack applies the fix to that domain, which must use local mail routing. The hostname and the record's DNS name must be in the same zone managed by this server.

Use publish to republish the zone, including for DKIM. Use restore to remove custom records of the same kind at the same DNS name and recreate UrbeStack's record. Restoring SPF requires the SPF record to be absent. Use spf-add to add this server's sending IP addresses or the relay's SPF mechanism to the single custom SPF record and remove UrbeStack's SPF record if present. UrbeStack inserts the additions before the first all or redirect= term, or appends them if neither is present. For relayed mail, spf-add requires a server-wide relay with an SPF mechanism set in mail.smarthost_spf. The resulting SPF record can contain up to 4096 characters.

Every action regenerates and publishes the zone with a full BIND reload. A DNS distribution client also sends the zone to its DNS server again. The 200 response contains the fix details in fixed and the updated hostname check in check, including reverse DNS for the sending IP addresses.

The API returns 409 if the current zone contents make the fix inapplicable, the server lacks a hostname containing a dot, or the mail stack is disabled or missing. Run the check again before retrying an inapplicable fix. Requires an administrator token with the mail scope.

As a command

Run as root on the server

Request body

JSON ·MailCheckFix· 2 fields
actionstring, one of publish, restore, spf-addRequired
recordstring, up to 64 charactersRequired

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/mail/check/fix" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "publish",
    "record": "text"
  }'
Response · 200 OK
{
  "check": {
    "checked_at": "text",
    "dns": "here",
    "dns_server": "text",
    "failed": true,
    "hosted": true,
    "name": "alice",
    "nameservers": [
      "text"
    ],
    "records": [
      {
        "adds": [
          "text"
        ],
        "copy": {
          "name": "alice",
          "priority": 1,
          "type": "rebuild",
          "value": 8443
        },
        "expected": "text",
        "fix": "publish",
        "fqdn": "text",
        "inherited": "text",
        "key": "panel.port",
        "name": "alice",
        "state": "correct",
        "theirs": "text",
        "type": "A",
        "until": "text",
        "value": 8443,
        "world": [
          "text"
        ]
      }
    ],
    "resolver": "text",
    "resolvers": [
      "text"
    ],
    "reverse": [
      {
        "address": "info@example.com",
        "bound": true,
        "family": "ipv4",
        "hostname_address": true,
        "matches_hostname": true,
        "on_machine": true,
        "points_back": true,
        "ptr": "text",
        "state": "correct"
      }
    ]
  },
  "fixed": {
    "action": "text",
    "added": [
      "text"
    ],
    "dns_server": "text",
    "record": "text",
    "record_now": "text",
    "removed": [
      "text"
    ],
    "zone": "text"
  }
}

Errors

23 errors, each a status and a sentence
400<what> must be text without control characters, 1 to <max> characters
400A DKIM record is published, not restored
400Domain name required
400Domain name too long
400Give --name or --host
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid domain name
400Invalid port
400Invalid setting key
400Only an SPF record has this server added
400The SPF record would be longer than a TXT record may be
400action must be publish, restore or spf-add
400record must name a record of the check
401Authentication required
404No record <key> to fix for <what>
404Setting '<key>' not found
409<md.domain> routes its mail elsewhere; this server publishes no mail records for it
409<w.fqdn> belongs to the zone
409The DNS of <what> is not kept on this server
409The mail stack is not installed on this server
409The server has no hostname to check
409This server sends through a relay with no SPF mechanism given; there is nothing to add
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.2.27 on 7 Nov 2026.
urbestack.com/docs/api/post-mail-check-fix/