Skip to content
Join our SlackContact usGet started

Create Usage Event

post/usage-events

Create Usage Event

Body ParametersExpand Collapse
data: map[string or number]

The data of the usage event. This should contain any data that is needed to aggregate the usage event.

Accepts one of the following:
UnionMember0 = string
UnionMember1 = number
event_name: string

The name of the event. This is used by pricing metrics to aggregate usage events.

idempotency_key: string

The idempotency key for the usage event. This ensures that the same event is not processed multiple times.

subject_id: string

The ID or external ID of the subject that the usage event is for.

timestamp: optional string

The timestamp of the usage event. It is highly recommended to provide a timestamp. If not provided, the current timestamp will be used.

formatdate-time
Create Usage Event
curl https://api.uselark.ai/usage-events \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $LARK_API_KEY" \
    -d '{
          "data": {
            "compute_hours": "100.5",
            "instance_type": "t2.micro",
            "region": "us-east-1"
          },
          "event_name": "job_completed",
          "idempotency_key": "168fbd3a-4d39-4db3-a204-15e014857d10",
          "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE"
        }'
{}
Returns Examples
{}