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

# Get Account Metrics

> Retrieve account-level usage metrics

## GET /metrics

Retrieve account-level metrics for your S2 account. This endpoint allows you to query different metric sets with optional time ranges and aggregation intervals.

### Query Parameters

<ParamField query="set" type="string" required>
  Metric set to return. Available values:

  * `active-basins` - Set of all basins that had at least one stream during the specified period
  * `account-ops` - Count of append RPC operations, per interval
</ParamField>

<ParamField query="start" type="integer">
  Start timestamp as Unix epoch seconds. Required for timeseries metric sets.
</ParamField>

<ParamField query="end" type="integer">
  End timestamp as Unix epoch seconds. Required for timeseries metric sets.
</ParamField>

<ParamField query="interval" type="string">
  Interval to aggregate over for timeseries metric sets. Available values:

  * `minute`
  * `hour`
  * `day`
</ParamField>

### Response

Returns a `MetricSetResponse` object containing the requested metrics.

<ResponseField name="values" type="array">
  Array of metrics comprising the set. Each metric can be one of four types:

  <Expandable title="Metric Types">
    <ResponseField name="scalar" type="object">
      Single named value

      <Expandable title="properties">
        <ResponseField name="name" type="string">
          Metric name
        </ResponseField>

        <ResponseField name="unit" type="string">
          Unit of the metric (`bytes` or `operations`)
        </ResponseField>

        <ResponseField name="value" type="number">
          Metric value
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="accumulation" type="object">
      Named series of (timestamp, value) points representing an accumulation over a specified interval

      <Expandable title="properties">
        <ResponseField name="name" type="string">
          Timeseries name
        </ResponseField>

        <ResponseField name="unit" type="string">
          Unit of the metric (`bytes` or `operations`)
        </ResponseField>

        <ResponseField name="interval" type="string">
          The interval at which data points are accumulated (`minute`, `hour`, or `day`)
        </ResponseField>

        <ResponseField name="values" type="array">
          Array of \[timestamp, value] tuples. Each tuple represents the accumulated value for the time period starting at the timestamp, spanning one interval.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="gauge" type="object">
      Named series of (timestamp, value) points each representing an instantaneous value

      <Expandable title="properties">
        <ResponseField name="name" type="string">
          Timeseries name
        </ResponseField>

        <ResponseField name="unit" type="string">
          Unit of the metric (`bytes` or `operations`)
        </ResponseField>

        <ResponseField name="values" type="array">
          Array of \[timestamp, value] tuples. Each tuple represents the value at the instant of the timestamp.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="label" type="object">
      Set of string labels

      <Expandable title="properties">
        <ResponseField name="name" type="string">
          Label name
        </ResponseField>

        <ResponseField name="values" type="array">
          Array of string values
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL - Active Basins theme={null}
  curl -X GET "https://aws.s2.dev/v1/metrics?set=active-basins&start=1704067200&end=1704153600" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```bash cURL - Account Operations theme={null}
  curl -X GET "https://aws.s2.dev/v1/metrics?set=account-ops&start=1704067200&end=1704153600&interval=hour" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json Active Basins Response theme={null}
  {
    "values": [
      {
        "label": {
          "name": "active-basins",
          "values": ["analytics", "logs", "events"]
        }
      }
    ]
  }
  ```

  ```json Account Operations Response theme={null}
  {
    "values": [
      {
        "accumulation": {
          "name": "account-ops",
          "unit": "operations",
          "interval": "hour",
          "values": [
            [1704067200, 15234],
            [1704070800, 18921],
            [1704074400, 16453]
          ]
        }
      }
    ]
  }
  ```
</ResponseExample>

## Error Responses

<ResponseField name="400" type="Bad Request">
  Invalid query parameters or malformed request
</ResponseField>

<ResponseField name="403" type="Forbidden">
  Invalid or missing authentication token
</ResponseField>

<ResponseField name="408" type="Request Timeout">
  Request took too long to process
</ResponseField>
