# usageSeries

```graphql
query UsageSeries($input: UsageSeriesInput!) {
  usageSeries(input: $input) {
    scope {
      kind
      accountId
      projectId
    }
    groupBy
    metric
    label
    unit
    summary {
      value
    }
    timeframe {
      from
      to
      granularity
      timezone
      bucketCount
    }
    series {
      bucketStart
      value
    }
    projects {
      projectId
      projectName
      projectSlug
      value
    }
  }
}
```

Chart one usage metric of an account by day, optionally for one project; returns the daily series with a total and a per-project breakdown. Requires account.billing.read.

## Arguments

| Name                     | Type              | Required | Description                                                                     |
| ------------------------ | ----------------- | -------- | ------------------------------------------------------------------------------- |
| `input`                  | UsageSeriesInput! | Yes      |                                                                                 |
| `input.from`             | String            |          |                                                                                 |
| `input.to`               | String            |          |                                                                                 |
| `input.granularity`      | String            |          |                                                                                 |
| `input.groupBy`          | \[String!]        |          | project for resource metrics; credits also supports model, api\_key and member. |
| `input.compare`          | String            |          |                                                                                 |
| `input.metric`           | String!           | Yes      | credits, storage, bandwidth or api\_calls                                       |
| `input.preset`           | String            |          | 7d, 30d or 90d. Defaults to 30d.                                                |
| `input.timezone`         | String            |          | IANA time zone for daily bucket boundaries. Defaults to UTC.                    |
| `input.projectReference` | String            |          | Project ID or slug that narrows the read to one project of the account          |

## Variables

```json
{
  "input": {
    "metric": "string"
  }
}
```

## Responses

| Status | Description                           |
| ------ | ------------------------------------- |
| 200    | The UsageSeries! in data.usageSeries. |

## 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 UsageSeries($input: UsageSeriesInput!) {\n  usageSeries(input: $input) {\n    scope {\n      kind\n      accountId\n      projectId\n    }\n    groupBy\n    metric\n    label\n    unit\n    summary {\n      value\n    }\n    timeframe {\n      from\n      to\n      granularity\n      timezone\n      bucketCount\n    }\n    series {\n      bucketStart\n      value\n    }\n    projects {\n      projectId\n      projectName\n      projectSlug\n      value\n    }\n  }\n}",
  "variables": {
    "input": {
      "metric": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "usageSeries": {
      "scope": {
        "kind": "string",
        "accountId": "string",
        "projectId": "string"
      },
      "groupBy": [
        "string"
      ],
      "metric": "string",
      "label": "string",
      "unit": "string",
      "summary": {
        "value": 0
      },
      "timeframe": {
        "from": "string",
        "to": "string",
        "granularity": "string",
        "timezone": "string",
        "bucketCount": 0
      },
      "series": [
        {
          "bucketStart": "string",
          "value": 0
        }
      ],
      "projects": [
        {
          "projectId": "string",
          "projectName": "string",
          "projectSlug": "string",
          "value": 0
        }
      ]
    }
  }
}
```
