Conversations (Tickets) API Reference

Conversations (Tickets) API

The Conversations API is the core of the OnCodes support helpdesk. It handles ticket creation, retrieval, replies, status changes, and more. All endpoints are under /api/v1/helpdesk/ and require an active authenticated session.

Base URL

https://support.oncodes.com/api/v1/helpdesk/

Authentication

Extract the CSRF token from the browser cookie and include it as a header on all mutating requests:

X-XSRF-TOKEN: <decoded value of XSRF-TOKEN cookie>
Content-Type: application/json
Accept: application/json
// Get token in browser console:
decodeURIComponent(document.cookie.match(/XSRF-TOKEN=([^;]+)/)[1])

Conversations

List Conversations

Endpoint: GET /api/v1/helpdesk/agent/conversations

Returns a paginated list of conversations. Supports filtering by status, assignee, and other attributes.

Query Parameters

ParameterTypeDescription
pageintPage number (default: 1)
perPageintResults per page (default: 15)
orderBystringField to sort by (e.g. updated_at)
orderDirstringasc or desc
querystringSearch term (subject, message content)
viewIdstring/intBuilt-in view key: all, mine, unassigned, closed, or a numeric view ID
filtersJSON stringArray of filter objects: [{"key":"status","value":"pending"}]

Filter Keys

KeyExample ValueDescription
status"pending", "open", "resolved"Filter by status label
status_category5 (pending), 6 (open), 4 (resolved), 3 (locked)Filter by status category ID

Filter Example

// Get all pending conversations
GET /api/v1/helpdesk/agent/conversations?page=1&perPage=15&viewId=all&filters=[{"key":"status","value":"pending"}]

Response

{
  "pagination": {
    "data": [
      {
        "id": 1274,
        "type": "ticket",
        "subject": "Test Ticket - API Documentation Sample",
        "status_category": 5,
        "status_label": "Pending",
        "customer_status_label": "Waiting on you",
        "channel": "website",
        "priority": 0,
        "updated_at": "2026-02-26T08:32:00.000000Z",
        "created_at": "2026-02-26T08:31:02.000000Z",
        "closed_at": null,
        "assigned_at": "...",
        "closed_by": null,
        "latest_message": { ... },
        "group": null,
        "assignee": { "id": 1, "name": "OnCodes" },
        "user": { "id": 3, "name": "underwoo_d" },
        "tags": [],
        "attributes": { ... }
      }
    ],
    "next_cursor": null,
    "prev_cursor": null,
    "per_page": 15
  },
  "status": "success"
}

Get Conversation

Endpoint: GET /api/v1/helpdesk/agent/conversations/{id}

Returns full details of a single conversation including customer, assignee, group, tags, status, and recent messages.

Response Fields

FieldTypeDescription
idintConversation ID
subjectstringTicket subject/title
status_idintCurrent status ID (1=Open, 2=Pending, 3=Resolved, 4=Locked)
status_categoryintStatus category (6=Open, 5=Pending, 4=Resolved, 3=Locked)
priorityintPriority level (0 = none)
typestringConversation type (e.g. ticket)
channelstringOrigin channel (e.g. website, email)
user_idintCustomer (user) ID
assignee_idintAssigned agent ID
assigned_tostring"agent" or "group"
group_idintAssigned group ID
ratingint/nullCustomer satisfaction rating
modestringConversation mode
ai_agent_involvedboolWhether AI agent participated
created_atdatetimeWhen ticket was created
closed_atdatetime/nullWhen ticket was closed

Create Conversation

Endpoint: POST /api/v1/helpdesk/agent/conversations

Creates a new conversation/ticket. Returns 200 OK on success.

Request Body

FieldTypeRequiredDescription
subjectstringYesTicket subject/title
messagestringYesInitial message body (plain text or HTML)
userIdintYesCustomer ID (use normalized-models/customer to look up)
statusstringNoInitial status: "open" (default), "pending", "resolved"
assigneeIdintNoAgent ID to assign
groupIdintNoGroup ID to assign
categoryIdintYesCategory ID (required by validation)
priorityintNoPriority level (0 = none)
tagsarrayNoArray of tag strings

Example Request

fetch('https://support.oncodes.com/api/v1/helpdesk/agent/conversations', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'X-XSRF-TOKEN': decodeURIComponent(document.cookie.match(/XSRF-TOKEN=([^;]+)/)[1])
  },
  body: JSON.stringify({
    subject: 'My Support Ticket',
    message: 'I need help with...',
    userId: 3,
    status: 'open',
    categoryId: 1
  })
});

Response

HTTP 200 OK
{
  "conversation": {
    "id": 1274,
    "subject": "My Support Ticket",
    "status_id": 1,
    ...
  },
  "status": "success"
}

Update Conversation

Endpoint: PUT /api/v1/helpdesk/agent/conversations/{id}

Updates conversation properties such as subject, assignee, group, or priority. Note: to change status, use the dedicated Change Status endpoint instead.

Updatable Fields

FieldTypeDescription
subjectstringTicket subject
assignee_idintAssign to agent by ID
group_idintAssign to group by ID
priorityintPriority level

Note: Only GET, PUT, and DELETE are supported. PATCH returns 405 Method Not Allowed.


Delete Conversation

Endpoint: DELETE /api/v1/helpdesk/agent/conversations/{id}

Permanently deletes a conversation. Returns 204 No Content on success (even if ID does not exist).


Change Conversation Status

Endpoint: POST /api/v1/helpdesk/agent/conversations/status/change

Changes the status of one or more conversations. Supports bulk status updates.

Request Body

