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.history('featureId', {
customerId: 'customerId',
startDate: '2019-12-27T18:11:19.117Z',
});
console.log(response.data);import os
from datetime import datetime
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.history(
feature_id="featureId",
customer_id="customerId",
start_date=datetime.fromisoformat("2019-12-27T18:11:19.117"),
)
print(response.data)package main
import (
"context"
"fmt"
"time"
"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.History(
context.TODO(),
"featureId",
stigg.V1UsageHistoryParams{
CustomerID: "customerId",
StartDate: time.Now(),
},
)
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.UsageHistoryParams;
import io.stigg.models.v1.usage.UsageHistoryResponse;
import java.time.OffsetDateTime;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
UsageHistoryParams params = UsageHistoryParams.builder()
.customerId("customerId")
.featureId("featureId")
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build();
UsageHistoryResponse response = client.v1().usage().history(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.usage.history("featureId", customer_id: "customerId", start_date: "2019-12-27T18:11:19.117Z")
puts(response)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Usage;
StiggClient client = new();
UsageHistoryParams parameters = new()
{
CustomerID = "customerId",
FeatureID = "featureId",
StartDate = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
};
var response = await client.V1.Usage.History(parameters);
Console.WriteLine(response);stigg v1:usage history \
--api-key 'My API Key' \
--customer-id customerId \
--feature-id featureId \
--start-date "'2019-12-27T18:11:19.117Z'"curl --request GET \
--url https://api.stigg.io/api/v1/usage/{customerId}/history/{featureId} \
--header 'X-API-KEY: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/usage/{customerId}/history/{featureId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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": {
"series": [
{
"tags": [
{
"key": "<string>",
"value": "<string>"
}
],
"points": [
{
"timestamp": "2023-11-07T05:31:56Z",
"value": 123,
"isResetPoint": true
}
]
}
],
"markers": [
{
"type": "PERIODIC_RESET",
"timestamp": "2023-11-07T05:31:56Z"
}
]
}
}{
"message": "<string>",
"code": "BadUserInput",
"reason": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>",
"code": "IdentityForbidden"
}{
"message": "<string>",
"code": "CustomerNotFound"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Get usage history
Retrieves historical usage data for a customer’s metered feature over time.
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.history('featureId', {
customerId: 'customerId',
startDate: '2019-12-27T18:11:19.117Z',
});
console.log(response.data);import os
from datetime import datetime
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.history(
feature_id="featureId",
customer_id="customerId",
start_date=datetime.fromisoformat("2019-12-27T18:11:19.117"),
)
print(response.data)package main
import (
"context"
"fmt"
"time"
"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.History(
context.TODO(),
"featureId",
stigg.V1UsageHistoryParams{
CustomerID: "customerId",
StartDate: time.Now(),
},
)
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.UsageHistoryParams;
import io.stigg.models.v1.usage.UsageHistoryResponse;
import java.time.OffsetDateTime;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
UsageHistoryParams params = UsageHistoryParams.builder()
.customerId("customerId")
.featureId("featureId")
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build();
UsageHistoryResponse response = client.v1().usage().history(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.usage.history("featureId", customer_id: "customerId", start_date: "2019-12-27T18:11:19.117Z")
puts(response)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Usage;
StiggClient client = new();
UsageHistoryParams parameters = new()
{
CustomerID = "customerId",
FeatureID = "featureId",
StartDate = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
};
var response = await client.V1.Usage.History(parameters);
Console.WriteLine(response);stigg v1:usage history \
--api-key 'My API Key' \
--customer-id customerId \
--feature-id featureId \
--start-date "'2019-12-27T18:11:19.117Z'"curl --request GET \
--url https://api.stigg.io/api/v1/usage/{customerId}/history/{featureId} \
--header 'X-API-KEY: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/usage/{customerId}/history/{featureId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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": {
"series": [
{
"tags": [
{
"key": "<string>",
"value": "<string>"
}
],
"points": [
{
"timestamp": "2023-11-07T05:31:56Z",
"value": 123,
"isResetPoint": true
}
]
}
],
"markers": [
{
"type": "PERIODIC_RESET",
"timestamp": "2023-11-07T05:31:56Z"
}
]
}
}{
"message": "<string>",
"code": "BadUserInput",
"reason": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>",
"code": "IdentityForbidden"
}{
"message": "<string>",
"code": "CustomerNotFound"
}{
"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).
Path Parameters
Customer id
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$Feature id
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$Query Parameters
The customer resource this usage applies to. Optional — only required if the customer has multiple resources (for example, one subscription per workspace or site) and usage needs to be tracked separately per resource; omit it to report usage at the customer level.
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$The start date of the range
The end date of the range
Criteria by which to group the usage history
255Response
Usage history data points for the specified period.
Response object
Historical usage time series
Show child attributes
Show child attributes
