External ticket source
For Developers

External ticket source

The /api/v1/external section is for a system that keeps tickets on its own side: billing, a CRM, a customer portal. Its support staff work in SupportHub.

Your system calls the section itself: it creates a ticket under its own id, sends the customer’s messages, closes and reopens the ticket and passes on the rating. It reads what the staff did from an event feed with a cursor. SupportHub never calls your system, so your system needs no public address.

Operators see such a ticket with the “External system” channel. An operator’s reply goes only to the event feed: SupportHub sends nothing to the customer’s Telegram or email. Your system shows the reply to the customer.

Who owns what

  • Your system: the ticket and its id, the customer, the subject, the ticket’s fields (fields), the conversation the customer sees.
  • SupportHub: the assignee, the department, notes, tags and priority after creation, SLA, the working status.
  • Both sides: public messages and the open or closed state.

Basics

  • The base address is https://supporthub.cc/api/v1, and the paths below start from it.
  • The key is the project’s API key (Settings → API Keys), sent in the Authorization: Bearer sk_... header, as everywhere in the API (see Authentication). A project has one external source.
  • Request and response bodies are JSON in UTF-8. Times go both ways in UTC, ISO 8601 with Z. SupportHub sends them to the second.
  • External ids (ticket_ext_id, a message’s id, contact.id) are strings of up to 64 characters from A-Z a-z 0-9 . _ : -. A ticket_ext_id is unique among the project’s tickets, a message id among its messages.
  • The limit is 20,000 requests a minute per key, shared with the rest of the API. Above it you get 429 with a Retry-After header (see Limits & errors).
  • Both sides skip fields they don’t know: SupportHub in your requests, your system in responses and events. New fields and event types are added without a new contract version.
GET/api/v1/external/ping

Check the connection

Answers that the key is accepted and the section is on. contract is the contract version, limits holds the maximums: characters in a message text, bytes in a file, files in a message, fields and tags of a ticket.

curl
curl https://supporthub.cc/api/v1/external/ping \
  -H "Authorization: Bearer sk_..."
200 OK
{
  "ok": true,
  "contract": 1,
  "project": { "id": "1c2b...", "name": "My project" },
  "limits": {
    "text_chars": 10000,
    "file_bytes": 268435456,
    "files_per_message": 10,
    "fields": 20,
    "tags": 20
  }
}

The ticket

PUT/api/v1/external/tickets/{ticket_ext_id}

Create or update a ticket

The first call creates an open ticket and answers 201. A repeat with the same ticket_ext_id answers 200 and updates the ticket.

body
{
  "contact": {
    "id": "10452",
    "email": "client@example.com",
    "telegram_id": 123456789,
    "name": "John Smith",
    "locale": "en"
  },
  "subject": "The server does not start",
  "tags": ["tech"],
  "priority": "normal",
  "fields": [
    { "id": "server", "label": "Server", "value": "#812 vm-fra-2", "url": "https://example.com/admin/servers/812" }
  ],
  "created_at": "2026-11-27T10:15:30Z",
  "history": false
}

Fields:

  • contact: the customer, required. contact.id is their id in your system, also required. A ticket keeps its customer: a repeat with another contact.id doesn’t move it. name, email and locale are updated on every call. locale is reduced to the primary language: ru-RU becomes ru
  • SupportHub looks the customer up by contact.id, then by telegram_id, then by email. So send only a confirmed email and Telegram id, or the ticket may end up with another person’s contact
  • subject: the subject, up to 200 characters. Required to create a ticket, a repeat updates it
  • tags: up to 20 tags of up to 64 characters each. priority: low, normal, high or urgent. Both are read only at creation. After that, tags and priority are managed in SupportHub
  • fields: up to 20 ticket fields, id up to 32 characters, label up to 64, value up to 500, url http or https only. Operators see the fields next to the ticket, and a field with a url is a link. A repeat replaces the whole list
  • created_at: when the ticket appeared on your side. Read only at creation, the moment of the call by default
  • history: true for a ticket you are moving in. Operators get no notification, the assistant doesn’t answer, SLA times run from the move
curl
curl -X PUT https://supporthub.cc/api/v1/external/tickets/1024 \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{"contact": {"id": "10452", "email": "client@example.com", "name": "John Smith"}, "subject": "The server does not start"}'
201 Created
{
  "id": "8a3f...",
  "ext_id": "1024",
  "status": "open",
  "created": true,
  "agent_url": "https://supporthub.cc/tickets/8a3f...?ws=..."
}

status is open or closed, and created tells whether this call created the ticket. agent_url is a link that opens the ticket in SupportHub for your staff.

Messages

POST/api/v1/external/tickets/{ticket_ext_id}/messages

Send a message

The first call answers 201. A repeat with the same id answers 200 with the message already stored, and the body of the repeat isn’t applied.

body
{
  "id": "88731",
  "author": "customer",
  "text": "The server has not answered since this morning",
  "media_ids": ["m1..."]
}

Fields:

  • id: the message’s id in your system, required
  • author: customer or staff (a member of your staff), required. Operators see a staff message as a support reply. This is how replies your staff wrote on your side reach SupportHub
  • author_name: the staff member’s name for staff, up to 100 characters
  • text: up to 10,000 characters. Plain text from the customer, Markdown from staff
  • media_ids: up to 10 files from POST /api/v1/media/upload. An unknown id rejects the whole message with 422
  • A text or at least one file is required
  • created_at: the message’s time on your side. Read only with history: true, a live message gets the time it arrives
  • history: true for a message of an old conversation you are moving in

A customer message reopens a closed ticket. A staff message and a message with history: true change no state and notify nobody. Send the messages of one ticket in the order they were written.

curl
curl -X POST https://supporthub.cc/api/v1/external/tickets/1024/messages \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{"id": "88731", "author": "customer", "text": "The server has not answered since this morning"}'
201 Created
{ "id": "f1...", "ext_id": "88731", "created": true }

Closing, reopening and rating

POST/api/v1/external/tickets/{ticket_ext_id}/close

Close a ticket

by is who closed it: customer, staff or system. The response is {"status": "closed"}.

curl
curl -X POST https://supporthub.cc/api/v1/external/tickets/1024/close \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{"by": "customer"}'
POST/api/v1/external/tickets/{ticket_ext_id}/reopen

Reopen a ticket

The same body: by is customer, staff or system. The response is {"status": "open"}.

body
{ "by": "staff" }
POST/api/v1/external/tickets/{ticket_ext_id}/rate

Pass on the customer’s rating

rating is 1 to 5, comment an optional comment. A new rating replaces the earlier one. The response is {"rating": 5}.

body
{ "rating": 5, "comment": "Thanks, it works now" }

All three calls are idempotent and safe to repeat.

Files

  • Upload a customer’s file with POST /api/v1/media/upload: multipart/form-data, a file field, up to 256 MB. Pass its id in the message’s media_ids. See Media for details.
  • The server tells the file type by its content. HTML, SVG and scripts are accepted, but an operator gets them only as a download.
  • A file’s url in an event is a path on the API host: /api/v1/media/<id>. Download the file with the same key. The response is the file itself or a 302 to a signed storage link, which you follow without the Authorization header.
  • Copy the files to your side: SupportHub keeps them for a limited time, 90 days by default.

The event feed

GET/api/v1/external/updates

Get events

  • offset: the id of the last event your system stored. Start with 0
  • timeout: how many seconds to wait for new events, 0 to 30. With 0 the answer comes at once
  • limit: how many events to return at a time, 1 to 100

Events come oldest first. An event’s id grows but isn’t consecutive. If there are no new events and timeout is above zero, the request waits until an event appears or the time runs out. Then the response is {"updates": []}.

curl
curl "https://supporthub.cc/api/v1/external/updates?offset=1795774562123456&timeout=25" \
  -H "Authorization: Bearer sk_..."
200 OK
{
  "updates": [
    {
      "id": 1795774841204913,
      "type": "message.created",
      "timestamp": "2026-11-27T10:20:41Z",
      "data": {
        "id": "5d0c...",
        "ticket_ext_id": "1024",
        "author": "operator",
        "author_name": "Anna",
        "text": "We restarted the server, please check.",
        "media": [
          {
            "id": "m2...",
            "url": "/api/v1/media/m2...",
            "mime_type": "image/png",
            "original_name": "status.png",
            "size": 48211,
            "width": 1280,
            "height": 720
          }
        ],
        "created_at": "2026-11-27T10:20:41Z"
      }
    },
    {
      "id": 1795775467530128,
      "type": "ticket.closed",
      "timestamp": "2026-11-27T10:31:07Z",
      "data": { "ticket_ext_id": "1024", "by": "operator", "at": "2026-11-27T10:31:07Z" }
    }
  ]
}

