Add

[POST] .../v1/ticket/add

Creates a CRM ticket. Use this method to create or reuse a CRM support ticket for a client in a channel when a dialog, call, message or operator action starts a support workflow. The method validates client, channel, direction, optional linked audio recording file, optional responsible user work session, custom fields and description mentions, calculates channel SLA deadlines, resolves responsible user by channel routing when omitted, creates participants and a linked chat, writes system messages and action log records, sends ChatAdded/TicketAdded and SLA webhooks and returns new_id. The request body is required; client_id and channel_id must be positive, direction defaults to Inbound when omitted, audio_recording_file_id must point to an existing audio file when supplied, external_dialog_id and subject are limited by the schema and mentioned users must already be in the ticket context unless mention_options.add_missing_users_to_context is true. If an open ticket already exists for the same client and channel, the method returns the existing ticket id instead of creating a duplicate, can update SLA/custom fields and audio_recording_file_id and rejects description_mentions for that existing-ticket path. The caller must have CRM ticket add permission; missing body, invalid client/channel/direction/responsible user/audio file, non-audio recording file, responsible user without active work session or on break, missing client/channel/audio file, unsupported audio-recording schema, disabled additional fields, required custom-field failures, mention validation failures, dedupe lock failures, database errors, transaction failures and action-log errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
audio_recording_file_id Int64 Optional Linked audio recording file ID. Optional; when supplied, it must point to an existing audio file.
channel_id Int64 Required Channel ID.
client_id Int64 Required Client ID.
description String Optional Ticket description.
description_mentions Array of CommonMentionInput Optional Structured user mentions in description.
direction String Optional Direction: Inbound or Outbound. Default value is Inbound. Allowed values: Default, Inbound, Outbound.
external_dialog_id String Optional External dialog ID. Maximum length is 150 characters.
fields Array of FieldValueAdd Optional Custom field values.
mention_options CommonMentionOptions Optional Mention processing options.
participant_user_ids Array of Int64 Optional Ticket participant IDs.
responsible_user_id Int64 Optional Responsible user ID.
subject String Optional Ticket subject. Maximum length is 300 characters.

Request Example

{
  "client_id": 501,
  "channel_id": 22,
  "direction": "Inbound",
  "external_dialog_id": "web-778",
  "audio_recording_file_id": 918,
  "subject": "Delivery question",
  "description": "Client asks about delivery date",
  "responsible_user_id": 31,
  "participant_user_ids": [
    18
  ],
  "fields": []
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert Created record result.

Response Example

{
  "ok": true,
  "result": {
    "new_id": 610
  }
}