Ingest usage events
curl --request POST \
--url https://sbx.api.easybilling.cloud/billing/api/usage-events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'trace-id: <trace-id>' \
--data '
[
{
"eventId": "ue-12345",
"schemaName": "AI",
"eventTime": "2026-03-02T20:53:19Z",
"accountNumber": "ACC-0000000001",
"attributes": [
{
"name": "model",
"value": "GPT-5"
},
{
"name": "token",
"value": "101"
}
]
}
]
'import requests
url = "https://sbx.api.easybilling.cloud/billing/api/usage-events"
payload = [
{
"eventId": "ue-12345",
"schemaName": "AI",
"eventTime": "2026-03-02T20:53:19Z",
"accountNumber": "ACC-0000000001",
"attributes": [
{
"name": "model",
"value": "GPT-5"
},
{
"name": "token",
"value": "101"
}
]
}
]
headers = {
"Idempotency-Key": "<idempotency-key>",
"trace-id": "<trace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'trace-id': '<trace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
eventId: 'ue-12345',
schemaName: 'AI',
eventTime: '2026-03-02T20:53:19Z',
accountNumber: 'ACC-0000000001',
attributes: [{name: 'model', value: 'GPT-5'}, {name: 'token', value: '101'}]
}
])
};
fetch('https://sbx.api.easybilling.cloud/billing/api/usage-events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sbx.api.easybilling.cloud/billing/api/usage-events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'eventId' => 'ue-12345',
'schemaName' => 'AI',
'eventTime' => '2026-03-02T20:53:19Z',
'accountNumber' => 'ACC-0000000001',
'attributes' => [
[
'name' => 'model',
'value' => 'GPT-5'
],
[
'name' => 'token',
'value' => '101'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"trace-id: <trace-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sbx.api.easybilling.cloud/billing/api/usage-events"
payload := strings.NewReader("[\n {\n \"eventId\": \"ue-12345\",\n \"schemaName\": \"AI\",\n \"eventTime\": \"2026-03-02T20:53:19Z\",\n \"accountNumber\": \"ACC-0000000001\",\n \"attributes\": [\n {\n \"name\": \"model\",\n \"value\": \"GPT-5\"\n },\n {\n \"name\": \"token\",\n \"value\": \"101\"\n }\n ]\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("trace-id", "<trace-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sbx.api.easybilling.cloud/billing/api/usage-events")
.header("Idempotency-Key", "<idempotency-key>")
.header("trace-id", "<trace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"eventId\": \"ue-12345\",\n \"schemaName\": \"AI\",\n \"eventTime\": \"2026-03-02T20:53:19Z\",\n \"accountNumber\": \"ACC-0000000001\",\n \"attributes\": [\n {\n \"name\": \"model\",\n \"value\": \"GPT-5\"\n },\n {\n \"name\": \"token\",\n \"value\": \"101\"\n }\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://sbx.api.easybilling.cloud/billing/api/usage-events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["trace-id"] = '<trace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"eventId\": \"ue-12345\",\n \"schemaName\": \"AI\",\n \"eventTime\": \"2026-03-02T20:53:19Z\",\n \"accountNumber\": \"ACC-0000000001\",\n \"attributes\": [\n {\n \"name\": \"model\",\n \"value\": \"GPT-5\"\n },\n {\n \"name\": \"token\",\n \"value\": \"101\"\n }\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"success": true,
"errorMessage": "<string>",
"successDetails": [
{
"eventId": "<string>"
}
],
"errorDetails": [
{
"eventId": "<string>",
"errorMessage": "<string>"
}
]
}usage event
Ingest usage events
support atomic operation: all or nothing
max number of usage events: 50 per request
POST
/
api
/
usage-events
Ingest usage events
curl --request POST \
--url https://sbx.api.easybilling.cloud/billing/api/usage-events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'trace-id: <trace-id>' \
--data '
[
{
"eventId": "ue-12345",
"schemaName": "AI",
"eventTime": "2026-03-02T20:53:19Z",
"accountNumber": "ACC-0000000001",
"attributes": [
{
"name": "model",
"value": "GPT-5"
},
{
"name": "token",
"value": "101"
}
]
}
]
'import requests
url = "https://sbx.api.easybilling.cloud/billing/api/usage-events"
payload = [
{
"eventId": "ue-12345",
"schemaName": "AI",
"eventTime": "2026-03-02T20:53:19Z",
"accountNumber": "ACC-0000000001",
"attributes": [
{
"name": "model",
"value": "GPT-5"
},
{
"name": "token",
"value": "101"
}
]
}
]
headers = {
"Idempotency-Key": "<idempotency-key>",
"trace-id": "<trace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'trace-id': '<trace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
eventId: 'ue-12345',
schemaName: 'AI',
eventTime: '2026-03-02T20:53:19Z',
accountNumber: 'ACC-0000000001',
attributes: [{name: 'model', value: 'GPT-5'}, {name: 'token', value: '101'}]
}
])
};
fetch('https://sbx.api.easybilling.cloud/billing/api/usage-events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sbx.api.easybilling.cloud/billing/api/usage-events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'eventId' => 'ue-12345',
'schemaName' => 'AI',
'eventTime' => '2026-03-02T20:53:19Z',
'accountNumber' => 'ACC-0000000001',
'attributes' => [
[
'name' => 'model',
'value' => 'GPT-5'
],
[
'name' => 'token',
'value' => '101'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"trace-id: <trace-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sbx.api.easybilling.cloud/billing/api/usage-events"
payload := strings.NewReader("[\n {\n \"eventId\": \"ue-12345\",\n \"schemaName\": \"AI\",\n \"eventTime\": \"2026-03-02T20:53:19Z\",\n \"accountNumber\": \"ACC-0000000001\",\n \"attributes\": [\n {\n \"name\": \"model\",\n \"value\": \"GPT-5\"\n },\n {\n \"name\": \"token\",\n \"value\": \"101\"\n }\n ]\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("trace-id", "<trace-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sbx.api.easybilling.cloud/billing/api/usage-events")
.header("Idempotency-Key", "<idempotency-key>")
.header("trace-id", "<trace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"eventId\": \"ue-12345\",\n \"schemaName\": \"AI\",\n \"eventTime\": \"2026-03-02T20:53:19Z\",\n \"accountNumber\": \"ACC-0000000001\",\n \"attributes\": [\n {\n \"name\": \"model\",\n \"value\": \"GPT-5\"\n },\n {\n \"name\": \"token\",\n \"value\": \"101\"\n }\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://sbx.api.easybilling.cloud/billing/api/usage-events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["trace-id"] = '<trace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"eventId\": \"ue-12345\",\n \"schemaName\": \"AI\",\n \"eventTime\": \"2026-03-02T20:53:19Z\",\n \"accountNumber\": \"ACC-0000000001\",\n \"attributes\": [\n {\n \"name\": \"model\",\n \"value\": \"GPT-5\"\n },\n {\n \"name\": \"token\",\n \"value\": \"101\"\n }\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"success": true,
"errorMessage": "<string>",
"successDetails": [
{
"eventId": "<string>"
}
],
"errorDetails": [
{
"eventId": "<string>",
"errorMessage": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Required array length:
1 - 50 elementsunique id of this usage event
Required string length:
36 - 64the schema you defined in usage event schema for this usage event
time of usage event in ISO format
the customer account consuming this usage
Required array length:
1 - 50 elementsShow child attributes
Show child attributes
⌘I
