Tickets
Ticket modules such as Cases have their own endpoints, so a contact form or another app can open tickets and take part in their conversation.
| Method | Path | Action |
|---|---|---|
POST | /api/v1/tickets/{module} | Open a ticket |
GET | /api/v1/tickets/{module}/{id}/messages | List a ticket's messages |
POST | /api/v1/tickets/{module}/{id}/messages | Add a message |
Opening a ticket
Send the requester, a subject and the message as plain text. Any other writable field of the module can come along, like priority:
POST /api/v1/tickets/cases
Content-Type: application/json
{
"requester_email": "ada@example.com",
"requester_name": "Ada Lovelace",
"subject": "Login broken",
"body": "Since this morning I can't log in.",
"priority": "high"
}The response is 201 with data.ticket (the ticket, as GET /api/v1/cases/{id} returns it) and data.message (its first message). The ticket's channel is set to API, and it's assigned like a ticket opened by email.
The conversation
To list a ticket's conversation, oldest first:
GET /api/v1/tickets/cases/{id}/messagesTo add a message:
POST /api/v1/tickets/cases/{id}/messages
Content-Type: application/json
{ "body": "Here is the screenshot.", "author": "customer" }authoriscustomer(the default) oragent.- A customer message counts as an answer from the requester: a ticket waiting on the customer goes back to work, and the owner is notified.
nameandemailare optional and default to the requester's. - An agent message is sent to the requester by email in the name of the token's user, exactly like a reply from the ticket. It counts as the first response, and needs outgoing email to be set up.
Each message has author_type (customer, agent or system for automated emails), author_name, author_email, channel, body_html, subject for emails, attachments and created_at. Internal notes are never part of the API.
To show your team's answers in your app the moment they're sent, use the New ticket message webhook.
Permissions and errors
Opening a ticket and adding a message need the token's Write permission on the module, listing messages needs Read. A module that isn't a ticket module gets a 404, and a ticket that was merged into another one refuses new messages with a 422 naming the ticket it went into.