Skip to content

Helpdesk

Helpdesk endpoints need the Helpdesk product. Reading tickets needs ticket:read; replying as staff, changing fields and closing need helpdesk:ticket:work. Full details: Helpdesk API.

Recipe: open a ticket from a monitoring alert

Turn an alert into a ticket on the right project, so it follows your normal SLA and assignment rules.

Terminal window
# The project the alert belongs to
PROJECT_ID=$(curl -s "$OPEX/api/projects?search=Portal&pageSize=1" -H "X-API-Key: $OPEX_API_KEY" \
| jq -r '.items[0].id')
curl -s -X POST "$OPEX/api/helpdesk/tickets" \
-H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \
-d "{\"projectId\":\"$PROJECT_ID\",\"title\":\"Disk usage above 90% on db-01\",
\"body\":\"<p>Alert from monitoring: /var/lib/postgresql at 92%.</p>\",\"priority\":\"high\"}" \
| jq '{ticket: {id: .ticket.id, number: .ticket.number, status: .ticket.status, priority: .ticket.priority}, duplicate, aiAnswered}'
{
"ticket": {
"id": "adaa732e-5b97-45b0-b81c-226c370e1999",
"number": "SUP-2026-000018",
"status": "new",
"priority": "high"
},
"duplicate": null,
"aiAnswered": false
}

body is HTML. When the new ticket looks like an open one, duplicate names it, so your integration can link the two instead of paging people twice. Before opening a ticket for a repeating alert, search for an open one first (GET /api/helpdesk/tickets?search=db-01&mine=1).

Recipe: reply and close

Terminal window
TICKET_ID=adaa732e-5b97-45b0-b81c-226c370e1999
# Public reply: emailed to the requester. Use "internal": true for a staff-only note.
curl -s -X POST "$OPEX/api/helpdesk/tickets/$TICKET_ID/events" \
-H "X-API-Key: $OPEX_API_KEY" -H "content-type: application/json" \
-d '{"body":"<p>Old WAL files removed, usage back to 61%.</p>","internal":false}'
{ "ok": true, "id": "91fac49c-496c-47c6-b3dd-976fa1d5efa3" }
Terminal window
curl -s -X POST "$OPEX/api/helpdesk/tickets/$TICKET_ID/close" -H "X-API-Key: $OPEX_API_KEY"
{ "ok": true, "status": "CLOSED" }

status is the code of your workspace’s closed status. If your status workflow needs other actions before closing, the ticket stays put and the answer lists them in awaitingTriggers. Consultants can close only tickets assigned to them.