# getAccountRunAnalytics

```graphql
query GetAccountRunAnalytics($command: RunsGetAccountRunAnalyticsCommand!) {
  getAccountRunAnalytics(command: $command) {
    scope {
      kind
      accountId
      projectId
      userId
    }
    groupBy
    summary {
      totalRuns
      completedRuns
      failedRuns
      averageDurationMs
      p95DurationMs
      lastRunAt
    }
    timeframe {
      from
      to
      timezone
      granularity
      bucketCount
    }
    series {
      runs
      completedRuns
      failedRuns
      bucketStart
    }
    statuses {
      status
      count
    }
    models {
      provider
      model
      count
    }
    tools {
      name
      count
    }
    projects {
      projectId
      projectName
      projectSlug
      count
    }
    recentRuns {
      id
      runId
      status
      projectId
      input
      output
      title
      labels
      parentRunId
      rootRunId
      createdAt
      updatedAt
      startedAt
      finishedAt
      config
      taskId
      conversationId
      inputMessageId
      outputMessageId
      batchId
      metadata
    }
  }
}
```

Return account run analytics.

## Arguments

| Name                       | Type                               | Required | Description                                                                                                                                        |
| -------------------------- | ---------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `command`                  | RunsGetAccountRunAnalyticsCommand! | Yes      |                                                                                                                                                    |
| `command.accountId`        | ID                                 |          | Account to report; omitted, use the authorized context account or caller default. Requires account.billing.read.                                   |
| `command.preset`           | String                             |          | Whole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults.                         |
| `command.from`             | String                             |          | Inclusive start. Supply both from and to; these bounds take precedence over preset.                                                                |
| `command.to`               | String                             |          | Exclusive end, no later than the end of today in timezone.                                                                                         |
| `command.timezone`         | String                             |          |                                                                                                                                                    |
| `command.granularity`      | String                             |          | UTC hours, or local calendar days, Monday-based weeks and months.                                                                                  |
| `command.groupBy`          | \[String!]                         |          | Grouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list.                                               |
| `command.compare`          | String                             |          | Compare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise. |
| `command.label`            | \[String!]                         |          | Project label filters as key or key=value, repeated or comma-separated.                                                                            |
| `command.projectReference` | String                             |          | Optional project UUID or slug to scope analytics to a single project.                                                                              |

## Variables

```json
{
  "command": {}
}
```

## Responses

| Status | Description                                               |
| ------ | --------------------------------------------------------- |
| 200    | The RunsAccountAnalytics! in data.getAccountRunAnalytics. |

## 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 GetAccountRunAnalytics($command: RunsGetAccountRunAnalyticsCommand!) {\n  getAccountRunAnalytics(command: $command) {\n    scope {\n      kind\n      accountId\n      projectId\n      userId\n    }\n    groupBy\n    summary {\n      totalRuns\n      completedRuns\n      failedRuns\n      averageDurationMs\n      p95DurationMs\n      lastRunAt\n    }\n    timeframe {\n      from\n      to\n      timezone\n      granularity\n      bucketCount\n    }\n    series {\n      runs\n      completedRuns\n      failedRuns\n      bucketStart\n    }\n    statuses {\n      status\n      count\n    }\n    models {\n      provider\n      model\n      count\n    }\n    tools {\n      name\n      count\n    }\n    projects {\n      projectId\n      projectName\n      projectSlug\n      count\n    }\n    recentRuns {\n      id\n      runId\n      status\n      projectId\n      input\n      output\n      title\n      labels\n      parentRunId\n      rootRunId\n      createdAt\n      updatedAt\n      startedAt\n      finishedAt\n      config\n      taskId\n      conversationId\n      inputMessageId\n      outputMessageId\n      batchId\n      metadata\n    }\n  }\n}",
  "variables": {
    "command": {}
  }
}'
```

## Example response

```json
{
  "data": {
    "getAccountRunAnalytics": {
      "scope": {
        "kind": {},
        "accountId": "string",
        "projectId": "string",
        "userId": "string"
      },
      "groupBy": [
        "string"
      ],
      "summary": {
        "totalRuns": 0,
        "completedRuns": 0,
        "failedRuns": 0,
        "averageDurationMs": 0,
        "p95DurationMs": 0,
        "lastRunAt": "string"
      },
      "timeframe": {
        "from": "string",
        "to": "string",
        "timezone": "string",
        "granularity": "string",
        "bucketCount": 0
      },
      "series": [
        {
          "runs": 0,
          "completedRuns": 0,
          "failedRuns": 0,
          "bucketStart": "string"
        }
      ],
      "statuses": [
        {
          "status": "string",
          "count": 0
        }
      ],
      "models": [
        {
          "provider": "string",
          "model": "string",
          "count": 0
        }
      ],
      "tools": [
        {
          "name": "string",
          "count": 0
        }
      ],
      "projects": [
        {
          "projectId": "string",
          "projectName": "string",
          "projectSlug": "string",
          "count": 0
        }
      ],
      "recentRuns": [
        {
          "id": "string",
          "runId": "string",
          "status": "string",
          "projectId": "string",
          "input": {},
          "output": {},
          "title": "string",
          "labels": {},
          "parentRunId": "string",
          "rootRunId": "string",
          "createdAt": "string",
          "updatedAt": "string",
          "startedAt": "string",
          "finishedAt": "string",
          "config": {},
          "taskId": "string",
          "conversationId": "string",
          "inputMessageId": "string",
          "outputMessageId": "string",
          "batchId": "string",
          "metadata": {}
        }
      ]
    }
  }
}
```
