Open a support ticket
Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.
Send JSON for a text-only ticket, or multipart/form-data to attach
files. See TicketAttachmentUpload for what may be attached.
With multipart/form-data, message may be empty as long as at least
one file is attached; with JSON it is required.
Request body
Content type: application/json · required
- subjectstringrequired
- messagestringrequired
Content type: multipart/form-data · required
- subjectstringrequired
- messagestring
- filesarray of string (binary)
Up to 8 files per message.
Responses
201The created ticket and its first message.
Content type: application/json
- ticketTicket
Fields
- idinteger
- user_idinteger
- subjectstring
- statusstringOne of:
"open""closed" - closed_atstring (date-time)
- closed_by_user_idinteger
- closed_reasonstring
Why the ticket is closed:
staffwhen a person closed it,autowhen it closed itself afterticket_auto_close_dayswithout a new message. Absent while open. Posting a message to anautoclosed ticket reopens it; astaffclose 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.
0for an untouched message.
- created_atstring (date-time)
- updated_atstring (date-time)
- first_messageTicketMessage
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.
0for an untouched message.
{
"ticket": {
"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": null,
"message_id": null,
"original_name": null,
"content_type": null,
"size_bytes": null,
"url": null
}
],
"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"
},
"first_message": {
"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
}
}400Invalid body, a missing/oversized subject or message, or a rejected attachment — wrong type, over its size cap, more than eight files, or a file whose contents do not match its extension.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "only JPEG, PNG, GIF, WebP images or .txt/.log/.json files are allowed (images up to 3 MB, text up to 1 MB)"
}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.
{
"error": "invalid API key"
}403The key is read-only and this endpoint is a write. Read-only keys may
only issue GET, HEAD and OPTIONS.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"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.
{
"error": "rate limit exceeded"
}Example request
curl -X POST "https://api.nsin.ir/tickets" \
-H "Authorization: Bearer $NSIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "string",
"message": "string"
}'