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

# Fetch subscription usage

> This endpoint is used to fetch a subscription's usage in Orb. Especially when combined with optional query
parameters, this endpoint is a powerful way to build visualizations on top of Orb's event data and metrics.

With no query parameters specified, this endpoint returns usage for the subscription's _current billing period_
across each billable metric that participates in the subscription. Usage quantities returned are the result of
evaluating the metric definition for the entirety of the customer's billing period.

### Default response shape
Orb returns a `data` array with an object corresponding to each billable metric. Nested within this object is a
`usage` array which has a `quantity` value and a corresponding `timeframe_start` and `timeframe_end`.  The `quantity`
value represents the calculated usage value for the billable metric over the specified timeframe (inclusive of the
`timeframe_start` timestamp and exclusive of the `timeframe_end` timestamp).

Orb will include _every_ window in the response starting from the beginning of the billing period, even when there
were no events (and therefore no usage) in the window. This increases the size of the response but prevents the caller
from filling in gaps and handling cumbersome time-based logic.

The query parameters in this endpoint serve to override this behavior and provide some key functionality, as listed
below. Note that this functionality can also be used _in conjunction_ with each other, e.g. to display grouped usage
on a custom timeframe.

## Custom timeframe
In order to view usage for a custom timeframe rather than the current billing period, specify a `timeframe_start` and
`timeframe_end`. This will calculate quantities for usage incurred between timeframe_start (inclusive) and timeframe_end
(exclusive), i.e. `[timeframe_start, timeframe_end)`.

Note:
- These timestamps must be specified in ISO 8601 format and UTC timezone, e.g. `2022-02-01T05:00:00Z`.
- Both parameters must be specified if either is specified.

## Grouping by custom attributes
In order to view a single metric grouped by a specific _attribute_ that each event is tagged with (e.g. `cluster`), you
must additionally specify a `billable_metric_id` and a `group_by` key. The `group_by` key denotes the event property on
which to group.

When returning grouped usage, only usage for `billable_metric_id` is  returned, and a separate object in the `data` array
is returned for each value of the `group_by` key present in your events. The `quantity` value is the result of evaluating
the billable metric for events filtered to a single value of the `group_by` key.

Orb expects that events that match the billable metric will contain values in the `properties` dictionary that correspond
to the `group_by` key specified. By default, Orb will not return a `null` group (i.e. events that match the metric but
do not have the key set). Currently, it is only possible to view usage grouped by a single attribute at a time.

 When viewing grouped usage, Orb uses pagination to limit the response size to 1000 groups by default. If there are more
 groups for a given subscription, pagination metadata in the response can be used to fetch all of the data.

The following example shows usage for an "API Requests" billable metric grouped by `region`. Note the extra `metric_group`
dictionary in the response, which provides metadata about the group:

```json
{
    "data": [
        {
            "usage": [
                {
                    "quantity": 0.19291,
                    "timeframe_start": "2021-10-01T07:00:00Z",
                    "timeframe_end": "2021-10-02T07:00:00Z",
                },
                ...
            ],
            "metric_group": {
                "property_key": "region",
                "property_value": "asia/pacific"
            },
            "billable_metric": {
                "id": "Fe9pbpMk86xpwdGB",
                "name": "API Requests"
            },
            "view_mode": "periodic"
        },
        ...
    ]
}
```


## Windowed usage
The `granularity` parameter can be used to _window_ the usage `quantity` value into periods. When not specified, usage
is returned for the entirety of the time range.

When `granularity = day` is specified with a timeframe longer than a day, Orb will return a `quantity` value for each
full day between `timeframe_start` and `timeframe_end`. Note that the days are demarcated by the _customer's local midnight_.

For example, with `timeframe_start = 2022-02-01T05:00:00Z`, `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`,
the following windows will be returned for a customer in the `America/Los_Angeles` timezone since local midnight is `08:00` UTC:
- `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)`
- `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)`
- `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)`
- `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`

