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 sameuserId already exists, you can use that session ID instead.
Endpoint: POST /v3/sessions
Request:
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:
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):
Step 4: Create a Comment from Markdown
Instead of building the rich-text JSON structure yourself, you can send Markdown via themarkdownComment 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:
- Entries are returned oldest first. The endpoint is not paginated;
limitdefaults to 1000 (max 5000) andtruncatedistruewhen the ticket has more entries thanlimit. data.typeidentifies what changed (STATUS,PROCESSING_USER,PROCESSING_TEAM,PRIORITY,TYPE,TAGS_ADDED,TAGS_REMOVED,TITLE,DUE_DATE, …) anddata.valuecarries 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.
Uploading Images for Help Center Articles
Help center articlecontent 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 asmultipart/form-data in a form field named file (up to 100 MB).
Endpoint: POST /v3/uploads
Request:
POST /v3/uploads/from-url
Request:
Step 2: Reference the Images in the Article Content
Use each returnedfileUrl 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.