Skip to main content

Create Ticket

This API allows you to create a new ticket.

📍 Endpoint

POST {base_url}/api/ticket

🧾 Headers

KeyValue
AuthorizationYOUR_TOKEN_HERE
Content-Typemultipart/form-data

📤 Request Body

{
"subject": "عنوان تیکت",
"category_id": "123",
"description": "متن تیکت",
"sms_notification": "1",
"file": "file1.zip"
}

📝 Parameters

ParameterTypeRequiredDescription
subjectstringYesThe subject of the ticket.
category_idstringYesThe ID of the ticket category.
descriptionstringYesThe content of the ticket.
sms_notificationstringNoIf set to "1", the user will receive an SMS notification when the ticket is updated. Default is "0".
filefileNoAn optional file to attach to the ticket.

✅ Success Response

{
"data": {
"ticket_id": 123456
},
"meta": {
"status": true,
"message": "انجام شد",
"message_parameters": [],
"message_code": "200-1"
}
}

❌ Error Response — Invalid or Expired Token (401)

{
"data": null,
"meta": {
"status": false,
"message": "اطلاعات وارد شده صحیح نمی باشد",
"message_parameters": [],
"message_code": "400-1",
"errors": {}
}
}

❌ Error Response — Invalid Request (422)

{
"data": null,
"meta": {
"status": false,
"message": "تکمیل گزینه subject الزامی است (و 1 خطای دیگر)",
"message_parameters": [],
"message_code": "400-2",
"errors": {
"subject": [
"تکمیل گزینه subject الزامی است"
],
"category_id": [
"تکمیل گزینه category_id الزامی است"
],
"description": [
"تکمیل گزینه description الزامی است"
]
}
}
}

🧪 Example Request

curl --location '{base_url}/api/ticket' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Your Apikey/Token' \
--form 'subject="عنوان تیکت"' \
--form 'category_id="123"' \
--form 'description="متن تیکت"' \
--form 'sms_notification="1"' \
--form 'file=@"/path/to/your/file.zip"'