```json
{
    "data": [
        {
            "billable_metric": {
                "id": "Q8w89wjTtBdejXKsm",
                "name": "API Requests"
            },
            "usage": [
                {
                    "quantity": 0,
                    "timeframe_end": "2022-02-01T08:00:00+00:00",
                    "timeframe_start": "2022-02-01T05:00:00+00:00"
                },
                {

                    "quantity": 0,
                    "timeframe_end": "2022-02-02T08:00:00+00:00",
                    "timeframe_start": "2022-02-01T08:00:00+00:00"
                },
                {
                    "quantity": 0,
                    "timeframe_end": "2022-02-03T08:00:00+00:00",
                    "timeframe_start": "2022-02-02T08:00:00+00:00"
                },
                {
                    "quantity": 0,
                    "timeframe_end": "2022-02-04T01:00:00+00:00",
                    "timeframe_start": "2022-02-03T08:00:00+00:00"
                }
            ],
            "view_mode": "periodic"
        },
        ...
    ]
}
```

## Decomposable vs. non-decomposable metrics
Billable metrics fall into one of two categories: decomposable and non-decomposable. A decomposable billable metric, such as
a sum or a count, can be displayed and aggregated across arbitrary timescales. On the other hand, a non-decomposable metric
is not meaningful when only a slice of the billing window is considered.

As an example, if we have a billable metric that's defined to count unique users, displaying a graph of unique users for each
day is not representative of the billable metric value over the month (days could have an overlapping set of 'unique' users).
Instead, what's useful for any given day is the number of unique users in the billing period so far, which are the
_cumulative_ unique users.

Accordingly, this endpoint returns treats these two types of metrics differently when `group_by` is specified:
- Decomposable metrics can be grouped by any event property.
- Non-decomposable metrics can only be grouped by the corresponding price's invoice grouping key. If no invoice grouping key
is present, the metric does not support `group_by`.

## Matrix prices
When a billable metric is attached to a price that uses matrix pricing, it's important to view usage grouped by those matrix
dimensions. In this case, use the query parameters `first_dimension_key`, `first_dimension_value` and `second_dimension_key`,
`second_dimension_value` while filtering to a specific `billable_metric_id`.

For example, if your compute metric has a separate unit price (i.e. a matrix pricing model) per `region` and `provider`,
your request might provide the following parameters:

- `first_dimension_key`: `region`
- `first_dimension_value`: `us-east-1`
- `second_dimension_key`: `provider`
- `second_dimension_value`: `aws`



## OpenAPI

