Usage

Record a usage event

Records a usage event into the Usage timeseries collection.

post/v1/sdk/usages

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
    },
    "unitsRemaining": 99
  },
  "reference": "usage_A1B2C3D4",
  "success": true
}

Changes

Changed in 11 of the 27 revisions of this API.113739

    • the request property metadata became optional

      request-property-became-optional

    This revision also has 3 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • the customerRef request property's maxLength was set to 20

      request-property-max-length-set

    • the productRef request property's maxLength was set to 20

      request-property-max-length-set

    • the purchaseRef request property's maxLength was set to 20

      request-property-max-length-set

    • the endpoint scheme security SecretKey was added to the API

      api-security-added

    • the endpoint scheme security bearer was removed from the API

      api-security-removed

    • added the optional property creditDebit to the response with the 200 status

      response-optional-property-added

    • the response property reference became required for the status 200

      response-property-became-required

    • the response property success became required for the status 200

      response-property-became-required

    This revision also has 3 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added the new required request property customerRef

      new-required-request-property

    • removed the request property customerId

      request-property-removed

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • removed the request property productReference

      request-property-removed

    • removed the request property purchaseReference

      request-property-removed

    • added the new optional request property productRef

      new-optional-request-property

    • added the new optional request property purchaseRef

      new-optional-request-property

  • 88abf6f50f11456See the full diff
    • the request property metadata became required

      request-property-became-required

    • the request property timestamp became required

      request-property-became-required

    • the customerId request property's minLength was increased from 0 to 1

      request-property-min-length-increased

    • the units request property type/format changed from number/ to integer/

      request-property-type-changed

    • the units request property's exclusiveMaximum was set to false

      request-property-exclusive-max-set

    • the units request property's exclusiveMinimum was set to false

      request-property-exclusive-min-set

    • the idempotencyKey request property's maxLength was set to 256

      request-property-max-length-set

    • the units request property's max was set to 100000.00

      request-property-max-set

    • the units request property's min was set to 0.00

      request-property-min-set

    • added the new optional request property description

      new-optional-request-property

    • added the new optional request property duration

      new-optional-request-property

    • added the new optional request property errorMessage

      new-optional-request-property

    • the actionType request property default value api_call was added

      request-property-default-value-added

    • the outcome request property default value success was added

      request-property-default-value-added

    • the units request property default value 1 was added

      request-property-default-value-added

    This revision also has 44 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • e0583a41987c178See the full diff
    • added the new required request property customerId

      new-required-request-property

    • removed the request property action

      request-property-removed

    • removed the request property customActionKey

      request-property-removed

    • removed the request property customerRef

      request-property-removed

    • removed the request property description

      request-property-removed

    • removed the request property productRef

      request-property-removed

    • removed the request property toolName

      request-property-removed

    • removed the optional property outcome from the response with the 200 status

      response-optional-property-removed

    • added the new optional request property actionType

      new-optional-request-property

    • added the new optional request property idempotencyKey

      new-optional-request-property

    • added the new optional request property outcome

      new-optional-request-property

    • added the new optional request property productReference

      new-optional-request-property

    • added the new optional request property purchaseReference

      new-optional-request-property

    • added the new optional request property timestamp

      new-optional-request-property

    • removed the non-success response with the status 404

      response-non-success-status-removed

    • added the optional property reference to the response with the 200 status

      response-optional-property-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 9fd92a720973286See the full diff
    • added the new required request property customerRef

      new-required-request-property

    • added the new required request property productRef

      new-required-request-property

    • removed the request property actionType

      request-property-removed

    • removed the request property customerId

      request-property-removed

    • removed the request property idempotencyKey

      request-property-removed

    • removed the request property outcome

      request-property-removed

    • removed the request property productReference

      request-property-removed

    • removed the request property purchaseReference

      request-property-removed

    • removed the request property timestamp

      request-property-removed

    • removed the optional property reference from the response with the 200 status

      response-optional-property-removed

    • added the new optional request property action

      new-optional-request-property

    • added the new optional request property customActionKey

      new-optional-request-property

    • added the new optional request property description

      new-optional-request-property

    • added the new optional request property toolName

      new-optional-request-property

    • added the non-success response with the status 404

      response-non-success-status-added

    • added the optional property outcome to the response with the 200 status

      response-optional-property-added

    This revision also has 15 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • c38fce7d1ce2247See the full diff
    • added the new required request property customerId

      new-required-request-property

    • the timestamp request property type/format changed from string/ to string/date-time

      request-property-type-changed

    • removed the request property customerRef

      request-property-removed

    • removed the request property meterName

      request-property-removed

    • removed the request property properties

      request-property-removed

    • removed the optional property units from the response with the 200 status

      response-optional-property-removed

    • added the new optional request property actionType

      new-optional-request-property

    • added the new optional request property idempotencyKey

      new-optional-request-property

    • added the new optional request property metadata

      new-optional-request-property

    • added the new optional request property outcome

      new-optional-request-property

    • added the new optional request property productReference

      new-optional-request-property

    • added the new optional request property purchaseReference

      new-optional-request-property

    • added the optional property reference to the response with the 200 status

      response-optional-property-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 0e1cded2ee5d173See the full diff
    • added the new required request property meterName

      new-required-request-property

    • removed the request property action

      request-property-removed

    • removed the request property customActionKey

      request-property-removed

    • removed the request property description

      request-property-removed

    • removed the request property metadata

      request-property-removed

    • removed the request property productRef

      request-property-removed

    • removed the request property toolName

      request-property-removed

    • removed the optional property outcome from the response with the 200 status

      response-optional-property-removed

    • added the new optional request property properties

      new-optional-request-property

    • added the new optional request property timestamp

      new-optional-request-property

    • removed the non-success response with the status 404

      response-non-success-status-removed

    This revision also has 4 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog