Skip to main content
This page demonstrates the most common API workflow: creating or finding a session, creating a ticket, and adding a comment to that ticket.

Common Flow Example

This example walks through a complete workflow that you’ll use frequently when integrating with the Gleap API.

Step 1: Create or Find a Session

First, create a session to represent a user or contact. If a session with the same userId already exists, you can use that session ID instead. Endpoint: POST /v3/sessions Request:
Response:
Save the _id or id from the response - you’ll need it to create a ticket linked to this session.

Step 2: Create a Ticket

Now create a ticket and link it to the session you just created. The ticket represents a support request, bug report, or feature request. Endpoint: POST /v3/tickets Request:
Response:
Save the _id or id from the ticket response - you’ll need it to add comments to this ticket.

Step 3: Create a Comment

Add a comment to the ticket. Comments can be simple text or rich formatted content. You can also attach files. Endpoint: POST /v3/messages Request (Simple Text Comment):
Request (Rich Formatted Comment with Attachments):
Request (Internal Note):
Response:

Step 4: Create a Comment from Markdown

Instead of building the rich-text JSON structure yourself, you can send Markdown via the markdownComment field. The server converts it to rich text automatically, and it takes precedence over comment if both are set. Endpoint: POST /v3/messages Request:
Messages created through this endpoint are always attributed to the user that owns the API key. It is not possible to create a comment on behalf of a customer (session) via this endpoint.

Reading a Ticket’s Status History

Every internal change to a ticket (status, assignee, team, priority, type, tags, title, due date) is recorded as a history entry. Use the ticket history endpoint to read them: Endpoint: GET /v3/tickets/{ticketId}/history Request:
Response:
Key details:
  • Entries are returned oldest first. The endpoint is not paginated; limit defaults to 1000 (max 5000) and truncated is true when the ticket has more entries than limit.
  • data.type identifies what changed (STATUS, PROCESSING_USER, PROCESSING_TEAM, PRIORITY, TYPE, TAGS_ADDED, TAGS_REMOVED, TITLE, DUE_DATE, …) and data.value carries the new value — for status changes, the status key of the target Kanban lane.
  • History entries are retained for 180 days. If you need a longer record, fetch and persist them on your side.
Prior to August 2026, these entries were also returned by GET /v3/messages as FEEDBACK_UPDATED messages. That endpoint now returns conversation messages only — integrations that reconstruct status history from /v3/messages should switch to /v3/tickets/{ticketId}/history, which returns the same entry shape.

Uploading Images for Help Center Articles

Help center article content is rich text (TipTap JSON). Images inside an article are image nodes that reference a hosted image URL, so adding screenshots via the API is a two-step flow: upload each image to get a permanent CDN URL, then reference those URLs in the article content.

Step 1: Upload the Image

Send the file as multipart/form-data in a form field named file (up to 100 MB). Endpoint: POST /v3/uploads Request:
Response:
If your images are already hosted at a public URL, you can import them instead of re-uploading. The server downloads the image, validates that it really is one (PNG, JPEG, GIF, WebP, SVG or BMP), and stores a copy on the Gleap CDN: Endpoint: POST /v3/uploads/from-url Request:

Step 2: Reference the Images in the Article Content

Use each returned fileUrl as the src of an image node when creating or updating an article: Endpoint: POST /v3/helpcenter/collections/{helpcenterCollectionId}/articles Request:

Bulk Uploads

There is no separate batch endpoint — upload files one request at a time and collect the returned URLs. A small script keeps this manageable:
Uploaded files are stored permanently on the Gleap CDN and the returned URLs are stable, so you can safely reference them from any number of articles. See the Help center articles endpoints for the full article schema.