# conversationAnalytics

```graphql
query ConversationAnalytics {
  conversationAnalytics {
    scope {
      kind
      accountId
      userId
      projectId
    }
    groupBy
    summary {
      totalConversations
      totalConversationsWide
      activeConversations
      activeConversationsWide
      totalMessages
      totalMessagesWide
      lastConversationAt
    }
    timeframe {
      from
      to
      granularity
      timezone
      bucketCount
    }
    series {
      bucketStart
      conversations
      conversationsWide
      messages
      messagesWide
    }
    statuses {
      status
      count
      countWide
    }
    models {
      provider
      model
      count
      countWide
    }
    tools {
      name
      count
      countWide
    }
    projects {
      projectId
      projectName
      projectSlug
      count
      countWide
    }
    recentConversations {
      conversationId
      title
      status
      projectId
      projectName
      projectSlug
      lastActivityAt
    }
  }
}
```

Summarize the conversation activity and model use in the projects of an account, optionally for one project or label; returns totals, configurable time buckets and recent conversations, with private titles limited to participants. Requires account.billing.read.

## Arguments

| Name                     | Type                       | Required | Description                                                            |
| ------------------------ | -------------------------- | -------- | ---------------------------------------------------------------------- |
| `input`                  | ConversationAnalyticsInput |          |                                                                        |
| `input.from`             | String                     |          |                                                                        |
| `input.to`               | String                     |          |                                                                        |
| `input.granularity`      | String                     |          |                                                                        |
| `input.groupBy`          | \[String!]                 |          |                                                                        |
| `input.compare`          | String                     |          |                                                                        |
| `input.preset`           | String                     |          | 7d, 30d or 90d. Defaults to 30d.                                       |
| `input.timezone`         | String                     |          | IANA time zone for daily bucket boundaries. Defaults to UTC.           |
| `input.label`            | \[String!]                 |          | Label filters as key or key=value                                      |
| `input.projectReference` | String                     |          | Project ID or slug that narrows the read to one project of the account |

## Responses

| Status | Description                                               |
| ------ | --------------------------------------------------------- |
| 200    | The ConversationAnalytics! in data.conversationAnalytics. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query ConversationAnalytics {\n  conversationAnalytics {\n    scope {\n      kind\n      accountId\n      userId\n      projectId\n    }\n    groupBy\n    summary {\n      totalConversations\n      totalConversationsWide\n      activeConversations\n      activeConversationsWide\n      totalMessages\n      totalMessagesWide\n      lastConversationAt\n    }\n    timeframe {\n      from\n      to\n      granularity\n      timezone\n      bucketCount\n    }\n    series {\n      bucketStart\n      conversations\n      conversationsWide\n      messages\n      messagesWide\n    }\n    statuses {\n      status\n      count\n      countWide\n    }\n    models {\n      provider\n      model\n      count\n      countWide\n    }\n    tools {\n      name\n      count\n      countWide\n    }\n    projects {\n      projectId\n      projectName\n      projectSlug\n      count\n      countWide\n    }\n    recentConversations {\n      conversationId\n      title\n      status\n      projectId\n      projectName\n      projectSlug\n      lastActivityAt\n    }\n  }\n}"
}'
```

## Example response

```json
{
  "data": {
    "conversationAnalytics": {
      "scope": {
        "kind": "string",
        "accountId": "string",
        "userId": "string",
        "projectId": "string"
      },
      "groupBy": [
        "string"
      ],
      "summary": {
        "totalConversations": 0,
        "totalConversationsWide": 0,
        "activeConversations": 0,
        "activeConversationsWide": 0,
        "totalMessages": 0,
        "totalMessagesWide": 0,
        "lastConversationAt": "string"
      },
      "timeframe": {
        "from": "string",
        "to": "string",
        "granularity": "string",
        "timezone": "string",
        "bucketCount": 0
      },
      "series": [
        {
          "bucketStart": "string",
          "conversations": 0,
          "conversationsWide": 0,
          "messages": 0,
          "messagesWide": 0
        }
      ],
      "statuses": [
        {
          "status": "string",
          "count": 0,
          "countWide": 0
        }
      ],
      "models": [
        {
          "provider": "string",
          "model": "string",
          "count": 0,
          "countWide": 0
        }
      ],
      "tools": [
        {
          "name": "string",
          "count": 0,
          "countWide": 0
        }
      ],
      "projects": [
        {
          "projectId": "string",
          "projectName": "string",
          "projectSlug": "string",
          "count": 0,
          "countWide": 0
        }
      ],
      "recentConversations": [
        {
          "conversationId": "string",
          "title": "string",
          "status": "string",
          "projectId": "string",
          "projectName": "string",
          "projectSlug": "string",
          "lastActivityAt": "string"
        }
      ]
    }
  }
}
```
