POST/api/v1/projects/{project_id}/domains
add_sending_domain
Adds a sending domain to a project and generates its DKIM key pair (RSA 2048; the private key is stored sealed and no call returns it).
- Call it
- before sending from a new domain: a campaign sends only from a verified domain of its project.
- Needs
- an admin key with
project_id, or a project key with scopewrite(its own project; the argument is ignored);ip_poolmust be a pool of the node (get_server_info); a domain is added once per project. - Returns
- the domain,
pending, andrequired_records: the DNS records to create (SPF and MX of the bounce subdomain, DKIM, DMARC, the tracking host’s CNAME). The same asPOST /api/v1/projects/{project_id}/domains.
Arguments
- object
-
dns_providerstringrequiredWho applies the DNS records:
porkbun, ormanualfor entry by hand.example
manual -
domainstringrequiredThe domain of the sender addresses: a host name such as
news.example.com; a subdomain or an international name is fine.example
news.example.com -
bounce_subdomainstringThe return-path domain, below
domain; leave it out forbounce.<domain>. -
dkim_selectorstringThe DKIM selector, at most 63 characters; leave it out for
pw1.example
pw1 -
ip_poolstringThe IP pool of the node’s config to send from (
get_server_infolists them); leave it out fordefault.example
default -
project_idstring · uuid | nullThe project to add the domain to. An admin key must pass it; a project key’s own project is used and this is ignored.
-
tracking_hoststring | nullA host for tracking and unsubscribe links; null or left out: none.
No other arguments are accepted.
Result
The result comes back as structuredContent, with the same JSON as a text block.
- object · all fields required
-
bounce_subdomainstring -
checksarray of DomainCheckOne entry per check that ran, in the canonical order; empty until the domain is first verified.
3 fields
- DomainCheck object · all fields required
-
detailstring | nullWhat was found instead of what was expected;
nullwhenok. -
namestringspf_bounce,mx_bounce,dkim,dmarc,tracking_cname,tracking_tlsorptr. -
statusCheckStatusOutputHow one verification check came out.
okThe required record is present and matches.missingNo record of this kind is in DNS yet.mismatchA record is there, but not the one Postwind needs.warningNot ok, but it does not fail the domain (ptr).
-
created_atstring · date-time -
dkim_public_keystringThe DKIM public key: base64 of its DER
SubjectPublicKeyInfo, thep=of the DKIM record. -
dkim_selectorstring -
dns_providerDnsProviderOutputWho applies a domain’s DNS records.
porkbunPorkbun’s API.manualNobody: the records are for entry by hand. -
domainstringIn punycode for an international name.
-
idstring · uuid -
ip_poolstring -
last_checked_atstring · date-time | nullWhen the records were last checked;
nulluntil then. -
project_idstring · uuid -
required_recordsarray of RequiredRecordWhat to create in DNS, in this order.
6 fields
- RequiredRecord object · all fields required
-
contentstringThe whole value.
-
create_only_if_absentbooleanCreate it only if the name has no record of this type, and never change one that is there (the DMARC record).
-
namestringThe owner name, without a trailing dot.
-
priorityinteger · uint16 | nullThe MX priority;
nullfor other types.0–65535
-
purposeRecordPurposeOutputWhat a required record is for.
spf_bounceSPF of the bounce subdomain.mx_bounceMX of the bounce subdomain.dkimThe DKIM public key.dmarcThe DMARC policy.tracking_cnameThe tracking host’s CNAME. -
typeRecordTypeOutputThe type of a DNS record.
- txt
- mx
- cname
-
statusDomainStatusOutputWhere a sending domain stands.
pendingIts records are not checked yet, or changed since.verifiedEvery required record checked out.failedA required record is missing or wrong. -
tracking_hoststring | nullnull: none. -
updated_atstring · date-time
Definitions
CheckStatusOutput
How one verification check came out.
string · enum
ok The required record is present and matches.
missing No record of this kind is in DNS yet.
mismatch A record is there, but not the one Postwind needs.
warning Not ok, but it does not fail the domain (ptr).
DnsProviderOutput
Who applies a domain’s DNS records.
string · enum
porkbun Porkbun’s API.
manual Nobody: the records are for entry by hand.
DomainCheck
One verification check.
- object · all fields required
-
detailstring | nullWhat was found instead of what was expected;
nullwhenok. -
namestringspf_bounce,mx_bounce,dkim,dmarc,tracking_cname,tracking_tlsorptr. -
statusCheckStatusOutputHow one verification check came out.
okThe required record is present and matches.missingNo record of this kind is in DNS yet.mismatchA record is there, but not the one Postwind needs.warningNot ok, but it does not fail the domain (ptr).
DomainStatusOutput
Where a sending domain stands.
string · enum
pending Its records are not checked yet, or changed since.
verified Every required record checked out.
failed A required record is missing or wrong.
RecordPurposeOutput
What a required record is for.
string · enum
spf_bounce SPF of the bounce subdomain.
mx_bounce MX of the bounce subdomain.
dkim The DKIM public key.
dmarc The DMARC policy.
tracking_cname The tracking host’s CNAME.
RecordTypeOutput
The type of a DNS record.
string · enum
- txt
- mx
- cname
RequiredRecord
A DNS record a sending domain needs.
- object · all fields required
-
contentstringThe whole value.
-
create_only_if_absentbooleanCreate it only if the name has no record of this type, and never change one that is there (the DMARC record).
-
namestringThe owner name, without a trailing dot.
-
priorityinteger · uint16 | nullThe MX priority;
nullfor other types.0–65535
-
purposeRecordPurposeOutputWhat a required record is for.
spf_bounceSPF of the bounce subdomain.mx_bounceMX of the bounce subdomain.dkimThe DKIM public key.dmarcThe DMARC policy.tracking_cnameThe tracking host’s CNAME. -
typeRecordTypeOutputThe type of a DNS record.
- txt
- mx
- cname
Errors
A failed call answers isError: true with a code from the same table as the HTTP API, and detail. How tools report errors
HTTP API
The same operation over HTTP: POST /api/v1/projects/{project_id}/domains