Skip to content

Domain Management

Domains tell MXHook which email addresses to accept. Emails sent to unregistered domains are rejected at the SMTP level.

Register a Domain

bash
curl -X POST http://localhost:8080/domains \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -d '{"name": "yourdomain.com"}'

Response:

json
{
  "id": "d-1710806400",
  "name": "yourdomain.com",
  "created_at": "2025-03-19T00:00:00Z"
}

List Domains

bash
curl http://localhost:8080/domains \
  -H "X-API-Key: your-api-key"

Response:

json
[
  {
    "id": "d-1710806400",
    "name": "yourdomain.com",
    "created_at": "2025-03-19T00:00:00Z"
  }
]

Delete a Domain

bash
curl -X DELETE http://localhost:8080/domains/d-1710806400 \
  -H "X-API-Key: your-api-key"

Returns 204 No Content on success.

WARNING

Deleting a domain does not automatically delete its associated routes. Clean up routes separately to avoid orphaned configuration.

CLI

You can also manage domains via the CLI:

bash
mxhook domain add yourdomain.com
mxhook domain list
mxhook domain remove d-1710806400

See the CLI reference for details.

Released under the Apache 2.0 License.