nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Email Routing

Enable or disable an email address

posthttps://api.nsin.ir/domains/{domain}/email-routing/rules/{ruleId}/toggle

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

Flips the address's enabled flag and returns it. A disabled address is treated as if it did not exist. Switching on a forward address that has no destination is refused with 400. Requires records.edit.

Path parameters

  • domainstringrequiredpath

    The domain name (for example example.com) — not a numeric id.

  • ruleIdintegerrequiredpath

    Numeric id of the email address rule, from the rule list.

Responses

200The rule after the flip.

Content type: application/json

  • idinteger
  • local_partstring

    The part before the @, lowercased.

  • addressstring

    The full address, local_part@domain.

  • actionstring

    forward delivers to the destination; drop accepts the mail and discards it.

    One of: "forward" "drop"
  • destination_idinteger | null

    The destination mail is forwarded to. null for drop.

  • destination_emailstring | null

    That destination's address.

  • destination_verifiedboolean

    Whether the destination has confirmed its address; unverified destinations receive nothing.

  • enabledboolean

    Your switch.

  • activeboolean

    Whether the address is live right now — enabled, routing on for the domain, and (for forward) the destination verified.

  • namestring

    Optional label.

  • created_atstring (date-time)
  • updated_atstring (date-time)
json
{
  "id": 0,
  "local_part": "string",
  "address": "string",
  "action": "forward",
  "destination_id": 0,
  "destination_email": "string",
  "destination_verified": true,
  "enabled": true,
  "active": true,
  "name": "string",
  "created_at": "2026-01-01T00:00:00Z",
  "updated_at": "2026-01-01T00:00:00Z"
}
400The rule forwards but has no destination; set one first.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
401Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "invalid API key"
}
403The key is read-only, your role on the domain lacks the required permission, or the domain's plan does not include the feature.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such domain, or no such rule on it.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
429The key exceeded its request budget (300 requests per minute by default).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "rate limit exceeded"
}

Example request

bash
curl -X POST "https://api.nsin.ir/domains/example.com/email-routing/rules/0/toggle" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc