Create an email address
const url = 'https://api.nsin.ir/domains/example.com/email-routing/rules/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"local_part":"example","action":"forward","destination_id":1,"name":"example","enabled":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.nsin.ir/domains/example.com/email-routing/rules/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "local_part": "example", "action": "forward", "destination_id": 1, "name": "example", "enabled": true }'local_part is the part before @ — ASCII letters, digits and
!#$%&'*+/=?^_\{|}~.-, at most 64 characters, lowercased; a +only when the domain'ssubaddressingis on.actionisforward(with adestination_idfrom the domain owner's account) ordrop. A rule whose destination is not verified yet is stored and goes live on verification. Counts against the plan's max_email_rules. Requires records.edit`.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comRequest Body required
Section titled “Request Body required ”object
Required for forward; from the domain owner’s account.
Update only; create always starts enabled.
Responses
Section titled “ Responses ”The created rule.
object
The full address, local_part@domain.
Your switch.
Whether the address is live right now — enabled, routing on for the
domain, and (for forward) the destination verified.
Optional label.
Example
{ "action": "forward"}Invalid local part, action or destination (field names it).
object
Human-readable description of what went wrong.
Machine-readable reason (hosts_not_ready, kek_unset, loop, no_mx, unverified).
The offending body field, when one applies.
Example
{ "error": "read-only API key"}Missing, malformed, revoked or expired API key — or the owning account is inactive.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}The key is read-only, your role lacks the permission, the domain has no
active plan (402-class message with upgrade_url), the plan does not
include Email Routing, or the plan’s max_email_rules is reached —
the body then carries max_rules and upgrade_url.
object
Human-readable description of what went wrong.
Examples
{ "error": "You have reached the maximum number of email addresses for this domain's plan. Upgrade the plan for this domain to add more.", "max_rules": 50, "upgrade_url": "/plans"}No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}An address with this local part already exists (conflict: local_part).
object
Human-readable description of what went wrong.
What conflicts (mx, spf, spf_multiple, external_dns, domain_status, not_enabled, local_part, destination).
For mx / spf_multiple — the rows in the way.
object
For spf — the existing SPF row.
For spf — its current value.
For spf — what it becomes with our include merged in.
For destination — the existing row.
object
When the last verification mail went out.
Seconds until another verification mail may be sent; 0 when allowed now.
Rules and catch-alls pointing at it.
The receiving server’s last refusal, when forwards to it are bouncing.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}