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

# Get tickets analytics by account

> MCP tool to get aggregated ticket analytics data grouped by account for a specific date range.

import Admonition from '@theme/Admonition';

### MCP tool: `get_tickets_analytics_by_account`

Get aggregated ticket analytics data grouped by account for a specific date range.

<Admonition type="note">
  This tool provides aggregated analytics data, not individual ticket details. Use the search\_tickets tool for finding specific tickets.
</Admonition>

### Example prompt

```prompt theme={null}
Get ticket analytics by account for the last 30 days
```

<Admonition type="info">
  When you use this prompt in a chat with the model (with the MCP tool registered), the model will automatically call the <code>get\_tickets\_analytics\_by\_account</code> tool with the correct arguments.
</Admonition>

### Parameters

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Type</th>
      <th>Required</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>dateRange</td><td>object</td><td>Yes</td><td>Inclusive date range to aggregate over</td></tr>
    <tr><td>dateRange.startDate</td><td>string</td><td>Yes</td><td>Start date in YYYY-MM-DD format</td></tr>
    <tr><td>dateRange.endDate</td><td>string</td><td>Yes</td><td>End date in YYYY-MM-DD format</td></tr>
    <tr><td>teamIds</td><td>array</td><td>No</td><td>Optional array of team IDs to filter by</td></tr>
    <tr><td>includeArchivedTickets</td><td>boolean</td><td>No</td><td>Include archived tickets (default: false)</td></tr>
    <tr><td>includeTicketMetadata</td><td>boolean</td><td>No</td><td>Include minimal ticket metadata for drill-down (default: false)</td></tr>
    <tr><td>metadataPage</td><td>number</td><td>No</td><td>Page number for metadata pagination (1-based, only used when includeTicketMetadata is true)</td></tr>
    <tr><td>metadataLimit</td><td>number</td><td>No</td><td>Limit for metadata results per page (max 200, only used when includeTicketMetadata is true)</td></tr>
  </tbody>
</table>

### Response fields

The response will contain aggregated analytics data with the following structure:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>aggregationType</td><td>string</td><td>Type of aggregation performed ("account")</td></tr>
    <tr><td>totalTickets</td><td>number</td><td>Total number of tickets in the date range</td></tr>
    <tr><td>totalFound</td><td>number</td><td>Total number of tickets found matching criteria</td></tr>
    <tr><td>dateRange</td><td>object</td><td>The date range used for the analysis</td></tr>
    <tr><td>includeArchivedTickets</td><td>boolean</td><td>Whether archived tickets were included</td></tr>
    <tr><td>includeTicketMetadata</td><td>boolean</td><td>Whether ticket metadata was included</td></tr>
    <tr><td>aggregatedData</td><td>array</td><td>Array of account-based analytics objects</td></tr>
  </tbody>
</table>

#### Account analytics object fields

Each account in the `aggregatedData` array contains:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>accountId</td><td>string</td><td>Account unique identifier</td></tr>
    <tr><td>accountName</td><td>string</td><td>Account name</td></tr>
    <tr><td>accountPrimaryDomain</td><td>string</td><td>Account primary domain</td></tr>
    <tr><td>accountSource</td><td>string</td><td>Account source</td></tr>
    <tr><td>ticketCount</td><td>number</td><td>Number of tickets for this account</td></tr>
    <tr><td>teamBreakdown</td><td>object</td><td>Breakdown by team with detailed metrics</td></tr>
  </tbody>
</table>

#### Team breakdown fields

Each team in the `teamBreakdown` object contains:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>teamId</td><td>string</td><td>Team unique identifier</td></tr>
    <tr><td>teamName</td><td>string</td><td>Team name</td></tr>
    <tr><td>ticketCount</td><td>number</td><td>Number of tickets for this team</td></tr>
    <tr><td>percentage</td><td>number</td><td>Percentage of total tickets</td></tr>
    <tr><td>statusBreakdown</td><td>object</td><td>Breakdown by ticket status with counts and percentages</td></tr>
    <tr><td>priorityBreakdown</td><td>object</td><td>Breakdown by ticket priority with counts and percentages</td></tr>
    <tr><td>assigneeBreakdown</td><td>object</td><td>Breakdown by assignee with counts and percentages</td></tr>
  </tbody>
</table>

### Sample response

```json theme={null}
{
  "aggregationType": "account",
  "totalTickets": 2,
  "totalFound": 2,
  "dateRange": {
    "startDate": "2025-01-01",
    "endDate": "2025-09-16"
  },
  "includeArchivedTickets": false,
  "includeTicketMetadata": false,
  "aggregatedData": [
    {
      "accountId": "CDN7BH2K1020181NADAYN2NJG6GSF",
      "accountName": "Acme Corp",
      "accountPrimaryDomain": "acme.com",
      "accountSource": "Website",
      "ticketCount": 2,
      "teamBreakdown": {
        "THEVVHPCCER33E": {
          "teamId": "THEVVHPCCER33E",
          "teamName": "Engineering",
          "ticketCount": 2,
          "statusBreakdown": {
            "Open": {
              "ticketCount": 2,
              "statusId": "3SC6BH2K10X5BSCXF2MFWVYZVYNFX",
              "percentage": 100
            }
          },
          "priorityBreakdown": {
            "Urgent": {
              "ticketCount": 1,
              "priorityId": "CSC6BH2K100SATQR0ZS6KHBW1DFPK",
              "percentage": 50
            },
            "Medium": {
              "ticketCount": 1,
              "priorityId": "CSC6BH2K10XR2ZVVY84VV8506YN80",
              "percentage": 50
            }
          },
          "assigneeBreakdown": {
            "John Doe": {
              "ticketCount": 2,
              "assigneeId": "UTHOOQNUUXZQQ3",
              "assigneeName": "John Doe",
              "percentage": 100
            }
          },
          "percentage": 100
        }
      }
    }
  ]
}
```

<Admonition type="tip">
  Always pass an object as input, even if empty, to avoid errors when calling the tool directly.
</Admonition>

<Admonition type="info">
  This tool is optimized for analytics and reporting. For individual ticket operations, use the search\_tickets or other ticket management tools.
</Admonition>

<Admonition type="warning">
  The date range must be valid and startDate must be less than or equal to endDate. Use ISO 8601 date format (YYYY-MM-DD).
</Admonition>

***
