Developers
ENPT

Tickets

Read the tickets of a contact or conversation and update or move them from your own system.

A ticket records a request that needs follow-up, such as a complaint, a quote or a support case. Tickets move through the stages you configured in Tickets, from open to closed.

Use the API to keep another system in sync with Tolky:

  • Read tickets of a contact, of a conversation or a single ticket, with its history of events.
  • Update a ticket: subject, description, definition of done, importance, assigned operator, open or closed.
  • Move a ticket to another stage of your board.
Closing a ticket with open conversations

A ticket cannot be closed while its conversations are still open. The response tells you so. Send the request again with forceCloseConversations: true to close those conversations together with the ticket.

ReferenceTechnical details

Get tickets

POST /api/externalAPIs/public/tickets/getTickets with a host token (Authorization: Bearer $TOLKY_TOKEN).

Send one search key. When you send more than one, the first in this order wins: ticketId, leadId, conversationId.

NameTypeRequiredDescription
ticketIdstringOne of the threeA single ticket.
leadIdstringOne of the threeAll tickets of a contact.
conversationIdstringOne of the threeAll tickets of a conversation.
avatarIdstring or string[]NoOnly tickets of these avatars.
includeEventsbooleanNoInclude the ticket history. Default true.
includeClosedbooleanNoInclude closed tickets. Default true.
includeDeletedbooleanNoInclude deleted tickets. Default false.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tickets/getTickets" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "leadId": "3f0c2a8e-...", "includeClosed": false }'
{
  "code": 200,
  "message": "OK",
  "data": {
    "success": true,
    "count": 1,
    "data": [
      {
        "id": "3f0c2a8e-...",
        "protocol": "...",
        "subject": "Refund request",
        "description": "Customer asked for a refund of order #4821.",
        "definitionOfDone": "Refund confirmed to the customer.",
        "status": { "name": "In progress", "level": 2, "color": "#F5A623", "isClosed": false },
        "importance": 2,
        "closed": false,
        "assignedUser": { "id": "3f0c2a8e-...", "name": "Ana" },
        "contact": { "name": "Maria", "email": "maria@example.com", "phone": "5511999999999" },
        "events": [],
        "createdAt": "2026-07-01T12:00:00.000Z"
      }
    ],
    "searchCriteria": { "ticketId": null, "leadId": "3f0c2a8e-...", "conversationId": null },
    "message": "Successfully retrieved 1 ticket(s)"
  }
}
FieldDescription
data[].protocolTicket protocol shown to customers and operators.
data[].statusCurrent stage: name, level, color and whether it is a closing stage.
data[].importanceImportance level. importanceColor comes with it.
data[].assignedUserOperator responsible, or null.
data[].contactContact name, e-mail and phone.
data[].leadId, conversationId, avatarIdLinks to the contact, the conversation and the avatar.
data[].eventsHistory, newest first: type, createdAt, description, summary, pendingActions.
data[].ticketLevelIdID of the current stage.

Tickets are returned newest first.

Update or move a ticket

POST /api/externalAPIs/public/tickets/updateTicket. Send ticketId and at least one change. You can update fields and move the ticket in the same call.

NameTypeRequiredDescription
ticketIdstringYesTicket to change.
subjectstringNoNew subject.
descriptionstringNoNew description.
definitionOfDonestringNoWhat must happen for the ticket to be done.
importanceobjectNo{ "importance_level": 2 }, using a level configured in your account.
assignedUserobject or nullNo{ "hostPeopleId": "..." } to assign an operator, null to remove. The operator must belong to the ticket's department.
closedbooleanNoClose or reopen the ticket.
forceCloseConversationsbooleanNoWhen closing, also close the ticket's open conversations.
newLevelstring or numberNoStage to move to: the stage ID, its name or its level number.
reasonstringNoReason recorded with the move.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tickets/updateTicket" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ticketId": "3f0c2a8e-...",
    "description": "Refund approved by finance.",
    "newLevel": "Resolved",
    "reason": "Refund paid"
  }'
{
  "code": 200,
  "message": "OK",
  "data": {
    "success": true,
    "message": "Ticket updated and moved successfully",
    "data": {
      "ticketId": "3f0c2a8e-...",
      "operationsPerformed": { "updated": true, "moved": true },
      "updateResult": { "id": "3f0c2a8e-...", "description": "Refund approved by finance." },
      "moveResult": { "code": 200, "success": true, "message": "Ticket movido com sucesso" },
      "finalTicketState": { "id": "3f0c2a8e-...", "status_name": "Resolved", "closed": true }
    }
  }
}
FieldDescription
data.operationsPerformedWhich operations ran: updated and moved.
data.updateResultThe updated ticket. When the update was not applied, it comes with success: false and a message. When closing with open conversations, it also returns needCloseConversations: true and openConversations.
data.moveResultResult of the stage move: success and message.
data.finalTicketStateThe ticket after the changes.

Errors

Both endpoints answer errors with HTTP 500 and the reason in message, including validation errors such as a missing ticketId, no search key, no change sent, or an operator outside the ticket's department.

Previous

Messaging

Next

Forms (FormFlow)