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

Invite someone to the domain

posthttps://api.nsin.ir/domains/{domain}/invites

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

Creates an invitation and emails it.

An invite is bound to the address it was sent to: forwarding the email does not let someone else accept it. Requires members.manage.

Path parameters

  • domainstringrequiredpath

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

Request body

Content type: application/json · required

  • emailstring (email)required
  • rolestringrequired

    A role that may be assigned to a member or invitation. owner is not grantable — it always follows domain ownership.

    One of: "admin" "editor" "viewer"
  • expires_in_hoursinteger

    Lifetime of the invitation. Omit for the default.

Responses

200Invitation created, with its accept link.

Content type: application/json

  • idinteger
  • domain_idinteger
  • emailstring

    The address the invitation is bound to.

  • rolestring

    A role that may be assigned to a member or invitation. owner is not grantable — it always follows domain ownership.

    One of: "admin" "editor" "viewer"
  • invited_byinteger

    User id of the inviter.

  • expires_atstring (date-time)
  • max_usesinteger
  • usesinteger
  • revoked_atstring (date-time)
  • created_atstring (date-time)
  • linkstring

    The accept URL. Returned when the invitation is created or resent.

  • is_linkboolean

    True for a shareable link rather than an emailed invitation.

  • exhaustedboolean

    True when uses has reached max_uses.

json
{
  "id": 0,
  "domain_id": 0,
  "email": "string",
  "role": "admin",
  "invited_by": 0,
  "expires_at": "2026-01-01T00:00:00Z",
  "max_uses": 0,
  "uses": 0,
  "revoked_at": "2026-01-01T00:00:00Z",
  "created_at": "2026-01-01T00:00:00Z",
  "link": "string",
  "is_link": true,
  "exhausted": true
}
400Invalid body, an invalid role, a missing or malformed email, an attempt to invite yourself, or an attempt to invite the domain's owner.

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 it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
409That user is already a member.

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/invites" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "string",
  "role": "admin",
  "expires_in_hours": 0
}'
esc