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

# Get Usage By Tool V1

> Tool-level work breakdown across the tenant's jobs. Joins ToolExecution → Job to scope by tenant…

Tool-level work breakdown across the tenant's jobs.

Joins ToolExecution → Job to scope by tenant; aggregates call count,
total + average duration, and a heuristic error count per tool name.
Useful for spotting whether a slow rollout is 'computer is slow' vs.
'we issue 10x as many bash calls as we used to.'

### Response

`UsageByToolResponse`

<ResponseField name="rows" type="UsageByToolRow[]" required>
  Sorted by total\_duration\_ms descending — heaviest tool first.

  <Expandable title="UsageByToolRow">
    <ResponseField name="tool_name" type="string" required>
      Tool identifier (bash, computer, browser, ...).
    </ResponseField>

    <ResponseField name="calls" type="integer" required>
      Total invocations across all jobs.
    </ResponseField>

    <ResponseField name="total_duration_ms" type="integer" required>
      Sum of duration\_ms across calls.
    </ResponseField>

    <ResponseField name="avg_duration_ms" type="number" required>
      Mean duration per call.
    </ResponseField>

    <ResponseField name="error_calls" type="integer" required>
      Count of calls whose tool\_output starts with an 'error' marker — best-effort heuristic, not a strict success/fail classification.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total_calls" type="integer" required />

### Status codes

| Code  | Meaning             |
| ----- | ------------------- |
| `200` | Successful Response |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.computer.stateset.app/api/v1/usage/by-tool' \
    --header 'X-API-Key: YOUR_API_KEY'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "rows": [
      {
        "tool_name": "string",
        "calls": 1,
        "total_duration_ms": 8,
        "avg_duration_ms": 7.5,
        "error_calls": 1
      }
    ],
    "total_calls": 1
  }
  ```
</ResponseExample>
