Domains
SDK methods for managing sending domains and DNS verification.
The client.domains namespace provides typed methods for registering, verifying, and managing sending domains used for email delivery. Available in TypeScript, Python, and Go SDKs.
| SDK | Install | Namespace |
|---|---|---|
| TypeScript | npm install @caldera/platformxe-sdk | client.domains |
| Python | pip install platformxe | client.domains |
| Go | go get github.com/calderaxe/platformxe-go | client.Domains |
Register a domain
Register a new sending domain. PlatformXe returns DNS records that must be configured with your DNS provider before the domain can be verified.
const domain = await client.domains.register({
domain: 'notifications.myapp.com',
});
console.log(domain.id); // "dom_abc123"
console.log(domain.status); // "PENDING"
console.log(domain.dnsRecords); // Array of required DNS records
domain = client.domains.register(domain="notifications.myapp.com")
domain, err := client.Domains.Add("notifications.myapp.com")
DNS records response
After registration, the response includes DNS records to configure. Each record contains:
| Field | Description |
|---|---|
type | Record type (CNAME, TXT, MX) |
name | DNS record name |
value | DNS record value |
priority | Priority (for MX records) |
List domains
const { domains } = await client.domains.list();
for (const d of domains) {
console.log(`${d.domain}: ${d.status}`);
}
result = client.domains.list()
result, err := client.Domains.List()
Get a domain
const domain = await client.domains.get('dom_abc123');
domain = client.domains.get("dom_abc123")
domain, err := client.Domains.Get("dom_abc123")
Verify a domain
Trigger DNS verification for a registered domain. Call this after you have configured the required DNS records.
const result = await client.domains.verify('dom_abc123');
console.log(result.verified); // true or false
console.log(result.checks); // { spf: true, dkim: true, returnPath: true }
result = client.domains.verify("dom_abc123")
result, err := client.Domains.Verify("dom_abc123")
DNS propagation can take up to 48 hours. If verification fails, wait and retry. The checks field indicates which specific DNS records have been confirmed.
Delete a domain
Remove a registered sending domain. Emails can no longer be sent from this domain after deletion.
await client.domains.delete('dom_abc123');
client.domains.delete("dom_abc123")
result, err := client.Domains.Delete("dom_abc123")
Registration errors
domains.register() (POST /api/v1/domains) can be refused with these codes. Nothing is registered in any of them.
| Code | HTTP | Meaning |
|---|---|---|
DOMAIN_ALREADY_REGISTERED | 409 | The domain is already registered, by your organisation or by another one. The message is the same in every case and never says who holds the domain. |
DOMAIN_LIMIT_REACHED | 503 | No domain can be added at the moment. Retrying does not help: contact support. The Go SDK returns it at once, without retrying. |
PROVIDER_ERROR | 502 | The registration failed for another reason. Try again later. |
Scopes required
| Method | Scope |
|---|---|
domains.register() | domains:manage |
domains.list() | domains:manage |
domains.get() | domains:manage |
domains.verify() | domains:manage |
domains.delete() | domains:manage |