Welcome to our new docs! Please keep in mind we are still working on making everything is as accurate as possible. Join us on discord and ask us questions if you are unsure.
DezerX Spartan Logo
Ticket

Create New Ticket

Create a new support ticket for a user

POST
/api/application/tickets
AuthorizationBearer <token>

Bearer token authentication

In: header

namestring
Lengthlength <= 255
descriptionstring
departmentstring
user_idinteger
related_service_id?integer

Response Body

curl -X POST "https://api.example.com/api/application/api/application/tickets" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Login Issue",
    "description": "I cannot access my account dashboard. Getting error message when trying to log in",
    "department": "Technical Support",
    "user_id": 5
  }'
{
  "success": true,
  "message": "Ticket created successfully",
  "data": {
    "id": 1,
    "name": "Account Access Issue",
    "description": "Cannot access my account dashboard",
    "status": "open",
    "department": "Support",
    "related_service_id": 3,
    "user_id": 5,
    "extra_user_ids": null,
    "created_at": "2024-01-15T10:30:00.000000Z",
    "updated_at": "2024-01-15T10:30:00.000000Z",
    "user_display_name": "John Doe",
    "user": {
      "id": 5,
      "name": "John Doe",
      "email": "user@example.com"
    },
    "service": {
      "id": 3,
      "service_name": "Example Service",
      "status": "active"
    },
    "messages": [
      {
        "id": 1,
        "ticket_id": 1,
        "user_id": 5,
        "message": "I'm having trouble with my account access",
        "is_staff": false,
        "attachments": null,
        "created_at": "2024-01-15T10:30:00.000000Z",
        "updated_at": "2024-01-15T10:30:00.000000Z",
        "user_display_name": "John Doe",
        "user": {
          "id": 5,
          "name": "John Doe",
          "email": "user@example.com"
        }
      }
    ]
  }
}
{
  "success": false,
  "message": "Bad request"
}
{
  "error": "Unauthorized",
  "message": "Bearer token required"
}

{
  "error": "Forbidden",
  "message": "Insufficient permissions for this action"
}

{
  "success": false,
  "message": "Validation failed",
  "errors": {
    "name": [
      "The name field is required."
    ],
    "department": [
      "The selected department is invalid."
    ],
    "user_id": [
      "The selected user id is invalid."
    ],
    "status": [
      "The selected status is invalid."
    ],
    "message": [
      "The message field is required."
    ],
    "is_staff": [
      "The is staff field is required."
    ]
  }
}

{
  "success": false,
  "message": "Error creating ticket: Database connection failed"
}