GET
/
backend
/
reports
/
{orgId}
/
chats
/
duration

Authentication

Authorization
string
required

Bearer token for authentication

Path Parameters

orgId
string
required

The ID of the organization

Query Parameters

startDate
string

The start date for the date range filter (ISO 8601 format)

endDate
string

The end date for the date range filter (ISO 8601 format)

channel
string

Filter results by a specific session channel

status
number

Filter results by a specific session status

Response

average_duration
number

The average duration of chat sessions in seconds

Example Request

curl --location --request GET 'https://api-v2.opencopilot.so/backend/reports/chats/duration?startDate=2023-01-01T00:00:00Z&endDate=2023-12-31T23:59:59Z&channel=web&status=1'

Example Response

{
  "average_duration": 300.5
}

This endpoint calculates the average duration of chat sessions based on the provided query parameters. It uses the difference between the created_at and updated_at timestamps of each session to determine the duration. The result is returned as an average in seconds.

If no query parameters are provided, it will calculate the average duration for all chat sessions for the specified organization. You can use the query parameters to filter the results by date range, channel, and status.

Was this page helpful?