Перейти к содержимому

Справочник API

26 операций, доступных по API-ключу проекта. Справочник генерируется из самого API. Зачем всё это нужно, читайте в руководстве.

Как читать пути

Все пути ниже указаны относительно https://api.helpwing.ru/api/v1 и содержат одни и те же два-три id, поэтому под каждой операцией они не повторяются. {project_pk} означает ваш проект, {ticket_pk} — тикет, которому принадлежит сообщение, {id} — объект, который называет сам путь. Каждый запрос отправляйте с заголовком Authorization: Api-Key ….

Tickets and messages

List tickets

GET/projects/{project_pk}/tickets/

The ticket list column of the inbox. Combine view with search, status, priority, source, assignee and tag, and sort with ordering.

Параметры запроса

assigneestring (uuid)
—
created_afterstring (date-time)
—
created_beforestring (date-time)
—
customerstring (uuid)
—
inboxstring (uuid)
—
is_spamboolean
—
orderingstring
Sort field. Prefix with `-` to reverse. Default `-last_message_at`.Одно из-created_at, -last_message_at, -priority, created_at, last_message_at, priority
pageinteger
A page number within the paginated result set.
page_sizeinteger
Number of results to return per page.
prioritystring
* `low` - Low * `normal` - Normal * `high` - High * `urgent` - UrgentОдно изhigh, low, normal, urgent
searchstring
A search term.
sourcestring
* `email` - Email * `chat` - Chat * `api` - API * `portal` - PortalОдно изapi, chat, email, portal
statusstring[]
* `open` - Open * `pending` - Pending * `resolved` - Resolved * `closed` - Closed
tagstring
—
unassignedboolean
—
viewstring
Named inbox view: my_open, unassigned, all_open, pending, resolved, closed, mentioned, spam.

Ответы

  • 200 — страница объектовTicketList

Create ticket

POST/projects/{project_pk}/tickets/

Creates a ticket and, when a body is supplied, its first customer message. Server-to-server callers authenticated with an API key should send source: api.

Тело запроса

subjectstringобязательный
—
prioritystring
Одно изlow, normal, high, urgent
sourcestring
Одно изemail, chat, api, portal
inboxstring (uuid)| null
—
external_refstring
Your own identifier, set when creating tickets over the API.
metadataobject
—
customer_idstring (uuid)
Existing customer in this project.
customer_emailstring (email)
Creates or reuses a customer by email.
customer_namestring
—
customer_external_idstring
—
body_textstring
First customer message.
body_htmlstring
—
tag_idsstring (uuid)[]
—

Ответы

Get ticket

GET/projects/{project_pk}/tickets/{id}/

Full ticket for the conversation workspace, including current viewers.

Ответы

Replace ticket

PUT/projects/{project_pk}/tickets/{id}/

Subject, priority, spam flag, external reference and metadata. Status, assignee and tags have their own actions; sending them here is a 400.

Тело запроса

subjectstringобязательный
—
prioritystring
Одно изlow, normal, high, urgent
is_spamboolean
—
external_refstring
Your own identifier, set when creating tickets over the API.
metadataobject
—

Ответы

Update ticket

PATCH/projects/{project_pk}/tickets/{id}/

Subject, priority, spam flag, external reference and metadata. Status, assignee and tags have their own actions; sending them here is a 400.

Тело запроса

subjectstring
—
prioritystring
Одно изlow, normal, high, urgent
is_spamboolean
—
external_refstring
Your own identifier, set when creating tickets over the API.
metadataobject
—

Ответы

Delete ticket

DELETE/projects/{project_pk}/tickets/{id}/

Tickets of one project.

Ответы

  • 204 — без тела · No response body

Assign ticket

POST/projects/{project_pk}/tickets/{id}/assign/

Assign to a member of the organization, or send assignee_id: null to unassign.

Тело запроса

assignee_idstring (uuid)| null
—

Ответы

Append inbound customer message

POST/projects/{project_pk}/tickets/{id}/inbound/

Adds a message authored by the customer, as an inbound email or a chat message would. Reopens the ticket when the project has reopen_on_customer_reply enabled.

Тело запроса

body_textstring
—
body_htmlstring
—
sourcestring
Одно изemail, chat, api, portal

Ответы

Merge ticket

POST/projects/{project_pk}/tickets/{id}/merge/

Moves every message of this ticket into the target ticket, closes this one and links it with merged_into. Irreversible.

Тело запроса

target_ticket_idstring (uuid)обязательный
—

Ответы

Change ticket priority

POST/projects/{project_pk}/tickets/{id}/priority/

Tickets of one project.

Тело запроса

prioritystringобязательный
Одно изlow, normal, high, urgent

Ответы

Change ticket status

POST/projects/{project_pk}/tickets/{id}/status/

Open, pending, resolved or closed. Moving a resolved or closed ticket back to open records a reopened activity entry.

