POST
/
usage
curl --request POST \
  --url https://api.sulu.sh/v0/usage \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "idempotencyKey": "<string>",
  "customerId": "<string>",
  "merchantId": "<string>",
  "timestamp": "2023-11-07T05:31:56Z",
  "properties": [
    {
      "billableMetricId": "<string>",
      "quantity": 123,
      "price": "<string>"
    }
  ],
  "metadata": {}
}'
{
  "id": "<string>",
  "object": "usageEvent",
  "idempotencyKey": "<string>",
  "customerId": "<string>",
  "description": "<string>",
  "merchantId": "<string>",
  "consumerId": "<string>",
  "timestamp": "2023-11-07T05:31:56Z",
  "createdAt": "2023-11-07T05:31:56Z",
  "properties": [
    {
      "billableMetricId": "<string>",
      "quantity": 123,
      "price": "<string>"
    }
  ],
  "metadata": {},
  "billing": {
    "price": 123,
    "billingEventId": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
idempotencyKey
string
required

Unique key to ensure the event is processed only once. Duplicate submissions might generate different event IDs, but events will be deduplicated at process time.

customerId
string
required

ID of the customer that generated this usage event.

merchantId
string
required

ID of the merchant organization that owns this usage event.

timestamp
string
required

Timestamp the usage event occurred at, for external reference. This is not equivalent to the time Sulu receives and processes the event, it is the time the event actually occurred at (or equivalent). ISO 8601 date-time string

properties
object[]
required
metadata
object

Key-value pairs for storing additional data about the usage event.

Response

201
application/json
Usage event created successfully
id
string

Unique identifier for a usage event

object
enum<string>
Available options:
usageEvent
idempotencyKey
string
customerId
string
description
string
merchantId
string
consumerId
string
timestamp
string
createdAt
string
properties
object[]
metadata
object
billing
object

Billing information for the usage event when it has been billed.