Skip to main content

Endpoint

PATCH /api/v1/tickets/{id}/assign

Authentication

Requires authentication with ticket:write permission.

Path Parameters

ParameterTypeRequiredDescription
idstring (UUID)YesTicket ID to assign

Request Body

{
  "technicianId": "550e8400-e29b-41d4-a716-446655440000"
}

Body Parameters

ParameterTypeRequiredDescription
technicianIdstring (UUID)YesID of the technician/admin to assign the ticket to

Request Example

curl -X PATCH "http://localhost:3001/api/v1/tickets/550e8400-e29b-41d4-a716-446655440000/assign" \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-cookie" \
  -d '{
    "technicianId": "550e8400-e29b-41d4-a716-446655440001"
  }'

Response

Success Response (200)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "userId": "550e8400-e29b-41d4-a716-446655440002",
  "status": "PENDING",
  "category": "MAINTENANCE",
  "title": "Elevator Malfunction",
  "description": "Elevator not working on floor 3",
  "attachments": ["https://example.com/image1.jpg"],
  "assignedTo": "550e8400-e29b-41d4-a716-446655440001",
  "notes": "Assigned to technician",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T12:00:00Z"
}

Error Response (400)

{
  "success": false,
  "error": {
    "message": "Invalid ticket ID format",
    "code": "VALIDATION_ERROR"
  }
}

Error Response (404)

{
  "success": false,
  "error": {
    "message": "Ticket not found",
    "code": "NOT_FOUND"
  }
}

Error Response (401)

{
  "success": false,
  "error": {
    "message": "Unauthorized access",
    "code": "UNAUTHORIZED"
  }
}

Error Response (403)

{
  "success": false,
  "error": {
    "message": "Insufficient permissions",
    "code": "FORBIDDEN"
  }
}

Notes

  • The ticket’s updatedAt timestamp is automatically updated
  • The assigned technician must be a valid admin/technician in the system
  • Assigning a ticket doesn’t automatically change its status
  • Use the Change Ticket Status endpoint to update status after assignment