Skip to main content
POST
/
v1
/
sdk
/
usages
Record a usage event
curl --request POST \
  --url https://api.example.com/v1/sdk/usages \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerRef": "<string>",
  "metadata": {},
  "timestamp": "2023-11-07T05:31:56Z",
  "actionType": "api_call",
  "units": 1,
  "outcome": "success",
  "productRef": "<string>",
  "purchaseRef": "<string>",
  "description": "<string>",
  "errorMessage": "<string>",
  "duration": 1,
  "idempotencyKey": "<string>"
}
'
{
  "success": true,
  "reference": "usage_A1B2C3D4"
}

Body

application/json
customerRef
string
required
Minimum string length: 1
metadata
object
required
timestamp
string<date-time>
required
actionType
enum<string>
default:api_call
Available options:
transaction,
api_call,
hour,
email,
storage,
custom
units
integer
default:1
Required range: 0 < x < 100000
outcome
enum<string>
default:success
Available options:
success,
paywall,
fail
productRef
string
purchaseRef
string
description
string
errorMessage
string
duration
number
Required range: x > 0
idempotencyKey
string
Maximum string length: 256

Response

Usage recorded successfully

success
boolean
Example:

true

reference
string
Example:

"usage_A1B2C3D4"