> ## Documentation Index
> Fetch the complete documentation index at: https://www.text.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Duration

> Returns the average chatting duration of agents within a license.

**Required scopes:** `reports_read`


## OpenAPI

````yaml /api/reports/v3.5/openapi.json post /reports/chats/duration
openapi: 3.0.0
info:
  title: Reports API
  description: Access and extract all the Reports data available in Text.
  version: '3.5'
servers:
  - url: https://api.livechatinc.com/v3.5
    description: Production
security:
  - PersonalAccessToken: []
  - OAuth2BearerToken: []
tags:
  - name: Chats
  - name: Agents
  - name: Tags
paths:
  /reports/chats/duration:
    post:
      tags:
        - Chats
      summary: Duration
      description: Returns the average chatting duration of agents within a license.
      operationId: post-chats-duration
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatsReportRequest'
            example:
              distribution: day
              filters:
                from: '2026-06-08T00:00:00-00:00'
                to: '2026-06-15T23:59:59-00:00'
        required: true
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DurationResponse'
              example:
                name: duration-report
                total: 369
                records:
                  '2021-04-08':
                    agents_chatting_duration: 10800
                    count: 37
                    duration: 12100
                  '2021-04-09':
                    agents_chatting_duration: 7200
                    count: 48
                    duration: 8400
                  '2021-04-10':
                    agents_chatting_duration: 3600
                    count: 59
                    duration: 4000
                  '2021-04-11':
                    agents_chatting_duration: 10800
                    count: 21
                    duration: 12200
                  '2021-04-12': {}
                  '2021-04-13':
                    agents_chatting_duration: 7200
                    count: 33
                    duration: 8000
                  '2021-04-14': {}
                  '2021-04-15':
                    agents_chatting_duration: 3600
                    count: 171
                    duration: 5500