FieldTypeRequiredDescription
conversationIdsint[]YesArray of conversation IDs to update
statusIdintYesNew status ID: 1=Open, 2=Pending, 3=Resolved, 4=Locked

Example — Mark as Resolved

fetch('/api/v1/helpdesk/agent/conversations/status/change', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-XSRF-TOKEN': token },
  body: JSON.stringify({
    conversationIds: [1274],
    statusId: 3
  })
});

Response

HTTP 200 OK
{ "status": "success" }

Status Reference

IDLabelCategoryCustomer Label
1Open6
2Pending5Waiting on you
3Resolved4
4Locked3

Messages

List Messages

Endpoint: GET /api/v1/helpdesk/agent/conversations/{id}/messages

Returns all messages for a conversation using cursor-based pagination.

Response

{
  "pagination": {
    "data": [
      {
        "id": 5104,
        "uuid": "66b26668-...",
        "type": "message",
        "author": "agent",
        "body": "<p>Message content</p>",
        "created_at": "2026-02-26T08:31:02.000000Z",
        "user": { "id": 1, "name": "OnCodes" },
        "conversation_id": 1274,
        "source": null,
        "data": null,
        "attachments": []
      }
    ],
    "next_cursor": null,
    "prev_cursor": null,
    "per_page": 20
  }
}

Message Types

TypeDescription
messageA reply visible to the customer
noteAn internal note visible only to agents

Send Message / Reply

Endpoint: POST /api/v1/helpdesk/agent/conversations/{id}/messages

Sends a reply to the customer or adds an internal note. Returns 201 Created.

Request Body

FieldTypeRequiredDescription
bodystringYesMessage content (HTML supported)
typestringYes"message" to reply to customer, "note" for internal note
status_idintNoOptionally change conversation status when sending (e.g. send reply and close)

Example — Reply to Customer

fetch('/api/v1/helpdesk/agent/conversations/1274/messages', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-XSRF-TOKEN': token },
  body: JSON.stringify({
    body: '<p>Thank you for reaching out! We will address your issue shortly.</p>',
    type: 'message'
  })
});

Example — Add Internal Note

fetch('/api/v1/helpdesk/agent/conversations/1274/messages', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-XSRF-TOKEN': token },
  body: JSON.stringify({
    body: '<p>Customer contacted support about billing issue.</p>',
    type: 'note'
  })
});

Response

HTTP 201 Created
{
  "message": {
    "id": 5105,
    "uuid": "abc-...",
    "type": "message",
    "author": "agent",
    "body": "<p>Thank you for reaching out!</p>",
    "created_at": "2026-02-26T08:32:00.000000Z",
    "conversation_id": 1274,
    "user_id": 1,
    "attachments": [],
    "model_type": "conversationItem"
  },
  "status": "success"
}

Inbox Views

List Views

Endpoint: GET /api/v1/helpdesk/inbox/views

Returns all inbox views including built-in views (Your inbox, Unassigned, All) and custom views, each with conversation counts.

Response

{
  "views": [
    { "id": 2, "key": "mine", "name": "Your inbox", "pinned": true, "icon": "inbox", "count": 1 },
    { "id": 3, "key": "unassigned", "name": "Unassigned", "pinned": true, "icon": "unassigned", "count": 0 },
    { "id": 4, "key": "closed", "name": "Closed", "pinned": true, "icon": "archive", "count": 0 },
    { "id": 5, "key": "all", "name": "All", "pinned": true, "icon": "team", "count": 0 },
    { "id": 1, "key": null, "name": "ChatNet", "pinned": false, "count": 1, "isGroupView": false },
    { "id": "group:1", "key": "group:1", "name": "General", "count": 1, "isGroupView": true }
  ]
}

Use the key value as the viewId query parameter when listing conversations (e.g. viewId=mine, viewId=all).


Statuses

List Statuses

Endpoint: GET /api/v1/helpdesk/statuses/list?label=agent

Returns available conversation statuses.

Response

{
  "statuses": [
    { "id": 1, "label": "Open", "category": 6 },
    { "id": 2, "label": "Pending", "category": 5 },
    { "id": 3, "label": "Resolved", "category": 4 },
    { "id": 4, "label": "Locked", "category": 3 }
  ]
}

Customers (Lookup)

Look Up Customer

Endpoint: GET /api/v1/helpdesk/normalized-models/customer

Returns a list of customers for use in dropdowns. Supports search.

Get Customer by ID

Endpoint: GET /api/v1/helpdesk/normalized-models/customer/{id}

Returns a single customer. Example: customer underwoo_d has ID 3.


Conversation Attributes

List Attributes

Endpoint: GET /api/v1/helpdesk/attributes/list?type=conversation&for=agent&attributeIds=

Returns all configurable conversation attributes, including built-in fields and any custom ones.

Built-in Attribute Fields

IDKeyNameFormatRequired
9subjectSubjecttextYes
10descriptionDescriptionmultiLineTextYes
1categoryCategorydropdownYes
7group_idDepartmentdropdownNo
11priorityPrioritynumberNo
8ratingRatingratingNo

Other Useful Endpoints

EndpointMethodDescription
/api/v1/helpdesk/agent/conversations/{id}/messagesGETGet all messages for a conversation
/api/v1/helpdesk/agent/conversations/recent/{userId}?excludeId={convId}GETGet recent conversations for a customer (exclude current)
/api/v1/helpdesk/conversations/{id}/summaryGETGet AI-generated summary of a conversation
/api/v1/helpdesk/compact-agentsGETGet compact list of agents for assignment dropdowns
/api/v1/helpdesk/normalized-models/groupsGETGet available groups/departments
/api/v1/helpdesk/normalized-models/tags?query=&paginate=simple&perPage=25GETGet tags with optional search