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

Get a ticket with its messages

gethttps://api.nsin.ir/tickets/{id}

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

One of your tickets with its whole thread, oldest message first, each message with its author and attachments. Fetching a ticket marks it read for you, so the unread count drops.

Path parameters

  • idintegerrequiredpath

Responses

200The ticket, including its message thread.

Content type: application/json

  • idinteger
  • user_idinteger
  • subjectstring
  • statusstring
    One of: "open" "closed"
  • closed_atstring (date-time)
  • closed_by_user_idinteger
  • closed_reasonstring

    Why the ticket is closed: staff when a person closed it, auto when it closed itself after ticket_auto_close_days without a new message. Absent while open. Posting a message to an auto closed ticket reopens it; a staff close is final.

  • user_last_read_message_idinteger

    The newest message you have read; replies after it are unread.

  • staff_last_read_message_idinteger

    The newest message support has read.

  • messagesarray of TicketMessage

    The thread. Populated when fetching a single ticket.

    Item fields
    • idinteger
    • ticket_idinteger
    • author_user_idinteger
    • authorobject

      The message author.

    • bodystring
    • is_staffboolean

      True when written by support staff.

    • attachmentsarray of TicketAttachment
      Item fields
      • idinteger
      • message_idinteger
      • original_namestring
      • content_typestring
      • size_bytesinteger
      • urlstring

        Where to download the attachment.

    • created_atstring (date-time)
    • edited_atstring (date-time)

      When the message was last edited. Absent on a message that has never been edited — render the "edited" marker off this field, not off updated_at.

    • edited_by_user_idinteger

      Who made the last edit. Absent on a message that has never been edited.

    • edit_countinteger

      How many times the message has been edited. 0 for an untouched message.

  • created_atstring (date-time)
  • updated_atstring (date-time)
json
{
  "id": 0,
  "user_id": 0,
  "subject": "string",
  "status": "open",
  "closed_at": "2026-01-01T00:00:00Z",
  "closed_by_user_id": 0,
  "closed_reason": "string",
  "user_last_read_message_id": 0,
  "staff_last_read_message_id": 0,
  "messages": [
    {
      "id": 0,
      "ticket_id": 0,
      "author_user_id": 0,
      "author": {},
      "body": "string",
      "is_staff": true,
      "attachments": [
        {
          "id": 0,
          "message_id": 0,
          "original_name": "string",
          "content_type": "string",
          "size_bytes": 0,
          "url": "string"
        }
      ],
      "created_at": "2026-01-01T00:00:00Z",
      "edited_at": "2026-01-01T00:00:00Z",
      "edited_by_user_id": 0,
      "edit_count": 0
    }
  ],
  "created_at": "2026-01-01T00:00:00Z",
  "updated_at": "2026-01-01T00:00:00Z"
}
400Invalid id.

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"
}
404No such ticket on this account.

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 GET "https://api.nsin.ir/tickets/0" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc