Skip to main content

POST /api/v1/tickets

Creates and initializes a new technical support ticket in WispHub. This endpoint performs preventive verification to ensure the zone does not exceed the allowed threshold of open tickets to avoid visit saturation. It also automatically calculates the approximate resolution date based on business days configured in the system.
The system enforces a zone-level ticket limit. If a zone already has the maximum number of active tickets (default: 3), the request will be rejected with a zone_ticket_limit_reached action.

Request Body

service_id
integer
required
The unique identifier of the service associated with this ticket
subject
string
required
Brief summary of the ticket issue. Must match exactly one of the valid subjects returned by GET /api/v1/tickets/subjects.
description
string
required
Detailed description of the technical issue or support request
technician_id
integer
required
ID of the assigned technician.
zone_id
integer
required
The zone ID where the customer is located. Used to enforce ticket limits per zone

Response

The endpoint returns a BackendResponse wrapper with the following structure:
ok
boolean
Indicates if the request was successful
type
string
Response type: success, error, or info
action
string
Action identifier for the response. Possible values:
  • ticket_created - Ticket successfully created
  • ticket_creation_failed - Failed to create ticket
  • zone_ticket_limit_reached - Zone has reached maximum active tickets
data
object | null
Response data object
message
string | null
Optional message providing additional context
meta
object | null
Optional metadata

Zone Blocking Logic

The endpoint implements ticket throttling at the zone level:
  • MAX_ACTIVE_TICKETS_PER_ZONE: Default value is 3
  • ACTIVE_TICKET_STATES: Tickets in state 1 are considered active
  • If a zone already has 3 or more active tickets, new ticket creation is blocked
  • The system returns an info response with action zone_ticket_limit_reached

Resolution Date Calculation

  • MAX_TICKET_RESOLUTION_DAYS: Default value is 3 business days
  • The end_date field represents the estimated resolution date
  • Calculated by adding business days to the creation timestamp
  • Weekends and holidays are excluded from the calculation
curl -X POST https://api.wisphub.net/api/v1/tickets \
  -H "Content-Type: application/json" \
  -d '{
    "service_id": 100,
    "subject": "Falla Masiva",
    "description": "Cliente reporta intermitencia en el servicio de internet",
    "technician_id": 5,
    "zone_id": 2
  }'

Example Responses

{
  "ok": true,
  "type": "success",
  "action": "ticket_created",
  "data": {
    "ticket_id": 50,
    "subject": "Falla Masiva",
    "created_at": "2026-02-26 10:00",
    "end_date": "2026-02-28 10:00",
    "status_ticket": "Abierto",
    "priority": "3",
    "answer_text": null
  },
  "message": null,
  "meta": null
}

Error Handling

Always check the action field to determine the outcome:
  • ticket_created: Success - ticket was created
  • zone_ticket_limit_reached: Zone has too many active tickets
  • ticket_creation_failed: An error occurred during creation
When the zone limit is reached, you should:
  1. Inform the user that the zone has reached maximum capacity
  2. Display the max_tickets value from the response
  3. Wait for existing tickets to be resolved before creating new ones