Тело запроса

statusstringобязательный
Одно изopen, pending, resolved, closed

Ответы

Set ticket tags

PUT/projects/{project_pk}/tickets/{id}/tags/

Replaces the full tag set of the ticket.

Тело запроса

tag_idsstring (uuid)[]обязательный
—

Ответы

Mark as spam or not spam

POST/projects/{project_pk}/tickets/{id}/toggle-spam/

Tickets of one project.

Ответы

List messages

GET/projects/{project_pk}/tickets/{ticket_pk}/messages/

The conversation, oldest first: customer messages, agent replies, internal notes and system entries.

Параметры запроса

delivery_statusstring
* `not_applicable` - Not applicable * `queued` - Queued * `sent` - Sent * `delivered` - Delivered * `bounced` - Bounced * `failed` - FailedОдно изbounced, delivered, failed, not_applicable, queued, sent
kindstring
* `customer` - Customer message * `reply` - Agent reply * `note` - Internal note * `system` - System messageОдно изcustomer, note, reply, system
orderingstring
Which field to use when ordering the results.
pageinteger
A page number within the paginated result set.
page_sizeinteger
Number of results to return per page.
searchstring
A search term.

Ответы

  • 200 — страница объектовMessage

Reply or add internal note

POST/projects/{project_pk}/tickets/{ticket_pk}/messages/

Post as JSON, or as multipart with one files part per attachment. Attachments belong in this request: a reply's delivery is queued the moment it commits, so a file uploaded afterwards misses the email it should have left with.

Тело запроса — JSON или multipart, чтобы приложить файлы

kindstring
Одно изreply, note
body_htmlstring
—
body_textstring
—
mentioned_user_idsstring (uuid)[]
Members @-mentioned in a note.
filesstring (binary)[]
Files to attach, as multipart. Attached before the reply is queued, so they leave with the email.

Ответы

Get message

GET/projects/{project_pk}/tickets/{ticket_pk}/messages/{id}/

Messages of one ticket.

Ответы

Mark reply as bounced

POST/projects/{project_pk}/tickets/{ticket_pk}/messages/{id}/bounce/

Records a delivery failure reported by the mail provider. Owners, admins and API keys only.

Ответы

Send reply by email

POST/projects/{project_pk}/tickets/{ticket_pk}/messages/{id}/email/

Emails a reply that was delivered in the chat only (delivery_status: not_applicable). Sent even if the visitor is reading the chat right now. Requires customer email to be enabled on the project and an address on the customer.

Ответы

Bulk update tickets

POST/projects/{project_pk}/tickets/bulk/

Applies status, priority, assignee, tag or spam changes to many tickets at once.

Тело запроса

ticket_idsstring (uuid)[]обязательный
—
statusstring
Одно изopen, pending, resolved, closed
prioritystring
Одно изlow, normal, high, urgent
assignee_idstring (uuid)| null
—
add_tag_idsstring (uuid)[]
—
remove_tag_idsstring (uuid)[]
—
is_spamboolean
—

Ответы

Customers

List customers

GET/projects/{project_pk}/customers/

Searchable, filterable customer directory for one project.

Параметры запроса

has_open_ticketsboolean
—
is_anonymizedboolean
—
is_blockedboolean
—
is_identity_verifiedboolean
—
orderingstring
Which field to use when ordering the results.
pageinteger
A page number within the paginated result set.
page_sizeinteger
Number of results to return per page.
planstring
—
searchstring
A search term.
seen_afterstring (date-time)
—
seen_beforestring (date-time)
—
tagstring
Tag slug.

Ответы

Create customer

POST/projects/{project_pk}/customers/

Customers of one project.

Тело запроса

namestring
—
emailstring (email)
—
external_idstring
Your application's user id, passed to Support.identify().
avatar_urlstring (uri)
—
planstring
Plan reported by your app, e.g. pro.
browserstring
—
operating_systemstring
—
current_pagestring (uri)
—
localestring
—
timezonestring
—
metadataobject
Free-form JSON sent from your app. Shown in the customer panel.
tag_idsstring (uuid)[]
—
first_seen_atstring (date-time)
—
last_seen_atstring (date-time)
—
is_blockedboolean
—

Ответы

Get customer

GET/projects/{project_pk}/customers/{id}/

Full profile including custom metadata and ticket counters.

Ответы

Replace customer

PUT/projects/{project_pk}/customers/{id}/

Customers of one project.

Тело запроса

namestring
—
emailstring (email)
—
external_idstring
Your application's user id, passed to Support.identify().
avatar_urlstring (uri)
—
planstring
Plan reported by your app, e.g. pro.
browserstring
—
operating_systemstring
—
current_pagestring (uri)
—
localestring
—
timezonestring
—
metadataobject
Free-form JSON sent from your app. Shown in the customer panel.
tag_idsstring (uuid)[]
—
first_seen_atstring (date-time)
—
last_seen_atstring (date-time)
—
is_blockedboolean
—

