Conversations

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

Endpoints

POST
POST
POST
GET
GET
POST
GET
PATCH
DELETE

Create conversations tickets bulk update status

Update the status of multiple tickets in a single request.

Only tickets belonging to the current team are affected; other-team UUIDs are silently ignored. Tickets already in the requested status are skipped.

Request parameters

  • ids
    array
  • status

Response


Example request

POST /api/projects/:project_id/conversations/tickets/bulk_update_status
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/bulk_update_status/\
-d ids="array",\
-d status=undefined

Example response

Status 200
RESPONSE
{
"updated": 0,
"ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}

Create conversations tickets bulk update tags

Bulk update tags on multiple objects.

PAT access: this action has no required_scopes= on the decorator — inheriting viewsets must add "bulk_update_tags" to their scope_object_write_actions list to accept personal API keys. Without that opt-in, APIScopePermission rejects PAT requests with "This action does not support personal API key access". Done per-viewset so granting <scope>:write for one resource doesn't leak access to sibling resources that share this mixin.

Accepts:

  • {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}

Actions:

  • "add": Add tags to existing tags on each object
  • "remove": Remove specific tags from each object
  • "set": Replace all tags on each object with the provided list

Request parameters

  • ids
    array
  • action
  • tags
    array

Response


Example request

POST /api/projects/:project_id/conversations/tickets/bulk_update_tags
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/bulk_update_tags/\
-d ids="array",\
-d action=undefined,\
-d tags="array"

Example response

Status 200
RESPONSE
{
"updated": [
{
"id": 0,
"tags": [
"string"
]
}
],
"skipped": [
{
"id": 0,
"reason": "string"
}
]
}

Create conversations tickets compose

Create a new outbound ticket and send the first message to the customer.

Required API key scopes

ticket:write

Request parameters

  • recipient_email
    string
  • recipient_distinct_id
    string
  • email_subject
    string
  • email_config_id
    string
  • message
    string
  • rich_content

Response


Example request

POST /api/projects/:project_id/conversations/tickets/compose
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/compose/\
-d recipient_email="string",\
-d email_config_id="string",\
-d message="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0
}
Status 400
RESPONSE
{
"detail": "string",
"error_type": "string"
}

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.

Required API key scopes

ticket:read

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",
"channel_detail": "slack_channel_message",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string",
"user": {
"property1": "string",
"property2": "string"
},
"role": {
"property1": "string",
"property2": "string"
}
},
"anonymous_traits": null,
"identity_verified": true,
"ai_resolved": true,
"escalation_reason": "string",
"ai_triage": null,
"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,
"sla_due_at": "2019-08-24T14:15:22Z",
"snoozed_until": "2019-08-24T14:15:22Z",
"slack_channel_id": "string",
"slack_thread_ts": "string",
"slack_team_id": "string",
"email_subject": "string",
"email_from": "user@example.com",
"email_to": "string",
"cc_participants": null,
"github_repo": "string",
"github_issue_number": 0,
"zendesk_ticket_id": 0,
"organization_id": "string",
"organization_id_source": "string",
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
},
"tags": [
null
]
}

List all conversations views

Required API key scopes

ticket:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/conversations/views
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/views/

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",
"short_id": "string",
"name": "string",
"filters": {},
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"is_favorited": true
}
]
}

Create conversations views

Required API key scopes

ticket:write

Request parameters

  • name
    string
  • filters
    object
  • is_favorited
    boolean

Response


Example request

POST /api/projects/:project_id/conversations/views
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/views/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"filters": {},
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"is_favorited": true
}

Retrieve conversations views

Required API key scopes

ticket:read

Path parameters

  • short_id
    string

Response


Example request

GET /api/projects/:project_id/conversations/views/:short_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/views/:short_id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"filters": {},
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"is_favorited": true
}

Update conversations views

Required API key scopes

ticket:write

Path parameters

  • short_id
    string

Request parameters

  • name
    string
  • filters
    object
  • is_favorited
    boolean

Response


Example request

PATCH /api/projects/:project_id/conversations/views/:short_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/views/:short_id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"filters": {},
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"is_favorited": true
}

Delete conversations views

Required API key scopes

ticket:write

Path parameters

  • short_id
    string

Example request

DELETE /api/projects/:project_id/conversations/views/:short_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/views/:short_id/

Example response

Status 204 No response body

Community questions