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

# Record bulk usage events

> Same persistence rules as POST /sdk/usages for each item: validate batch first, then one insert per event.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sdk/usages/bulk
openapi: 3.0.0
info:
  contact: {}
  description: The SolvaPay REST API specification
  title: SolvaPay REST API
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /v1/sdk/usages/bulk:
    post:
      tags:
        - Usage
      summary: Record bulk usage events
      description: >-
        Same persistence rules as POST /sdk/usages for each item: validate batch
        first, then one insert per event.
      operationId: UsageSdkController_recordBulkUsage
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkCreateUsageRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUsageResponse'
          description: Bulk usage events processed
        '400':
          description: Validation failed
      security:
        - SecretKey: []
components:
  schemas:
    BulkCreateUsageRequest:
      properties:
        events:
          items:
            properties:
              actionType:
                default: api_call
                enum:
                  - transaction
                  - api_call
                  - hour
                  - email
                  - storage
                  - custom
                type: string
              customerRef:
                maxLength: 20
                minLength: 1
                type: string
              description:
                type: string
              duration:
                exclusiveMinimum: false
                minimum: 0
                type: number
              errorMessage:
                type: string
              idempotencyKey:
                maxLength: 256
                type: string
              metadata:
                additionalProperties: true
                type: object
              outcome:
                default: success
                enum:
                  - success
                  - paywall
                  - fail
                type: string
              productRef:
                maxLength: 20
                type: string
              purchaseRef:
                maxLength: 20
                type: string
              timestamp:
                format: date-time
                type: string
              units:
                default: 1
                exclusiveMaximum: false
                exclusiveMinimum: false
                maximum: 100000
                minimum: 0
                type: integer
            required:
              - customerRef
              - timestamp
            type: object
          maxItems: 1000
          minItems: 1
          type: array
      required:
        - events
      type: object
    BulkUsageResponse:
      properties:
        inserted:
          description: Number of usage events inserted
          example: 2
          type: number
        results:
          items:
            $ref: '#/components/schemas/BulkUsageResultResponse'
          type: array
        success:
          example: true
          type: boolean
      required:
        - success
        - inserted
        - results
      type: object
    BulkUsageResultResponse:
      properties:
        creditDebit:
          oneOf:
            - $ref: '#/components/schemas/CreditDebitSuccessResponse'
            - $ref: '#/components/schemas/CreditDebitSkippedResponse'
        reference:
          example: usage_A1B2C3D4
          type: string
      required:
        - reference
      type: object
    CreditDebitSuccessResponse:
      properties:
        amount:
          description: Credits debited for this usage event
          example: 10
          type: number
        autoRecharge:
          $ref: '#/components/schemas/AutoRechargeTriggeredResponse'
        debited:
          enum:
            - true
          type: number
        unitsRemaining:
          description: Estimated remaining units after debit
          example: 99
          type: number
      required:
        - debited
        - amount
        - unitsRemaining
      type: object
    CreditDebitSkippedResponse:
      properties:
        debited:
          enum:
            - false
          type: number
        reason:
          description: Reason no credit debit was recorded
          enum:
            - duplicate
            - no_product_ref
            - customer_not_found
            - no_active_purchase
            - plan_not_credit_based
          example: duplicate
          type: string
      required:
        - debited
        - reason
      type: object
    AutoRechargeTriggeredResponse:
      properties:
        triggered:
          description: >-
            Whether the server initiated an auto-recharge charge after this
            debit (TOPUP credit lands via webhook)
          example: true
          type: boolean
      required:
        - triggered
      type: object
  securitySchemes:
    SecretKey:
      bearerFormat: JWT
      description: >-
        Provider secret API key (sk_live_… / sk_test_…) supplied as a Bearer
        token.
      scheme: bearer
      type: http

````