Domains
Create Domain
Section titled “Create Domain”POST /domains/Register a new email domain.
Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Domain name (e.g. mycompany.com). Auto-lowercased. |
partner_ref | string | No | Master only. Attribute the domain to a tenant at creation time. Ignored when sent by a customer token (the caller’s own partner_ref always wins). |
Example
Section titled “Example”# Customer token — the API uses your token's partner_refcurl -X POST https://api.emboux.com/domains/ \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "mycompany.com"}'
# Master token — attribute on creationcurl -X POST https://api.emboux.com/domains/ \ -H "Authorization: Bearer MASTER_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "mycompany.com", "partner_ref": "partner_42"}'Response 201 Created
Section titled “Response 201 Created”{ "id": 1, "name": "mycompany.com", "created_at": "2025-01-15T10:30:00"}Errors
Section titled “Errors”| Status | Detail |
|---|---|
400 | Domain already exists |
403 | Domain quota exceeded |
List Domains
Section titled “List Domains”GET /domains/Returns all domains visible to the authenticated key.
- Master token: returns all domains
- Client token: returns only domains belonging to that partner
Example
Section titled “Example”curl https://api.emboux.com/domains/ \ -H "Authorization: Bearer YOUR_API_KEY"Response 200 OK
Section titled “Response 200 OK”[ { "id": 2, "name": "example.org", "created_at": "2025-01-16T08:00:00" }, { "id": 1, "name": "mycompany.com", "created_at": "2025-01-15T10:30:00" }]Delete Domain
Section titled “Delete Domain”DELETE /domains/{domain_name}Permanently removes a domain and all its mailboxes and aliases (cascade delete).
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Description |
|---|---|---|
domain_name | string | The domain name to delete |
Example
Section titled “Example”curl -X DELETE https://api.emboux.com/domains/mycompany.com \ -H "Authorization: Bearer YOUR_API_KEY"Response 204 No Content
Section titled “Response 204 No Content”No response body.
Errors
Section titled “Errors”| Status | Detail |
|---|---|
404 | Domain not found |
Register Subdomain
Section titled “Register Subdomain”POST /domains/{domain_name}/register-subdomainComplete provider-side setup for a subdomain whose parent is a verified wildcard domain. After a successful call the subdomain can send outbound mail using the parent’s DKIM identity.
Available to both master and customer tokens. Customer tokens may only register subdomains they own (filtered by partner_ref — a 404 is returned for any other domain).
When to call
Section titled “When to call”Call this once, right after creating a subdomain under a verified wildcard parent. If you create domains via the Odoo module, this call is dispatched automatically and you do not need to invoke it yourself.
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Description |
|---|---|---|
domain_name | string | Subdomain name (must have at least 3 parts, e.g. client1.example.com) |
Example
Section titled “Example”curl -X POST https://api.emboux.com/domains/client1.example.com/register-subdomain \ -H "Authorization: Bearer YOUR_API_KEY"Response 200 OK
Section titled “Response 200 OK”{ "name": "client1.example.com", "verification_token": "", "dkim_tokens": [], "verified": true, "dns_records": [], "provider": "mailgun"}Errors
Section titled “Errors”| Status | Detail |
|---|---|
400 | Name is not a subdomain (≤ 2 parts) |
404 | Domain not found (or not owned by this customer token) |
Wildcard / Parent Domain
Section titled “Wildcard / Parent Domain”PUT /domains/{domain_name}/parentSet parent_domain and/or is_wildcard for a domain. Master token only.
Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
parent_domain | string | No | Name of the parent domain (or null to clear) |
is_wildcard | boolean | No | Enable wildcard mode for this domain |
Example
Section titled “Example”curl -X PUT https://api.emboux.com/domains/ganemo.com/parent \ -H "Authorization: Bearer YOUR_MASTER_KEY" \ -H "Content-Type: application/json" \ -d '{"is_wildcard": true}'Response 200 OK
Section titled “Response 200 OK”{ "name": "ganemo.com", "parent_domain": null, "is_wildcard": true}DNS Check
Section titled “DNS Check”GET /domains/{domain_name}/dns-checkVerify that DNS records are configured correctly for a domain.
Response 200 OK
Section titled “Response 200 OK”{ "name": "ganemo.com", "all_ok": true, "records": [ {"record_type": "MX", "name": "ganemo.com", "expected": "mx1.emboux.com", "status": "ok"}, {"record_type": "TXT", "name": "ganemo.com", "expected": "include:emboux.com", "status": "ok"} ]}Each record has a status of ok, missing, or incorrect.
Transfer Domain Owner
Section titled “Transfer Domain Owner”PUT /domains/{domain_name}/ownerReassign a domain to a different tenant. The endpoint atomically updates the domain’s partner_ref and adjusts the domains_used counter on both the previous and the new owner’s API keys.
Master token only.
Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
partner_ref | string | null | Yes | The new owner’s partner_ref. Pass null to unassign (orphan) the domain. |
Behavior
Section titled “Behavior”- Reassign (
partner_ref: "P_new") — the API validates that at least one active API key exists forP_new(refusing with400otherwise so domains can’t be silently orphaned into a non-existent tenant). The previous owner’sdomains_usedis decremented and the new owner’s is incremented. - Unassign (
partner_ref: null) — only the previous owner’s counter goes down; no new partner is credited. - No-op (target equals current owner) — no counters move; the response echoes current state.
Example
Section titled “Example”curl -X PUT https://api.emboux.com/domains/client.example.com/owner \ -H "Authorization: Bearer MASTER_TOKEN" \ -H "Content-Type: application/json" \ -d '{"partner_ref": "partner_42"}'Response 200 OK
Section titled “Response 200 OK”{ "name": "client.example.com", "partner_ref": "partner_42", "previous_partner_ref": "partner_17"}Errors
Section titled “Errors”| Status | Detail |
|---|---|
400 | No active api_key for partner_ref={value} |
403 | Master token required |
404 | Domain not found |
Activate / Suspend
Section titled “Activate / Suspend”PUT /domains/{name}/suspend and PUT /domains/{name}/activate toggle the suspended flag on a domain. Suspended domains reject inbound mail at Postfix/Dovecot.
curl -X PUT https://api.emboux.com/domains/client.example.com/activate \ -H "Authorization: Bearer YOUR_API_KEY"Response 200 OK
Section titled “Response 200 OK”{ "name": "client.example.com", "suspended": false, "message": "Domain activated"}