Twilio UsageRecords API

The UsageRecords API from Twilio — 1 operation(s) for usagerecords.

Documentation

Specifications

Other Resources

OpenAPI Specification

twilio-usagerecords-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Twilio - Accounts A2p UsageRecords API
  description: This is the public Twilio REST API.
  termsOfService: https://www.twilio.com/legal/tos
  contact:
    name: Twilio Support
    url: https://support.twilio.com
    email: support@twilio.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.52.0
servers:
- url: https://accounts.twilio.com
tags:
- name: UsageRecords
paths:
  /v1/UsageRecords:
    servers:
    - url: https://supersim.twilio.com
    description: Usage information for Sim resources
    x-twilio:
      defaultOutputProperties:
      - account_sid
      - period
      pathType: list
    get:
      description: List UsageRecords
      tags:
      - UsageRecords
      parameters:
      - name: Sim
        in: query
        description: SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM.
        schema:
          type: string
      - name: Fleet
        in: query
        description: SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred.
        schema:
          type: string
      - name: Network
        in: query
        description: SID of a Network resource. Only show UsageRecords representing usage on this network.
        schema:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^HW[0-9a-fA-F]{32}$
      - name: IsoCountry
        in: query
        description: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country.
        schema:
          type: string
          format: iso-country-code
      - name: Group
        in: query
        description: 'Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter.'
        schema:
          type: string
          $ref: '#/components/schemas/usage_record_enum_group'
      - name: Granularity
        in: query
        description: 'Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period.'
        schema:
          type: string
          $ref: '#/components/schemas/usage_record_enum_granularity'
      - name: StartTime
        in: query
        description: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`.
        schema:
          type: string
          format: date-time
      - name: EndTime
        in: query
        description: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time.
        schema:
          type: string
          format: date-time
      - name: PageSize
        in: query
        description: How many resources to return in each list page. The default is 50, and the maximum is 1000.
        schema:
          type: integer
          minimum: 1
          maximum: 1000
      - name: Page
        in: query
        description: The page index. This value is simply for client state.
        schema:
          type: integer
          minimum: 0
      - name: PageToken
        in: query
        description: The page token. This is provided by the API.
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListUsageRecordResponse'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: ListUsageRecord
      x-maturity:
      - Beta
components:
  schemas:
    ListUsageRecordResponse:
      type: object
      properties:
        usage_records:
          type: array
          items:
            $ref: '#/components/schemas/supersim.v1.usage_record'
        meta:
          type: object
          properties:
            first_page_url:
              type: string
              format: uri
            next_page_url:
              type: string
              format: uri
              nullable: true
            page:
              type: integer
            page_size:
              type: integer
            previous_page_url:
              type: string
              format: uri
              nullable: true
            url:
              type: string
              format: uri
            key:
              type: string
    usage_record_enum_group:
      type: string
      enum:
      - sim
      - fleet
      - network
      - isoCountry
    supersim.v1.usage_record:
      type: object
      properties:
        account_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^AC[0-9a-fA-F]{32}$
          nullable: true
          description: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage.
        sim_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^HS[0-9a-fA-F]{32}$
          nullable: true
          description: SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`.
        network_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^HW[0-9a-fA-F]{32}$
          nullable: true
          description: SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`.
        fleet_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^HF[0-9a-fA-F]{32}$
          nullable: true
          description: SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`.
        iso_country:
          type: string
          format: iso-country-code
          nullable: true
          description: Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`.
        period:
          nullable: true
          description: The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        data_upload:
          type: integer
          format: int64
          nullable: true
          description: Total data uploaded in bytes, aggregated by the query parameters.
        data_download:
          type: integer
          format: int64
          nullable: true
          description: Total data downloaded in bytes, aggregated by the query parameters.
        data_total:
          type: integer
          format: int64
          nullable: true
          description: Total of data_upload and data_download.
        data_total_billed:
          type: number
          nullable: true
          description: Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details.
        billed_unit:
          type: string
          format: currency
          nullable: true
          description: The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details.
    usage_record_enum_granularity:
      type: string
      enum:
      - hour
      - day
      - all
  securitySchemes:
    accountSid_authToken:
      type: http
      scheme: basic
x-maturity:
- name: GA
  description: This product is Generally Available.
- name: Beta
  description: PLEASE NOTE that this is a Beta product that is subject to change. Use it with caution.