````yaml /api-reference/orb-openapi.json get /subscriptions/{subscription_id}/usage
openapi: 3.1.0
info:
  title: API Reference
  description: >-
    Orb's API is built with the following principles in mind:


    1. **Predictable developer experience**: Where applicable, the Orb API uses
    industry-standard patterns such as

    cursor-based pagination and standardized error output. To help with
    debugging in critical API

    actions, the API always strives to provide detailed and actionable error
    messages. Aliases

    such as external customer IDs aid in fast integration times.

    2. **Reliably real time**: Orb's event-based APIs, such as event ingestion
    are designed to handle extremely high

    throughput and scale with concurrent load. Orb also provides a real-time
    event-level credits

    ledger and a highly performant webhooks architecture.

    3. **Flexibility at the forefront**: Features like timezone localization and
    the ability to amend historical usage

    show the flexible nature of the platform.


    You can download the latest OpenAPI spec
    [here](https://api.withorb.com/spec.json) - pass `?version=3.0` for an

    OpenAPI 3.0-compatible spec.
  contact:
    name: Orb, Inc.
    url: https://www.withorb.com/
    email: team@withorb.com
  version: '1.0'
servers:
  - url: https://api.withorb.com/v1
    description: Production server
security:
  - APIKeyAuth: []
tags:
  - name: Alert
    description: >-
      [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending,

      usage, or credit balance and trigger webhooks when a threshold is
      exceeded.


      Alerts created through the API can be scoped to either customers or
      subscriptions.
  - name: Availability
  - name: Coupon
    description: >-
      A coupon represents a reusable discount configuration that can be applied
      either as a fixed or percentage amount to an invoice or subscription.
      Coupons are activated using a redemption code, which applies the discount
      to a subscription or invoice. The duration of a coupon determines how long
      it remains available for use by end users.
  - name: Credit
    description: >-
      The [Credit Ledger Entry resource](/product-catalog/prepurchase) models
      prepaid credits within Orb.
  - name: Credit note
    description: >-
      The [Credit Note](/invoicing/credit-notes) resource represents a credit
      that has been applied to a

      particular invoice.
  - name: Customer
    description: >-
      A customer is a buyer of your products, and the other party to the billing
      relationship.


      In Orb, customers are assigned system generated identifiers automatically,
      but it's often desirable to have these

      match existing identifiers in your system. To avoid having to denormalize
      Orb ID information, you can pass in an

      `external_customer_id` with your own identifier. See

      [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
      information about how these

      aliases work in Orb.


      In addition to having an identifier in your system, a customer may exist
      in a payment provider solution like

      Stripe. Use the `payment_provider_id` and the `payment_provider` enum
      field to express this mapping.


      A customer also has a timezone (from the standard [IANA timezone
      database](https://www.iana.org/time-zones)), which

      defaults to your account's timezone. See [Timezone
      localization](/essentials/timezones) for

      information on what this timezone parameter influences within Orb.
  - name: Dimensional Price Group
  - name: Event
    description: >-
      The [Event](/core-concepts#event) resource represents a usage event that
      has been created for a

      customer. Events are the core of Orb's usage-based billing model, and are
      used to calculate the usage charges for

      a given billing period.
  - name: Invoice
    description: >-
      An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity,
      representing the request for payment for

      a single subscription. This includes a set of line items, which correspond
      to prices in the subscription's plan and

      can represent fixed recurring fees or usage-based fees. They are generated
      at the end of a billing period, or as

      the result of an action, such as a cancellation.
  - name: Item
    description: >-
      The Item resource represents a sellable product or good. Items are
      associated with all line items, billable metrics,

      and prices and are used for defining external sync behavior for invoices
      and tax calculation purposes.
  - name: License
  - name: LicenseType
    description: >-
      The LicenseType resource represents a type of license that can be assigned
      to users.

      License types are used during billing by grouping metrics on the
      configured grouping key.
  - name: Metric
    description: >-
      The Metric resource represents a calculation of a quantity based on
      events.

      Metrics are defined by the query that transforms raw usage events into
      meaningful values for your customers.
  - name: Plan
    description: >-
      The [Plan](/core-concepts#plan-and-price) resource represents a plan that
      can be subscribed to by a

      customer. Plans define the billing behavior of the subscription. You can
      see more about how to configure prices

      in the [Price resource](/reference/price).
  - name: Price
    description: >-
      The Price resource represents a price that can be billed on a
      subscription, resulting in a charge on an invoice in

      the form of an invoice line item. Prices take a quantity and determine an
      amount to bill.


      Orb supports a few different pricing models out of the box. Each of these
      models is serialized differently in a

      given Price object. The model_type field determines the key for the
      configuration object that is present.


      For more on the types of prices, see [the core concepts
      documentation](/core-concepts#plan-and-price)
  - name: Price interval
    description: >-
      The Price Interval resource represents a period of time for which a price
      will bill on a subscription. A

      subscription’s price intervals define its billing behavior.
  - name: Subscription
    description: >-
      A [subscription](/core-concepts#subscription) represents the purchase of a
      plan by a customer.


      By default, subscriptions begin on the day that they're created and renew
      automatically for each billing cycle at

      the cadence that's configured in the plan definition.


      Subscriptions also default to **beginning of month alignment**, which
      means the first invoice issued for the

      subscription will have pro-rated charges between the `start_date` and the
      first of the following month. Subsequent

      billing periods will always start and end on a month boundary (e.g.
      subsequent month starts for monthly billing).


      Depending on the plan configuration, any _flat_ recurring fees will be
      billed either at the beginning (in-advance)

      or end (in-arrears) of each billing cycle. Plans default to **in-advance
      billing**. Usage-based fees are billed in

      arrears as usage is accumulated. In the normal course of events, you can
      expect an invoice to contain usage-based

      charges for the previous period, and a recurring fee for the following
      period.
  - name: Subscription Change
paths:
  /subscriptions/{subscription_id}/usage:
    get:
      tags:
        - Subscription
      summary: Fetch subscription usage
      description: >-
        This endpoint is used to fetch a subscription's usage in Orb. Especially
        when combined with optional query

        parameters, this endpoint is a powerful way to build visualizations on
        top of Orb's event data and metrics.


        With no query parameters specified, this endpoint returns usage for the
        subscription's _current billing period_

        across each billable metric that participates in the subscription. Usage
        quantities returned are the result of

        evaluating the metric definition for the entirety of the customer's
        billing period.


        ### Default response shape

        Orb returns a `data` array with an object corresponding to each billable
        metric. Nested within this object is a

        `usage` array which has a `quantity` value and a corresponding
        `timeframe_start` and `timeframe_end`.  The `quantity`

        value represents the calculated usage value for the billable metric over
        the specified timeframe (inclusive of the

        `timeframe_start` timestamp and exclusive of the `timeframe_end`
        timestamp).


        Orb will include _every_ window in the response starting from the
        beginning of the billing period, even when there

        were no events (and therefore no usage) in the window. This increases
        the size of the response but prevents the caller

        from filling in gaps and handling cumbersome time-based logic.


        The query parameters in this endpoint serve to override this behavior
        and provide some key functionality, as listed

        below. Note that this functionality can also be used _in conjunction_
        with each other, e.g. to display grouped usage

        on a custom timeframe.


        ## Custom timeframe

        In order to view usage for a custom timeframe rather than the current
        billing period, specify a `timeframe_start` and

        `timeframe_end`. This will calculate quantities for usage incurred
        between timeframe_start (inclusive) and timeframe_end

        (exclusive), i.e. `[timeframe_start, timeframe_end)`.


        Note:

        - These timestamps must be specified in ISO 8601 format and UTC
        timezone, e.g. `2022-02-01T05:00:00Z`.

        - Both parameters must be specified if either is specified.


        ## Grouping by custom attributes

        In order to view a single metric grouped by a specific _attribute_ that
        each event is tagged with (e.g. `cluster`), you

        must additionally specify a `billable_metric_id` and a `group_by` key.
        The `group_by` key denotes the event property on

        which to group.


        When returning grouped usage, only usage for `billable_metric_id` is 
        returned, and a separate object in the `data` array

        is returned for each value of the `group_by` key present in your events.
        The `quantity` value is the result of evaluating

        the billable metric for events filtered to a single value of the
        `group_by` key.


        Orb expects that events that match the billable metric will contain
        values in the `properties` dictionary that correspond

        to the `group_by` key specified. By default, Orb will not return a
        `null` group (i.e. events that match the metric but

        do not have the key set). Currently, it is only possible to view usage
        grouped by a single attribute at a time.

         When viewing grouped usage, Orb uses pagination to limit the response size to 1000 groups by default. If there are more
         groups for a given subscription, pagination metadata in the response can be used to fetch all of the data.

        The following example shows usage for an "API Requests" billable metric
        grouped by `region`. Note the extra `metric_group`

        dictionary in the response, which provides metadata about the group:


        ```json

        {
            "data": [
                {
                    "usage": [
                        {
                            "quantity": 0.19291,
                            "timeframe_start": "2021-10-01T07:00:00Z",
                            "timeframe_end": "2021-10-02T07:00:00Z",
                        },
                        ...
                    ],
                    "metric_group": {
                        "property_key": "region",
                        "property_value": "asia/pacific"
                    },
                    "billable_metric": {
                        "id": "Fe9pbpMk86xpwdGB",
                        "name": "API Requests"
                    },
                    "view_mode": "periodic"
                },
                ...
            ]
        }

        ```



        ## Windowed usage

        The `granularity` parameter can be used to _window_ the usage `quantity`
        value into periods. When not specified, usage

        is returned for the entirety of the time range.


        When `granularity = day` is specified with a timeframe longer than a
        day, Orb will return a `quantity` value for each

        full day between `timeframe_start` and `timeframe_end`. Note that the
        days are demarcated by the _customer's local midnight_.


        For example, with `timeframe_start = 2022-02-01T05:00:00Z`,
        `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`,

        the following windows will be returned for a customer in the
        `America/Los_Angeles` timezone since local midnight is `08:00` UTC:

        - `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)`

        - `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)`

        - `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)`

        - `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`


        ```json

        {
            "data": [
                {
                    "billable_metric": {
                        "id": "Q8w89wjTtBdejXKsm",
                        "name": "API Requests"
                    },
                    "usage": [
                        {
                            "quantity": 0,
                            "timeframe_end": "2022-02-01T08:00:00+00:00",
                            "timeframe_start": "2022-02-01T05:00:00+00:00"
                        },
                        {

                            "quantity": 0,
                            "timeframe_end": "2022-02-02T08:00:00+00:00",
                            "timeframe_start": "2022-02-01T08:00:00+00:00"
                        },
                        {
                            "quantity": 0,
                            "timeframe_end": "2022-02-03T08:00:00+00:00",
                            "timeframe_start": "2022-02-02T08:00:00+00:00"
                        },
                        {
                            "quantity": 0,
                            "timeframe_end": "2022-02-04T01:00:00+00:00",
                            "timeframe_start": "2022-02-03T08:00:00+00:00"
                        }
                    ],
                    "view_mode": "periodic"
                },
                ...
            ]
        }

        ```


        ## Decomposable vs. non-decomposable metrics

        Billable metrics fall into one of two categories: decomposable and
        non-decomposable. A decomposable billable metric, such as

        a sum or a count, can be displayed and aggregated across arbitrary
        timescales. On the other hand, a non-decomposable metric

        is not meaningful when only a slice of the billing window is considered.


        As an example, if we have a billable metric that's defined to count
        unique users, displaying a graph of unique users for each

        day is not representative of the billable metric value over the month
        (days could have an overlapping set of 'unique' users).

        Instead, what's useful for any given day is the number of unique users
        in the billing period so far, which are the

        _cumulative_ unique users.


        Accordingly, this endpoint returns treats these two types of metrics
        differently when `group_by` is specified:

        - Decomposable metrics can be grouped by any event property.

        - Non-decomposable metrics can only be grouped by the corresponding
        price's invoice grouping key. If no invoice grouping key

        is present, the metric does not support `group_by`.


        ## Matrix prices

        When a billable metric is attached to a price that uses matrix pricing,
        it's important to view usage grouped by those matrix

        dimensions. In this case, use the query parameters
        `first_dimension_key`, `first_dimension_value` and
        `second_dimension_key`,

        `second_dimension_value` while filtering to a specific
        `billable_metric_id`.


        For example, if your compute metric has a separate unit price (i.e. a
        matrix pricing model) per `region` and `provider`,

        your request might provide the following parameters:


        - `first_dimension_key`: `region`

        - `first_dimension_value`: `us-east-1`

        - `second_dimension_key`: `provider`

        - `second_dimension_value`: `aws`
      operationId: fetch-subscription-usage
      parameters:
        - required: true
          style: simple
          schema:
            type: string
          name: subscription_id
          in: path
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
                enum:
                  - day
              - type: 'null'
            title: Granularity
            description: This determines the windowing of usage reporting.
            default: day
          name: granularity
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Timeframe Start
            description: Usage returned is inclusive of `timeframe_start`.
            examples:
              - '2022-02-01T05:00:00Z'
          name: timeframe_start
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Timeframe End
            description: Usage returned is exclusive of `timeframe_end`.
            examples:
              - '2022-03-01T05:00:00Z'
          name: timeframe_end
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
              - type: 'null'
            title: Billable Metric Id
            description: >-
              When specified in conjunction with `group_by`, this parameter
              filters usage to a single billable metric. Note that both
              `group_by` and `billable_metric_id` must be specified together.
          name: billable_metric_id
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
              - type: 'null'
            title: Group By
            description: Groups per-price usage by the key provided.
          name: group_by
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
                enum:
                  - periodic
                  - cumulative
              - type: 'null'
            title: View Mode
            description: >-
              Controls whether Orb returns cumulative usage since the start of
              the billing period, or incremental day-by-day usage. If your
              customer has minimums or discounts, it's strongly recommended that
              you use the default cumulative behavior.
          name: view_mode
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
              - type: 'null'
            title: First Dimension Key
          name: first_dimension_key
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
              - type: 'null'
            title: First Dimension Value
          name: first_dimension_value
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
              - type: 'null'
            title: Second Dimension Key
          name: second_dimension_key
          in: query
        - required: false
          style: form
          schema:
            oneOf:
              - type: string
              - type: 'null'
            title: Second Dimension Value
          name: second_dimension_value
          in: query
      responses:
        '200':
          description: OK
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionUsage'
        '400':
          description: Bad Request
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Error'
        '401':
          description: Unauthorized
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/401Error'
        '404':
          description: Not Found
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/404Error'
        '409':
          description: Conflict
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/409Error'
        '413':
          description: Content Too Large
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/413Error'
        '429':
          description: Too Many Requests
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/429Error'
        '500':
          description: Internal Server Error
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/500Error'
components:
  schemas:
    SubscriptionUsage:
      oneOf:
        - $ref: '#/components/schemas/UngroupedSubscriptionUsage'
        - $ref: '#/components/schemas/GroupedSubscriptionUsage'
    400Error:
      oneOf:
        - $ref: '#/components/schemas/ConstraintViolationError'
        - $ref: '#/components/schemas/DuplicateResourceCreationError'
        - $ref: '#/components/schemas/RequestValidationError'
    401Error:
      $ref: '#/components/schemas/AuthorizationError'
      title: 401Error
    404Error:
      oneOf:
        - $ref: '#/components/schemas/FeatureNotAvailableError'
        - $ref: '#/components/schemas/ResourceNotFoundError'
        - $ref: '#/components/schemas/URLNotFound'
    409Error:
      $ref: '#/components/schemas/IdempotencyRequestMismatch'
      title: 409Error
    413Error:
      oneOf:
        - $ref: '#/components/schemas/RequestTooLargeError'
        - $ref: '#/components/schemas/ResourceTooLargeError'
        - $ref: '#/components/schemas/TooManyResultsError'
    429Error:
      $ref: '#/components/schemas/TooManyRequests'
      title: 429Error
    500Error:
      $ref: '#/components/schemas/ServerError'
      title: 500Error
    UngroupedSubscriptionUsage:
      properties:
        data:
          items:
            $ref: '#/components/schemas/UngroupedSubscriptionUsageRecord'
          type: array
          title: Data
      type: object
      required:
        - data
      title: UngroupedSubscriptionUsage
    GroupedSubscriptionUsage:
      properties:
        data:
          items:
            $ref: '#/components/schemas/GroupedSubscriptionUsageRecord'
          type: array
          title: Data
        pagination_metadata:
          oneOf:
            - $ref: '#/components/schemas/PaginationMetadata'
            - type: 'null'
      type: object
      required:
        - data
      title: GroupedSubscriptionUsage
    ConstraintViolationError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#400-constraint-violation
          title: Type
        status:
          type: integer
          enum:
            - 400
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: ConstraintViolationError
    DuplicateResourceCreationError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#400-duplicate-resource-creation
          title: Type
        status:
          type: integer
          enum:
            - 400
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: DuplicateResourceCreationError
    RequestValidationError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#400-request-validation-errors
          title: Type
        status:
          type: integer
          enum:
            - 400
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
        validation_errors:
          items: {}
          type: array
          title: Validation Errors
      type: object
      required:
        - type
        - status
        - validation_errors
      title: RequestValidationError
    AuthorizationError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#401-authentication-error
          title: Type
        status:
          type: integer
          enum:
            - 401
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: AuthorizationError
    FeatureNotAvailableError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#404-feature-not-available
          title: Type
        status:
          type: integer
          enum:
            - 400
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: FeatureNotAvailableError
    ResourceNotFoundError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#404-resource-not-found
          title: Type
        status:
          type: integer
          enum:
            - 404
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          type: string
          title: Title
      type: object
      required:
        - type
        - status
        - title
      title: ResourceNotFoundError
    URLNotFound:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#404-url-not-found
          title: Type
        status:
          type: integer
          enum:
            - 404
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: URLNotFound
    IdempotencyRequestMismatch:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#409-resource-conflict
          title: Type
        status:
          type: integer
          enum:
            - 409
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: IdempotencyRequestMismatch
    RequestTooLargeError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#413-request-too-large
          title: Type
        status:
          type: integer
          enum:
            - 413
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: RequestTooLargeError
    ResourceTooLargeError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#413-resource-too-large
          title: Type
        status:
          type: integer
          enum:
            - 413
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: ResourceTooLargeError
    TooManyResultsError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#413-too-many-results
          title: Type
        status:
          type: integer
          enum:
            - 413
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: TooManyResultsError
    TooManyRequests:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#429-too-many-requests
          title: Type
        status:
          type: integer
          enum:
            - 429
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: TooManyRequests
    ServerError:
      properties:
        type:
          type: string
          enum:
            - >-
              https://docs.withorb.com/reference/error-responses#500-internal-server-error
          title: Type
        status:
          type: integer
          title: Status
        detail:
          oneOf:
            - type: string
            - type: 'null'
          title: Detail
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: Title
      type: object
      required:
        - type
        - status
      title: ServerError
    UngroupedSubscriptionUsageRecord:
      properties:
        usage:
          items:
            $ref: '#/components/schemas/Usage'
          type: array
          title: Usage
        billable_metric:
          $ref: '#/components/schemas/BillableMetricSimple'
        view_mode:
          type: string
          enum:
            - periodic
            - cumulative
          title: View Mode
      type: object
      required:
        - usage
        - billable_metric
        - view_mode
      title: UngroupedSubscriptionUsageRecord
    GroupedSubscriptionUsageRecord:
      properties:
        usage:
          items:
            $ref: '#/components/schemas/Usage'
          type: array
          title: Usage
        billable_metric:
          $ref: '#/components/schemas/BillableMetricSimple'
        metric_group:
          $ref: '#/components/schemas/MetricGroup'
        view_mode:
          type: string
          enum:
            - periodic
            - cumulative
          title: View Mode
      type: object
      required:
        - usage
        - billable_metric
        - metric_group
        - view_mode
      title: GroupedSubscriptionUsageRecord
    PaginationMetadata:
      properties:
        has_more:
          type: boolean
          title: Has More
        next_cursor:
          oneOf:
            - type: string
            - type: 'null'
          title: Next Cursor
      type: object
      required:
        - has_more
        - next_cursor
      title: PaginationMetadata
    Usage:
      properties:
        quantity:
          type: number
          title: Quantity
        timeframe_start:
          type: string
          format: date-time
          title: Timeframe Start
        timeframe_end:
          type: string
          format: date-time
          title: Timeframe End
      type: object
      required:
        - quantity
        - timeframe_start
        - timeframe_end
      title: Usage
    BillableMetricSimple:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
      type: object
      required:
        - id
        - name
      title: BillableMetricSimple
    MetricGroup:
      properties:
        property_key:
          type: string
          title: Property Key
        property_value:
          type: string
          title: Property Value
      type: object
      required:
        - property_key
        - property_value
      title: MetricGroup
  securitySchemes:
    APIKeyAuth:
      type: http
      description: API Keys can be issued in the Orb's web application.
      scheme: bearer

````