offset is the acknowledgement: your system has stored every event up to and including it. If an operator’s reply stays unacknowledged for ten minutes, it gets the “Not delivered” mark in SupportHub. The mark goes away as soon as you acknowledge the reply.

  1. Request /external/updates with the offset of the last stored event and timeout=25. Give the HTTP client a longer timeout, 35 seconds for example.
  2. Store the events on your side in order. Drop repeats: check the event id and the message id.
  3. Make the next request with offset set to the id of the last stored event. Keep that offset in your database so that after a restart you carry on from the same place.

What comes in the feed

The feed carries only what originated in SupportHub and is meant for the customer. Your own calls don’t come back as an echo. Notes, assignments, tags, working statuses and scheduled replies that haven’t gone out yet stay out of the feed. Events keep their order within a ticket. An event may come more than once.

  • message.created: a new message for the customer. data has id, ticket_ext_id, author, author_name, text, media, created_at.
  • message.edited: a message was edited. data has id, ticket_ext_id, text, media, edited_at.
  • message.deleted: a message was deleted. data has id, ticket_ext_id, deleted_at.
  • ticket.closed: the ticket was closed. data has ticket_ext_id, by (operator, assistant or system), at.
  • ticket.reopened: the ticket was reopened. data has ticket_ext_id, by (operator or system), at. Always accept it.
  • author is operator, system or assistant. system is a service line of the project for the customer: the ticket was taken, transferred, closed. Show it as a neutral line. It has an id of its own and is never edited or deleted.
  • assistant is reserved for the project’s AI assistant. Its replies will appear in the feed later, without a new contract version, so handle the value now.
  • text is Markdown: bold, italics, strikethrough, code, code blocks, lists, quotes, links. The text has no HTML.
  • media lists the message’s files: id, url, mime_type, original_name, size, width, height.
  • Skip message.edited and message.deleted for a message you have never received.

Errors and your outbox

The section’s errors come in the common envelope {"error_code", "error_message", "detail", "request_id"}, and so does a body that fails validation: 422 with VALIDATION_ERROR. Decide by error_code, not by the HTTP status.

Send your calls through an outbox on your side. We recommend these rules for it:

  • Network errors, 5xx, 429: retry with a growing pause and keep the order of calls within a ticket. After a 429, wait at least as long as Retry-After says.
  • 401: the key was revoked. Stop syncing and tell your admin.
  • 404 TICKET_NOT_FOUND on a message, close, reopen or rating: SupportHub has no such ticket, either not created yet or deleted by an operator. Repeat the PUT and the public history with history: true, then the call itself. This repeat is safe.
  • 403 TICKET_LIMIT_REACHED: the plan’s monthly ticket limit is used up. It happens only on creation. Retry once an hour and tell your admin.
  • 403 CONTACT_BLOCKED: the customer is blocked in the project. Stop sending for this ticket and show it to your staff.
  • 403 PLAN_FEATURE_UNAVAILABLE: the API channel is switched off on the platform. Don’t retry, don’t drop the call, tell your admin.
  • 413 MEDIA_TOO_LARGE, 422 VALIDATION_ERROR: don’t retry, tell your admin.
  • Other 4xx: don’t retry, don’t drop, tell your admin.
An operator can delete a ticket. For the customer this counts as closing it: ticket.closed with by: "operator" comes to the feed. The next call for that ticket answers 404 TICKET_NOT_FOUND. Create the ticket again with PUT, send its public history with history: true and repeat the call. This way the customer’s next message brings the ticket back.

Switching on and off

  • Switching on. Move your open tickets in. For each one call PUT with history: true, then send its public history as messages with history: true, in order and with their created_at.
  • Switching off. Close the open tickets with close and by: "system", or they stay open in the operators’ inbox. The customer won’t see it in your system: SupportHub doesn’t echo your own calls.
POST /api/v1/external/tickets/{ticket_ext_id}/messages
{
  "id": "88702",
  "author": "staff",
  "author_name": "Olga",
  "text": "We will check and get back to you.",
  "created_at": "2026-11-20T09:02:11Z",
  "history": true
}
The first contract version has no assignment event (ticket.assigned), typing indicator, read receipts or reactions. Edits of the customer’s messages aren’t passed on yet either.
Was this page helpful?