Usage

Record a usage event

Changed on

Records a usage event into the Usage timeseries collection.

post/v1/sdk/usages

Request

Request body

actionType'transaction' | 'api_call' | 'hour' | 'email' | 'storage' | 'custom'
customerRefstring required
descriptionstring
durationnumber
errorMessagestring
idempotencyKeystring
metadataobject
outcome'success' | 'paywall' | 'fail'
productRefstring
purchaseRefstring
timestampstring date-time required
unitsinteger

Response

Usage recorded successfully

referencestring required
successboolean required

Example response

{
  "creditDebit": {
    "amount": 100,
    "autoRecharge": {
      "triggered": true
    },
    "remainingUnits": 99,
    "unitsRemaining": 99
  },
  "reference": "usage_A1B2C3D4",
  "success": true
}

Changes

    • warning

      added the new not_credit_drawn enum value to the ///// response property for the response status

    • warning

      added the new within_included enum value to the ///// response property for the response status

    • info

      removed the plan_billed_at_period_end enum value from the ///// response property for the response status

    • warning

      added the new plan_billed_at_period_end enum value to the ///// response property for the response status

    • info

      response property creditDebit/oneOf[CreditDebitSuccessResponse]/unitsRemaining deprecated

    • info

      added the required property ///// to the response with the status