components:
  schemas:
    ChatsReportRequest:
      type: object
      properties:
        distribution:
          type: string
          enum:
            - hour
            - day
            - day-hours
            - month
            - year
          default: day
          description: The time distribution of results.
        timezone:
          type: string
          description: >-
            The IANA Time Zone identifier (for example, `America/Phoenix`). By
            default, the timezone is taken from the request. If not provided,
            it's taken from the agent's timezone. When the agent's timezone
            cannot be determined, `filters.from` is used to derive it.
        filters:
          $ref: '#/components/schemas/ChatsFilters'
    DurationResponse:
      type: object
      properties:
        total:
          type: integer
          description: The total number of chats in the specified date range.
        records:
          type: object
          description: Contains distribution objects, for example, `day`.
          additionalProperties:
            type: object
            properties:
              count:
                type: integer
                description: The total number of chats agents had.
              agents_chatting_duration:
                type: number
                description: The average chat duration agents had.
              duration:
                type: number
                description: The average chat duration.
    ChatsFilters:
      type: object
      description: >-
        Filters for chats reports. If none provided, the report spans the last
        seven days. If filters are provided, they must contain exactly one pair
        of time-based filters (`from`/`to`, `greetings.from`/`to`, or
        `surveys.from`/`to`).
      properties:
        from:
          type: string
          description: >-
            The start of the time range. Date and time format compatible with
            RFC3339 with optional microsecond resolution:
            `YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM`.
        to:
          type: string
          description: >-
            The end of the time range. Date and time format compatible with
            RFC3339 with optional microsecond resolution:
            `YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM`.
        properties:
          $ref: '#/components/schemas/PropertiesFilter'
        agents:
          description: >-
            Agent filter. If `exists` is set to `false`, the API returns
            unassigned chats.
          allOf:
            - $ref: '#/components/schemas/StringFilterType'
        tags:
          $ref: '#/components/schemas/StringFilterType'
        sales:
          $ref: '#/components/schemas/IntegerFilterType'
        goals:
          $ref: '#/components/schemas/IntegerFilterType'
        forms:
          type: array
          items:
            $ref: '#/components/schemas/FormFilter'
          description: Form filters.
        event_types:
          $ref: '#/components/schemas/EventTypeFilterType'
        groups:
          description: A group filter. An array of group IDs.
          allOf:
            - $ref: '#/components/schemas/IntegerFilterType'
        greetings:
          $ref: '#/components/schemas/GreetingsFilter'
        agent_response:
          $ref: '#/components/schemas/AgentResponseFilter'
        customer_countries:
          description: >-
            Customer country filter. Country codes must follow the ISO 3166-1
            Alpha-2 format.
          allOf:
            - $ref: '#/components/schemas/StringFilterType'
    PropertiesFilter:
      type: object
      description: >-
        Property filters keyed by namespace. Each namespace value is an object
        keyed by property name, whose values are PropertyFilterType objects. A
        list of default properties is available in the default properties
        reference.
      additionalProperties:
        type: object
        additionalProperties:
          $ref: '#/components/schemas/PropertyFilterType'
    StringFilterType:
      type: object
      description: >-
        A filter type for string values. You can pass only one of the following
        at a time: `exists`, `values`, or `exclude_values`.
      properties:
        exists:
          type: boolean
          description: >-
            If `true`: the filter requires the field to exist. Available only
            for Chats parameters.
        values:
          type: array
          items:
            type: string
          description: An array of string values to include.
        exclude_values:
          type: array
          items:
            type: string
          description: An array of string values to exclude.
        require_every_value:
          type: boolean
          description: >-
            If `true`: returns only chats that have all elements passed in
            `values` or `exclude_values`.
    IntegerFilterType:
      type: object
      description: >-
        A filter type for integer values. You can pass only one of the following
        at a time: `exists`, `values`, or `exclude_values`.
      properties:
        exists:
          type: boolean
          description: 'If `true`: the filter requires the field to exist.'
        values:
          type: array
          items:
            type: integer
          description: An array of integer values to include.
        exclude_values:
          type: array
          items:
            type: integer
          description: An array of integer values to exclude.
        require_every_value:
          type: boolean
          description: >-
            If `true`: returns only chats that have all elements passed in
            `values` or `exclude_values`.
    FormFilter:
      type: object
      description: A form filter object.
      properties:
        type:
          type: string
          enum:
            - pre_chat
            - post_chat
          description: The form type.
        values:
          type: array
          items:
            type: string
          description: An array of answer IDs to include.
        exclude_values:
          type: array
          items:
            type: string
          description: An array of answer IDs to exclude.
        from:
          type: string
          description: >-
            The start of the form submission time range. Date and time format
            compatible with RFC3339 with optional microsecond resolution:
            `YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM`.
        to:
          type: string
          description: >-
            The end of the form submission time range. Date and time format
            compatible with RFC3339 with optional microsecond resolution:
            `YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM`.
        exists:
          type: boolean
          description: 'If `true`: returns only surveys that have a `survey_id`.'
        groups:
          $ref: '#/components/schemas/IntegerFilterType'
    EventTypeFilterType:
      type: object
      description: >-
        A filter type for event types. You can pass only one of the following at
        a time: `values` or `exclude_values`.
      properties:
        values:
          type: array
          items:
            type: string
          description: An array of Event type values to include. Duplicates are ignored.
        exclude_values:
          type: array
          items:
            type: string
          description: An array of Event type values to exclude. Duplicates are ignored.
        require_every_value:
          type: boolean
          description: >-
            If `true`: returns only chats that have all elements passed in
            `values` or `exclude_values`.
    GreetingsFilter:
      type: object
      description: A filter for chats started from greetings.
      properties:
        from:
          type: string
          description: >-
            The start of the greeting time range. Date and time format
            compatible with RFC3339 with optional microsecond resolution:
            `YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM`.
        to:
          type: string
          description: >-
            The end of the greeting time range. Date and time format compatible
            with RFC3339 with optional microsecond resolution:
            `YYYY-MM-DDTHH:MM:SS.ssssss+HH:MM`.
        exists:
          type: boolean
          description: 'If `true`: the filter requires the greeting to exist.'
        values:
          type: array
          items: {}
          description: An array of property values to include.
        exclude_values:
          type: array
          items: {}
          description: An array of property values to exclude.
        groups:
          $ref: '#/components/schemas/IntegerFilterType'
    AgentResponseFilter:
      type: object
      description: A filter for agent responses.
      properties:
        exists:
          type: boolean
          description: Filters by whether an agent response exists.
        first:
          type: boolean
          description: >-
            A modifier that makes the other `agent_response` filters operate
            exclusively on the agent's first response.
        agents:
          $ref: '#/components/schemas/StringFilterType'
        groups:
          $ref: '#/components/schemas/IntegerFilterType'
    PropertyFilterType:
      type: object
      description: >-
        A filter type for chat properties. Only one value is allowed for a
        single property. You can pass only one of the following at a time:
        `exists`, `values`, or `exclude_values`.
      properties:
        exists:
          type: boolean
          description: 'If `true`: the filter requires the property to exist.'
        values:
          type: array
          items: {}
          description: >-
            An array of property values to include. The array item type matches
            the property type (`string`, `int`, or `bool`).
        exclude_values:
          type: array
          items: {}
          description: >-
            An array of property values to exclude. The array item type matches
            the property type (`string`, `int`, or `bool`).
  securitySchemes:
    PersonalAccessToken:
      type: http
      scheme: basic
      description: >-
        Use your `account ID` as the username and your personal access token
        (PAT) as the password, or pass a Base64-encoded value directly in the
        Authorization header. For more information, see the <a
        href="/authentication/personal-access-tokens">personal access tokens
        guide</a>.
    OAuth2BearerToken:
      type: http
      scheme: bearer
      description: Authenticate using an OAuth 2.0 Bearer token.
      x-example: us-south1:MQraNrGCsoJvtxD7KNJQB1kM3d5

````