import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const response = await client.v1.usage.report({
usages: [
{
customerId: 'customerId',
featureId: 'featureId',
value: -9007199254740991,
},
],
});
console.log(response.data);import os
from stigg import Stigg
client = Stigg(
api_key=os.environ.get("STIGG_API_KEY"), # This is the default and can be omitted
)
response = client.v1.usage.report(
usages=[{
"customer_id": "customerId",
"feature_id": "featureId",
"value": -9007199254740991,
}],
)
print(response.data)package main
import (
"context"
"fmt"
"github.com/stiggio/stigg-go"
"github.com/stiggio/stigg-go/option"
)
func main() {
client := stigg.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.V1.Usage.Report(context.TODO(), stigg.V1UsageReportParams{
Usages: []stigg.V1UsageReportParamsUsage{{
CustomerID: "customerId",
FeatureID: "featureId",
Value: -9007199254740991,
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package io.stigg.example;
import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.usage.UsageReportParams;
import io.stigg.models.v1.usage.UsageReportResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
UsageReportParams params = UsageReportParams.builder()
.addUsage(UsageReportParams.Usage.builder()
.customerId("customerId")
.featureId("featureId")
.value(-9007199254740991L)
.build())
.build();
UsageReportResponse response = client.v1().usage().report(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.usage.report(
usages: [{customerId: "customerId", featureId: "featureId", value: -9007199254740991}]
)
puts(response)using System;
using System.Collections.Generic;
using Stigg.Client;
using Stigg.Client.Models.V1.Usage;
StiggClient client = new();
UsageReportParams parameters = new()
{
Usages =
[
new()
{
CustomerID = "customerId",
FeatureID = "featureId",
Value = -9007199254740991,
CreatedAt = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
Dimensions = new Dictionary<string, Dimension>()
{
{ "foo", "string" }
},
IdempotencyKey = "x",
ResourceID = "resourceId",
UpdateBehavior = UpdateBehavior.Delta,
},
],
};
var response = await client.V1.Usage.Report(parameters);
Console.WriteLine(response);stigg v1:usage report \
--api-key 'My API Key' \
--usage '{customerId: customerId, featureId: featureId, value: -9007199254740991}'curl --request POST \
--url https://api.stigg.io/api/v1/usage \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"usages": [
{
"value": -9007199254740990,
"featureId": "<string>",
"customerId": "<string>",
"resourceId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updateBehavior": "DELTA",
"dimensions": {},
"idempotencyKey": "<string>"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/usage",
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([
'usages' => [
[
'value' => -9007199254740990,
'featureId' => '<string>',
'customerId' => '<string>',
'resourceId' => '<string>',
'createdAt' => '2023-11-07T05:31:56Z',
'updateBehavior' => 'DELTA',
'dimensions' => [
],
'idempotencyKey' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": [
{
"id": "<string>",
"value": -9007199254740990,
"timestamp": "2023-11-07T05:31:56Z",
"featureId": "<string>",
"customerId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currentUsage": 123,
"credit": {
"currencyId": "<string>",
"currentUsage": 123,
"usageLimit": 123,
"timestamp": "2023-11-07T05:31:56Z",
"usagePeriodEnd": "2023-11-07T05:31:56Z"
},
"usagePeriodStart": "2023-11-07T05:31:56Z",
"usagePeriodEnd": "2023-11-07T05:31:56Z",
"nextResetDate": "2023-11-07T05:31:56Z",
"resourceId": "<string>"
}
]
}{
"message": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Report Usage
Reports usage measurements for metered features. The reported usage is used to track, limit, and bill customer consumption.
import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const response = await client.v1.usage.report({
usages: [
{
customerId: 'customerId',
featureId: 'featureId',
value: -9007199254740991,
},
],
});
console.log(response.data);import os
from stigg import Stigg
client = Stigg(
api_key=os.environ.get("STIGG_API_KEY"), # This is the default and can be omitted
)
response = client.v1.usage.report(
usages=[{
"customer_id": "customerId",
"feature_id": "featureId",
"value": -9007199254740991,
}],
)
print(response.data)package main
import (
"context"
"fmt"
"github.com/stiggio/stigg-go"
"github.com/stiggio/stigg-go/option"
)
func main() {
client := stigg.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.V1.Usage.Report(context.TODO(), stigg.V1UsageReportParams{
Usages: []stigg.V1UsageReportParamsUsage{{
CustomerID: "customerId",
FeatureID: "featureId",
Value: -9007199254740991,
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package io.stigg.example;
import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.usage.UsageReportParams;
import io.stigg.models.v1.usage.UsageReportResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
UsageReportParams params = UsageReportParams.builder()
.addUsage(UsageReportParams.Usage.builder()
.customerId("customerId")
.featureId("featureId")
.value(-9007199254740991L)
.build())
.build();
UsageReportResponse response = client.v1().usage().report(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.usage.report(
usages: [{customerId: "customerId", featureId: "featureId", value: -9007199254740991}]
)
puts(response)using System;
using System.Collections.Generic;
using Stigg.Client;
using Stigg.Client.Models.V1.Usage;
StiggClient client = new();
UsageReportParams parameters = new()
{
Usages =
[
new()
{
CustomerID = "customerId",
FeatureID = "featureId",
Value = -9007199254740991,
CreatedAt = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
Dimensions = new Dictionary<string, Dimension>()
{
{ "foo", "string" }
},
IdempotencyKey = "x",
ResourceID = "resourceId",
UpdateBehavior = UpdateBehavior.Delta,
},
],
};
var response = await client.V1.Usage.Report(parameters);
Console.WriteLine(response);stigg v1:usage report \
--api-key 'My API Key' \
--usage '{customerId: customerId, featureId: featureId, value: -9007199254740991}'curl --request POST \
--url https://api.stigg.io/api/v1/usage \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"usages": [
{
"value": -9007199254740990,
"featureId": "<string>",
"customerId": "<string>",
"resourceId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updateBehavior": "DELTA",
"dimensions": {},
"idempotencyKey": "<string>"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/usage",
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([
'usages' => [
[
'value' => -9007199254740990,
'featureId' => '<string>',
'customerId' => '<string>',
'resourceId' => '<string>',
'createdAt' => '2023-11-07T05:31:56Z',
'updateBehavior' => 'DELTA',
'dimensions' => [
],
'idempotencyKey' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": [
{
"id": "<string>",
"value": -9007199254740990,
"timestamp": "2023-11-07T05:31:56Z",
"featureId": "<string>",
"customerId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currentUsage": 123,
"credit": {
"currencyId": "<string>",
"currentUsage": 123,
"usageLimit": 123,
"timestamp": "2023-11-07T05:31:56Z",
"usagePeriodEnd": "2023-11-07T05:31:56Z"
},
"usagePeriodStart": "2023-11-07T05:31:56Z",
"usagePeriodEnd": "2023-11-07T05:31:56Z",
"nextResetDate": "2023-11-07T05:31:56Z",
"resourceId": "<string>"
}
]
}{
"message": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Authorizations
Server API Key
Headers
Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.
Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).
Body
Report usage for metered features. Batch up to 100 records.
A list of usage reports to be submitted in bulk
1 - 100 elementsShow child attributes
Show child attributes
Response
The recorded usage measurement objects.
Response containing reported usage measurements with current usage values, period information, and reset dates for each measurement.
Array of usage measurements with current values and period info
Show child attributes
Show child attributes