Ответы

Update customer

PATCH/projects/{project_pk}/customers/{id}/

Customers of one project.

Тело запроса

namestring
—
emailstring (email)
—
external_idstring
Your application's user id, passed to Support.identify().
avatar_urlstring (uri)
—
planstring
Plan reported by your app, e.g. pro.
browserstring
—
operating_systemstring
—
current_pagestring (uri)
—
localestring
—
timezonestring
—
metadataobject
Free-form JSON sent from your app. Shown in the customer panel.
tag_idsstring (uuid)[]
—
first_seen_atstring (date-time)
—
last_seen_atstring (date-time)
—
is_blockedboolean
—

Ответы

Delete customer

DELETE/projects/{project_pk}/customers/{id}/

Hard delete, including their tickets. Owners, admins and API keys only. Prefer anonymize to keep ticket history.

Ответы

  • 204 — без тела · No response body

Merge duplicate customer

POST/projects/{project_pk}/customers/{id}/merge/

Moves the duplicate's tickets, messages, notes and tags onto this customer, then deletes the duplicate. Irreversible.

Тело запроса

duplicate_idstring (uuid)обязательный
The customer that will be removed.

Объекты

Что возвращает API. Каждый объект описан один раз, а не под каждым эндпоинтом, который его отдаёт. Все поля здесь только для чтения: это ответы, а что принимает запрос, указано у самой операции.

Attachment

A file on a message. Uploaded as multipart together with the target message id.

idstring (uuid)только чтение
—
filestring (uri)| null
The file itself on the way in; a signed link that expires on the way out.
filenamestring
—
content_typestring
—
size_bytesintegerтолько чтение
—
is_inlineboolean
—
content_idstringтолько чтение
—
created_atstring (date-time)только чтение
—

Customer

Full customer profile shown in the context panel and detail screen.

idstring (uuid)только чтение
—
namestring
—
display_namestringтолько чтение
—
emailstring (email)
—
external_idstring
Your application's user id, passed to Support.identify().
avatar_urlstring (uri)
—
planstring
Plan reported by your app, e.g. pro.
browserstring
—
operating_systemstring
—
current_pagestring (uri)
—
localestring
—
timezonestring
—
metadataobject
Free-form JSON sent from your app. Shown in the customer panel.
tagsTag[]только чтение
—
ticket_countintegerтолько чтение
—
open_ticket_countintegerтолько чтение
—
resolved_ticket_countintegerтолько чтение
—
first_seen_atstring (date-time)
—
last_seen_atstring (date-time)
—
is_identity_verifiedbooleanтолько чтение
True when the chat session was signed with your project secret.
is_blockedboolean
—
is_anonymizedbooleanтолько чтение
—
anonymized_atstring (date-time)| nullтолько чтение
—
created_atstring (date-time)только чтение
—
updated_atstring (date-time)только чтение
—

CustomerList

Row shown in the customer list.

idstring (uuid)только чтение
—
namestringтолько чтение
—
display_namestringтолько чтение
—
emailstring (email)только чтение
—
external_idstringтолько чтение
Your application's user id, passed to Support.identify().
avatar_urlstring (uri)только чтение
—
planstringтолько чтение
Plan reported by your app, e.g. pro.
tagsTag[]только чтение
—
ticket_countintegerтолько чтение
—
open_ticket_countintegerтолько чтение
—
first_seen_atstring (date-time)только чтение
—
last_seen_atstring (date-time)только чтение
—
is_identity_verifiedbooleanтолько чтение
True when the chat session was signed with your project secret.
is_blockedbooleanтолько чтение
—
is_anonymizedbooleanтолько чтение
—
created_atstring (date-time)только чтение
—

CustomerMergeResult

idstring (uuid)только чтение
—
primarystring (uuid)только чтение
—
merged_customer_idstring (uuid)только чтение
—
merged_emailstring (email)только чтение
—
merged_external_idstringтолько чтение
—
moved_ticket_countintegerтолько чтение
—
performed_byUserSummaryтолько чтение
—
created_atstring (date-time)только чтение
—

Message

A message in the conversation: customer message, agent reply, note or system entry.

