Orb

Orb Metrics API

The Metrics API from Orb — 2 operation(s) for metrics.

Documentation

Specifications

Other Resources

OpenAPI Specification

orb-billing-metrics-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Orb Alerts Metrics API
  description: Orb is a usage-based billing and metering platform. The REST API ingests timestamped usage events, models customers, plans, prices, items, and billable metrics, manages subscriptions, and automates invoicing, credit ledgers, coupons, alerts, and webhooks. All endpoints are served over HTTPS at https://api.withorb.com/v1 and authenticated with a Bearer API key.
  termsOfService: https://www.withorb.com/legal/terms-of-service
  contact:
    name: Orb Support
    url: https://www.withorb.com
    email: team@withorb.com
  version: '1.0'
servers:
- url: https://api.withorb.com/v1
  description: Orb production API
security:
- bearerAuth: []
tags:
- name: Metrics
paths:
  /metrics:
    get:
      operationId: listMetrics
      tags:
      - Metrics
      summary: List metrics
      parameters:
      - $ref: '#/components/parameters/Cursor'
      - $ref: '#/components/parameters/Limit'
      responses:
        '200':
          description: A paginated list of billable metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricList'
    post:
      operationId: createMetric
      tags:
      - Metrics
      summary: Create metric
      description: Creates a billable metric defined by a SQL expression over events.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetricCreate'
      responses:
        '201':
          description: The newly created metric.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Metric'
  /metrics/{metric_id}:
    parameters:
    - name: metric_id
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: getMetric
      tags:
      - Metrics
      summary: Get metric
      responses:
        '200':
          description: The requested metric.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Metric'
components:
  parameters:
    Limit:
      name: limit
      in: query
      description: The number of items to return per page (default 20, max 100).
      schema:
        type: integer
        default: 20
        maximum: 100
    Cursor:
      name: cursor
      in: query
      description: An opaque cursor for the next page of results.
      schema:
        type: string
  schemas:
    PaginationMetadata:
      type: object
      properties:
        has_more:
          type: boolean
        next_cursor:
          type: string
          nullable: true
    Metric:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        status:
          type: string
          enum:
          - active
          - draft
          - archived
        item:
          $ref: '#/components/schemas/Item'
        metadata:
          type: object
          additionalProperties:
            type: string
    Item:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        external_connections:
          type: array
          items:
            type: object
            properties:
              external_connection_name:
                type: string
              external_entity_id:
                type: string
        created_at:
          type: string
          format: date-time
    MetricCreate:
      type: object
      required:
      - name
      - sql
      - item_id
      properties:
        name:
          type: string
        description:
          type: string
        sql:
          type: string
          description: The SQL expression that aggregates events into a billable quantity.
        item_id:
          type: string
    MetricList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Metric'
        pagination_metadata:
          $ref: '#/components/schemas/PaginationMetadata'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Authenticate with an Orb API key sent as a Bearer token in the Authorization header: `Authorization: Bearer <ORB_API_KEY>`.'