Skip to main content
GET
/
api
/
v1
/
usage
/
{customerId}
/
history
/
{featureId}
JavaScript
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": [
      {
        "timestamp": "2023-11-07T05:31:56Z"
      }
    ]
  }
}
{
"message": "<string>"
}
{
"message": "<string>",
"code": "Unauthenticated"
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>",
"code": "RateLimitExceeded"
}

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-ACCOUNT-ID
string

Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.

X-ENVIRONMENT-ID
string

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

customerId
string
required

Customer id

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$
featureId
string
required

Feature id

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$

Query Parameters

resourceId
string | null

Resource id

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$
startDate
string<date-time>
required

The start date of the range

endDate
string<date-time>

The end date of the range

groupBy
string

Criteria by which to group the usage history

Maximum string length: 255

Response

Usage history data points for the specified period.

Response object

data
UsageHistory · object
required

Historical usage time series