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

# Ingest usage events

> support atomic operation: all or nothing

max number of usage events: 50 per request



## OpenAPI

````yaml /billing.openapi.json post /api/usage-events
openapi: 3.1.0
info:
  title: Billing
  description: |+

  version: 1.0.0
  summary: ''
servers:
  - url: https://sbx.api.easybilling.cloud/billing
    description: SBX
  - url: https://api.easybilling.cloud/billing
    description: Production-AWS
security:
  - token: []
tags:
  - name: account
  - name: payment method
  - name: contract action
  - name: usage event
  - name: billing document
  - name: invoice pdf
  - name: prepaid credits
  - name: customer portal
paths:
  /api/usage-events:
    post:
      tags:
        - usage event
      summary: Ingest usage events
      description: |-
        support atomic operation: all or nothing

        max number of usage events: 50 per request
      operationId: ingestUsageEvents
      parameters:
        - name: Idempotency-Key
          in: header
          description: ''
          required: true
          example: '{{$string.uuid}}'
          schema:
            type: string
        - name: trace-id
          in: header
          description: ''
          required: true
          example: '{{$string.uuid}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              maxItems: 50
              minItems: 1
              type: array
              items:
                $ref: '#/components/schemas/UsageEvent'
            example:
              - eventId: ue-12345
                schemaName: AI
                eventTime: '2026-03-02T20:53:19Z'
                accountNumber: ACC-0000000001
                attributes:
                  - name: model
                    value: GPT-5
                  - name: token
                    value: '101'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageEventIngestionResponse'
          headers: {}
        '400':
          description: Bad Request
          headers: {}
        '401':
          description: Unauthorized
          headers: {}
        '404':
          description: Not Found
          headers: {}
        '500':
          description: Internal Server Error
          headers: {}
      deprecated: false
      security:
        - token: []
components:
  schemas:
    UsageEvent:
      required:
        - accountNumber
        - eventId
        - eventTime
        - schemaName
      type: object
      properties:
        eventId:
          maxLength: 64
          minLength: 36
          type: string
          description: unique id of this usage event
        schemaName:
          type: string
          description: the schema you defined in usage event schema for this usage event
        eventTime:
          type: string
          description: time of usage event in ISO format
        accountNumber:
          type: string
          description: the customer account consuming this usage
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/UsageEventAttribute'
          maxItems: 50
          minItems: 1
    UsageEventIngestionResponse:
      type: object
      properties:
        success:
          type: boolean
        errorMessage:
          type: string
        successDetails:
          type: array
          items:
            $ref: '#/components/schemas/UsageEventSuccessDetail'
        errorDetails:
          type: array
          items:
            $ref: '#/components/schemas/UsageEventErrorDetail'
    UsageEventAttribute:
      required:
        - name
        - value
      type: object
      properties:
        name:
          type: string
          description: attribute name of the usage event schema
        value:
          type: string
          description: value for this attribute
    UsageEventSuccessDetail:
      type: object
      properties:
        eventId:
          type: string
    UsageEventErrorDetail:
      type: object
      properties:
        eventId:
          type: string
        errorMessage:
          type: string
  securitySchemes:
    token:
      type: http
      scheme: bearer

````