Create a receivable address
/v1/inbound/addressesAdmin only. Mail arrives once the domain is verified and its receiving MX record is active. Hosted, an address on one of your own domains (or a subdomain of one), verified or still being verified, where nothing receives yet turns receiving on at its host, as addReceivingHost does, and the answer’s receiving names the MX record to publish, the host’s status and whether the domain is verified yet; a host whose mail another provider receives today is refused with RECEIVING_HOST_IN_USE and the call that moves it. A refused request creates nothing, and receiving stays as it was. Permanent addresses claim earlier unrouted mail (kept 30 days) for their address or rules; temporary addresses start empty. Expiry stops new delivery and sending without deleting history.
Needs Inboxes: write on the whole workspace. A person needs to be an owner or admin.
Example
import { createClient } from '@nightmail/sdk/client';
import { createInboundAddress } from '@nightmail/sdk';
const client = createClient({
baseUrl: 'https://nightmail.dev',
auth: scheme => scheme.scheme === 'bearer'
? process.env.NIGHTMAIL_API_KEY
: undefined,
});
const result = await createInboundAddress({
client,
body: {
"address": "example",
"aliases": [],
"rules": [],
"metadata": {},
"requireDmarc": false
},
throwOnError: true,
});
console.log(result.data);curl --request POST \
--url 'https://nightmail.dev/v1/inbound/addresses' \
--header "Authorization: Bearer $NIGHTMAIL_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"address": "example",
"aliases": [],
"rules": [],
"metadata": {},
"requireDmarc": false
}'Request body
CreateInboundAddresskeystring or nullStable key you choose (lowercase letters, digits, hyphens). Config files refer to inbox:<key>, webhook:<key> and forward:<name>.
addressrequiredstringdisplayNamestring or nullpublicAddressstringPermanent addresses only: immutable default From with the same local part on a strict ancestor domain verified for sending with DKIM in the receiving region. Does not change routing or MX.
ttlSecondsintegerLease duration in seconds, 60–2592000 (30 days). Omit for a permanent address. Temporary addresses accept plus-tags, not aliases, wildcard rules or historical backfill. Expiry is fixed at creation.
aliasesstring[]rulesstring[]Wildcard address patterns, e.g. support+*@acme.com or *@help.acme.com.
metadataobjectsendLimitsobjectOverride the loop guards. Defaults: perRecipientPerHour 20, perThreadPer10Minutes 10. 0 blocks sending. There is no hourly or daily cap per address.
sendLimits.perHourintegerDeprecated and not enforced: any whole number from 0 is accepted. 0 turns sending off; any other number has no effect.
sendLimits.perDayintegerDeprecated and not enforced: any whole number from 0 is accepted. 0 turns sending off; any other number has no effect.
sendLimits.perRecipientPerHourintegersendLimits.perThreadPer10MinutesintegerrequireDmarcbooleanHold received mail without a DMARC pass for its From domain: it is stored with the unverified label and does not emit message.received.
flowobjectWhere the new address’s mail goes, saved with the address in one transaction and one routing version: deliver creates the route for its own address, split adds a two-way rule on it (setInboundAddressFlow changes both later). If any part is refused, nothing is created. Needs what changing routes and rules needs.
flow.endpointsobject[]New endpoints this change uses, made with it: a refusal or failure makes none of them.
flow.forwardobjectA new forward, made after the address: its recipient is asked by the new address. deliver and split may name it at once (forward:<name>; <name> in split params): mail received from the moment they allow it is forwarded, never mail received before. The answer’s forward says whether they were emailed.
flow.deliverstring or string or string[] or nullWhere the address's mail goes: the destinations of the route for its own address, as createRoute takes them (inbox, webhook and forward IDs or keys, [] to keep it without an inbox, or 'drop'). Creates the route when there is none; null deletes it.
flow.splitobjectAdds a two-way rule on the new address. Its params may name the new address as inbox:<key>.
Responses
201Success
CreatedInboundAddressidrequiredstringkeyrequiredstring or nullStable key you choose (lowercase letters, digits, hyphens). Config files refer to inbox:<key>, webhook:<key> and forward:<name>.
addressrequiredstringdisplayNamerequiredstring or nulldomainrequiredstringaliasesrequiredstring[]rulesrequiredstring[]publicAddressrequiredstring or nullSend-only address used as the default From. Null to send from the receiving address.
metadatarequiredobjectoriginrequiredstringcreatedAtrequiredstringupdatedAtrequiredstringexpiresAtrequiredstring or nullUTC lease expiry, or null for a permanent address. After expiry, new delivery and sending stop. History stays readable and the address remains reserved until an admin deletes it.
statsrequiredobjectstats.threadsrequiredintegerstats.unreadThreadsrequiredintegerstats.lastMessageAtrequiredstring or nullsendLimitsrequiredobjectLoop guards against runaway agents and reply loops: messages to one recipient per hour, and in one conversation per 10 minutes. The workspace’s sending limits apply on top; there is no hourly or daily cap per address.
sendLimits.perHourrequiredintegerDeprecated and not enforced: an address has no hourly send cap. The value last set (100 if never set); 0 means sending is off.
sendLimits.perDayrequiredintegerDeprecated and not enforced: an address has no daily send cap. The value last set (1000 if never set); 0 means sending is off.
sendLimits.perRecipientPerHourrequiredintegersendLimits.perThreadPer10MinutesrequiredintegerrequireDmarcrequiredbooleanWhen true, received mail without a DMARC pass for its From domain is stored with the unverified label and does not emit message.received.
kindrequiredstringinbox: an agent inbox; manage it with /v1/inboxes.
receivingobjectPresent while the host doesn’t route mail here yet: hosted, an address on one of your own domains, verified or still being verified, turns receiving on at its host if it was off.
receiving.domainIdrequiredstringThe domain the address is on (receiving hosts: /v1/inbound/domains/{id}/hosts).
receiving.hostrequiredstringWhere the address receives.
receiving.turnedOnrequiredbooleanWhether creating the address turned receiving on at this host (it didn’t receive mail before).
receiving.statusrequiredstringThe host’s receiving status now: waiting_for_mx until its MX record is live (poll getInboundDomain or listReceivingHosts).
receiving.verifiedrequiredbooleanWhether the domain is verified. Until it is (its DNS records: getDomain), mail waits even with the MX record live.
receiving.dnsrequiredobject[]The MX record to publish at the host, if it isn’t already: mail arrives once it is.
forwardobjectThe forward flow.forward made, as getEndpoint returns it.
forward.idrequiredstringEndpoint ID: mwh_… for a webhook, con_… for Slack, Discord or a forward. Routes list webhooks and forwards by ID.
forward.namerequiredstringEndpoint name, unique in the workspace across every type. Rules call endpoints.<name>(…).
forward.typerequiredstringforward.statusrequiredstringready: callable. pending: a forward waiting for its recipient to confirm. expired: the confirmation link lapsed. declined: the recipient declined or stopped forwards. paused: deliveries are held.
forward.callrequiredstringHow a rule calls it.
forward.targetrequiredstringWhere it delivers. Slack, Discord and webhook URLs are write-only; only the last four characters are shown.
forward.policyrequiredobjectforward.expiresAtrequiredstring or nullWhen a pending forward confirmation link expires.
forward.requestFromrequiredstring or nullA forward: the address that emailed its recipient to confirm. null when none was asked (preverified) and for other types.
forward.nextSteprequiredstringWhat to do next, for people and agents.
forward.createdAtrequiredstringforward.confirmationrequiredstringemailed: its recipient was asked to confirm (requestFrom names who asked); skipped: preverified, ready at once.
400, 401, 403, 404, 409, 413, 422, 429, 500, 503Request failed; use error.code and requestId to diagnose.
ApiErrorerrorrequiredobjecterror.coderequiredstringerror.messagerequiredstringerror.requestIdrequiredstringerror.fieldstringerror.retryablerequiredbooleanerror.resetAtstringNext capacity change for a Hosted rolling send limit.
error.detailsobject[]Every problem found, when there is more than one part, such as rule diagnostics with rule, line, column, message and hint, or a measurement, such as CONTENT_TOO_LARGE_TO_SCREEN with screenedBytes and limitBytes (and index in a batch).
error.requiredobjectOn a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same.