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

Open a stored message

gethttps://api.nsin.ir/domains/{domain}/email-routing/inbox/{id}

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

The parsed message: headers, plain text, sanitised HTML (scripts, handlers and remote content removed), the attachment list and warnings. SPF/DKIM/DMARC come from what NSIN checked on arrival, never from the mail's own headers. Needs email:read and domain.view. Opens are limited to two at a time per domain (429 with retry_after_seconds when busy). Recorded before anything is served.

Path parameters

  • domainstringrequiredpath

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

  • idintegerrequiredpath

    A stored message's id (from the inbox list or a mail.stored webhook).

Query parameters

  • mark_readbooleanquery

    true marks the message read for everyone. Without it a key leaves it unread, so the owner still sees it as new. Ignored for read-only keys.

    Default: false

Responses

200The message.

Content type: application/json

  • idinteger

    Use it with GET …/inbox/{id}.

  • rcptstring

    The address it was sent to on your domain.

  • mailboxstring

    The local part of rcpt (info).

  • fromstring

    The From header.

  • mail_fromstring

    The envelope sender.

  • subjectstring
  • sent_atstring | null (date-time)

    The Date header

  • created_atstring (date-time)

    When it arrived.

  • sizeinteger

    Size in bytes.

  • has_attachmentsboolean
  • readboolean
  • folderstring
    One of: "inbox" "spam" "trash"
  • is_spamboolean
  • authobject

    What NSIN checked on arrival.

    Fields
    • spfstring
    • dkimstring
    • dmarcstring
  • toarray of string
  • ccarray of string
  • reply_toarray of string
  • message_idstring

    The Message-ID header.

  • headersarray of object

    The headers in order. Authentication-Results not written by NSIN are removed.

    Item fields
    • namestring
    • valuestring
  • textstring

    The plain-text body (or text made from the HTML).

  • htmlstring

    Sanitised HTML; empty when the mail has none.

  • html_has_remoteboolean

    The HTML referred to remote images

  • attachmentsarray of object
    Item fields
    • indexinteger

      Use it with …/attachments/{index}.

    • filenamestring
    • content_typestring
    • sizeinteger
    • dangerousboolean

      An executable or script type.

  • warningsarray of string

    Things to be careful about, such as foreign_auth_results or link_mismatch.

  • spam_scorenumber
json
{
  "id": 0,
  "rcpt": "string",
  "mailbox": "string",
  "from": "string",
  "mail_from": "string",
  "subject": "string",
  "sent_at": "2026-01-01T00:00:00Z",
  "created_at": "2026-01-01T00:00:00Z",
  "size": 0,
  "has_attachments": true,
  "read": true,
  "folder": "inbox",
  "is_spam": true,
  "auth": {
    "spf": "string",
    "dkim": "string",
    "dmarc": "string"
  },
  "to": [
    "string"
  ],
  "cc": [
    "string"
  ],
  "reply_to": [
    "string"
  ],
  "message_id": "string",
  "headers": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "text": "string",
  "html": "string",
  "html_has_remote": true,
  "attachments": [
    {
      "index": 0,
      "filename": "string",
      "content_type": "string",
      "size": 0,
      "dangerous": true
    }
  ],
  "warnings": [
    "string"
  ],
  "spam_score": 0
}
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 has no email:read.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such message on this domain, or the domain is not visible to you.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
410The mail is no longer on the mail host or can no longer be opened.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
429Too many opens for this domain right now; retry after retry_after_seconds.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
502The mail host did not answer; retry.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}

Example request

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