Tickets
tickets:read tickets:writeA ticket is a support request that needs follow-up. Your team works tickets in the dashboard; the API lets your systems open them, add replies and keep them moving. Typical uses:
- A contact or refund form in your app that opens a ticket instead of sending an email.
- Monitoring that opens an urgent ticket when a customer’s payment fails.
- An internal tool that resolves tickets when an order ships.
The ticket lifecycle
Section titled “The ticket lifecycle”| Status | Meaning |
|---|---|
open |
Needs your team |
pending |
Waiting for the customer |
on_hold |
Waiting on something else (a supplier, another team) |
resolved |
Done. Can still go back to open, or be closed |
closed |
Finished. Only reopening brings it back |
open, pending and on_hold move freely between each other, and any of them can be resolved. Only a resolved ticket can be closed. Anything else answers 409 INVALID_STATUS_TRANSITION with details.from and details.to.
Open a ticket
Section titled “Open a ticket”A ticket needs a customer, so find or create the customer first.
const res = await fetch(`${base}/tickets`, { method: 'POST', headers: { ...headers, 'Idempotency-Key': `refund-${order.id}` }, body: JSON.stringify({ customer_id: customer.id, subject: `Refund for order #${order.number}`, description: `Reason given in the app: ${form.reason}`, priority: 'high', // low, normal, high or urgent tags: ['refund', 'mobile-app'], // up to 10, lower-case }),});const ticket = await res.json(); // 201: { id, number, status: "open", version: 1, … }ticket = session.post(f"{base}/tickets", headers={"Idempotency-Key": f"refund-{order.id}"}, json={ "customer_id": customer["id"], "subject": f"Refund for order #{order.number}", "description": f"Reason given in the app: {form.reason}", "priority": "high", # low, normal, high or urgent "tags": ["refund", "mobile-app"], # up to 10, lower-case}).json() # 201: { id, number, status: "open", version: 1, … }- The customer is emailed a link to follow the ticket and reply. Make sure their email is right.
- Tickets are numbered per product (
number: #1, #2, …). Usenumberwhen talking to people andidin the API. - Departments: pass
department_idto route it to a team (on plans with departments). Without one, the product’s default department gets it. - The
Idempotency-Keymakes the call safe to retry.
Reply to the customer
Section titled “Reply to the customer”curl https://api.supportaka.com/api/v1/organizations/$ORG/products/$PRODUCT/tickets/$TICKET/replies \ -H "Authorization: Bearer $SUPPORTAKA_KEY" \ -H "Content-Type: application/json" \ -d '{ "body": "Good news: your refund was sent today and should arrive within 3 working days." }'Replies are public: the customer gets them by email. The reply is from the owner who made the API key, so the dashboard shows their name. To attach a file, upload it first (see files) and pass its ID in attachment_ids.
A closed ticket takes no replies (409 TICKET_CLOSED). Reopen it first with POST …/tickets/{ticketID}/reopen.
Change the status
Section titled “Change the status”Status changes need the ticket’s current version, so you never overwrite a change you haven’t seen:
async function resolve(ticketId) { const ticket = await fetch(`${base}/tickets/${ticketId}`, { headers }).then((r) => r.json()); const res = await fetch(`${base}/tickets/${ticketId}/status`, { method: 'POST', headers, body: JSON.stringify({ status: 'resolved', version: ticket.version }), }); if (res.status === 409) { const error = await res.json(); if (error.code === 'TICKET_VERSION_CONFLICT') return resolve(ticketId); // someone changed it: read again throw new Error(error.code); } return res.json();}def resolve(ticket_id): ticket = session.get(f"{base}/tickets/{ticket_id}").json() res = session.post(f"{base}/tickets/{ticket_id}/status", json={"status": "resolved", "version": ticket["version"]}) if res.status_code == 409 and res.json()["code"] == "TICKET_VERSION_CONFLICT": return resolve(ticket_id) # someone changed it: read again res.raise_for_status() return res.json()PATCH …/tickets/{ticketID} changes the subject, priority, department or tags the same way, with version.
Find tickets
Section titled “Find tickets”GET …/tickets filters with status, priority, customer_id, department_id, tag, assignee and q (text search), and is paginated. For example, a customer’s open tickets:
curl "https://api.supportaka.com/api/v1/organizations/$ORG/products/$PRODUCT/tickets?customer_id=$CUSTOMER&status=open" \ -H "Authorization: Bearer $SUPPORTAKA_KEY"GET …/tickets/{ticketID}/messages gives the conversation (replies, and your team’s internal notes, marked kind: "note"), and …/events its full history.
Know when something changes
Section titled “Know when something changes”Instead of polling, subscribe a webhook to:
ticket.created: a ticket was opened, from anywhere (your API, the widget, email or the dashboard)ticket.message_created: someone replied (authorisagentorcustomer)ticket.status_changed: withprevious_statusandstatus