Skip to content

Tickets

Needs: tickets:read tickets:write

A 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.
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.

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, … }
  • 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, …). Use number when talking to people and id in the API.
  • Departments: pass department_id to route it to a team (on plans with departments). Without one, the product’s default department gets it.
  • The Idempotency-Key makes the call safe to retry.
Terminal window
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.

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();
}

PATCH …/tickets/{ticketID} changes the subject, priority, department or tags the same way, with version.

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:

Terminal window
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.

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 (author is agent or customer)
  • ticket.status_changed: with previous_status and status