idstring (uuid)только чтение
—
kindstringтолько чтение
Одно изcustomer, reply, note, system
sourcestringтолько чтение
The channel a customer message arrived on. Blank for a reply, note or system entry. * `email` - Email * `chat` - Chat * `api` - API * `portal` - PortalОдно изemail, chat, api, portal
body_htmlstringтолько чтение
—
body_textstringтолько чтение
—
author_userUserSummaryтолько чтение
—
author_customerobject| nullтолько чтение
—
attachmentsAttachment[]только чтение
—
mentioned_usersUserSummary[]только чтение
—
is_internalbooleanтолько чтение
—
delivery_statusstringтолько чтение
Одно изnot_applicable, queued, sent, delivered, bounced, failed
delivery_errorstringтолько чтение
—
delivered_atstring (date-time)| nullтолько чтение
—
email_message_idstringтолько чтение
—
from_addressstring (email)только чтение
—
to_addressstring (email)только чтение
—
metadataobjectтолько чтение
—
is_assistantbooleanтолько чтение
Written by the AI assistant rather than a person.
created_atstring (date-time)только чтение
—

ReplyDestination

Where the next agent reply on a ticket goes, and the address it comes from. A reply always appears in the widget when `in_widget` is set, and is mailed to `customer_email` unless the visitor is reading that widget right now - so `is_visitor_present` is the one field here that changes minute to minute, and the ticket update feed reports it on every answer. `emails_enabled` is the project-wide switch and outranks all of it: with it off nothing is mailed, whatever the other three say.

customer_emailstringтолько чтение
The address a reply is mailed to. Empty for an unidentified visitor.
in_widgetbooleanтолько чтение
The conversation started in the chat widget, where replies are shown.
is_visitor_presentbooleanтолько чтение
The customer has the widget open now, so a reply reaches them there and is not mailed.
emails_enabledbooleanтолько чтение
The project sends email to its customers. False means no reply is mailed at all - on a widget conversation it is still delivered in the chat, on an email ticket it reaches nobody.
from_namestringтолько чтение
—
from_addressstringтолько чтение
The address a reply is sent from.
from_sourcestringтолько чтение
Why the reply comes from that address. `platform_default` means the project has not set up sending. * `project_smtp` - The project's own mail server * `verified_domain` - A domain verified for sending * `platform_default` - Helpwing's shared addressОдно изproject_smtp, verified_domain, platform_default

Tag

idstring (uuid)только чтение
—
namestring
—
slugstringтолько чтение
—
colorstring
Hex color, e.g. #64748b.
descriptionstring
—
usage_countintegerтолько чтение
—
created_atstring (date-time)только чтение
—

Ticket

Full ticket used by the conversation workspace.

idstring (uuid)только чтение
—
referencestringтолько чтение
The conversation's public identifier. Opaque, and the only one a customer ever sees.
subjectstring
—
statusstring
Одно изopen, pending, resolved, closed
assistant_statestringтолько чтение
Одно изactive, handed_off
prioritystring
Одно изlow, normal, high, urgent
sourcestring
Одно изemail, chat, api, portal
customerCustomerListтолько чтение
—
assigneeUserSummaryтолько чтение
—
tagsTag[]только чтение
—
inboxstring (uuid)| null
—
is_spamboolean
—
is_mergedbooleanтолько чтение
—
merged_intostring (uuid)| nullтолько чтение
—
viewersobject[]только чтение
Other members currently viewing this ticket, for the collision warning.
reply_destinationReplyDestinationтолько чтение
Where a reply written now would be delivered, and the address it would come from.
message_countintegerтолько чтение
—
last_message_previewstringтолько чтение
—
last_message_atstring (date-time)только чтение
—
first_response_atstring (date-time)| nullтолько чтение
—
resolved_atstring (date-time)| nullтолько чтение
—
closed_atstring (date-time)| nullтолько чтение
—
external_refstring
Your own identifier, set when creating tickets over the API.
email_thread_idstring
—
metadataobject
—
created_atstring (date-time)только чтение
—
updated_atstring (date-time)только чтение
—

TicketBulkResult

updatedinteger
—
skippedinteger
—

TicketList

Row shown in the ticket list column of the inbox.

idstring (uuid)только чтение
—
referencestringтолько чтение
The conversation's public identifier. Opaque, and the only one a customer ever sees.
subjectstringтолько чтение
—
statusstringтолько чтение
Одно изopen, pending, resolved, closed
assistant_statestringтолько чтение
Одно изactive, handed_off
prioritystringтолько чтение
Одно изlow, normal, high, urgent
sourcestringтолько чтение
Одно изemail, chat, api, portal
customerobjectтолько чтение
—
assigneeUserSummaryтолько чтение
—
tagsTag[]только чтение
—
inboxstring (uuid)| nullтолько чтение
—
is_spambooleanтолько чтение
—
is_unreadbooleanтолько чтение
True when the ticket changed since you last read it.
message_countintegerтолько чтение
—
last_message_previewstringтолько чтение
—
last_message_atstring (date-time)только чтение
—
created_atstring (date-time)только чтение
—

UserSummary

Compact user representation embedded in tickets, notes and members.

idstring (uuid)только чтение
—
emailstring (email)только чтение
—
full_namestringтолько чтение
Display name shown to teammates.
display_namestringтолько чтение
—
avatar_urlstring (uri)только чтение
—