Conversations

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST
GET
PATCH
DELETE
GET

List all conversations tickets

List tickets with person data attached.

Required API key scopes

ticket:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/conversations/tickets
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/conversations/tickets/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string"
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": null,
"property2": null
},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
}
}
]
}

Create conversations tickets

Required API key scopes

ticket:write

Path parameters

  • project_id
    string

Request parameters

  • status
  • priority
  • anonymous_traits
  • ai_resolved
    boolean
  • escalation_reason
    string

Response


Example request

POST /api/projects/:project_id/conversations/tickets
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/conversations/tickets/\
-d ticket_number="integer"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string"
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": null,
"property2": null
},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
}
}

Retrieve conversations tickets

Get single ticket and mark as read by team.

Required API key scopes

ticket:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/projects/:project_id/conversations/tickets/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/conversations/tickets/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string"
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": null,
"property2": null
},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
}
}

Update conversations tickets

Required API key scopes

ticket:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • status
  • priority
  • anonymous_traits
  • ai_resolved
    boolean
  • escalation_reason
    string

Response


Example request

PATCH /api/projects/:project_id/conversations/tickets/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/conversations/tickets/:id/\
-d ticket_number="integer"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string"
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": null,
"property2": null
},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
}
}

Delete conversations tickets

Required API key scopes

ticket:write

Path parameters

  • id
    string
  • project_id
    string

Example request

DELETE /api/projects/:project_id/conversations/tickets/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/conversations/tickets/:id/

Example response

Status 204 No response body

Retrieve conversations tickets unread count

Get total unread ticket count for the team.

Returns the sum of unread_team_count for all non-resolved tickets. Cached in Redis for 30 seconds, invalidated on changes.

Path parameters

  • project_id
    string

Response


Example request

GET /api/projects/:project_id/conversations/tickets/unread_count
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/conversations/tickets/unread_count/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string"
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": null,
"property2": null
},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
}
}

Community questions

Questions about this page? or post a community question.