Importing feature usage is supported only for metered features with a Calculated Usage meter type.
Before importing feature usage, ensure that the relevant customers have been imported to Stigg.
Using the CLI
- Create a file named
usage.json containing the latest usage data for all features. The file must follow this schema:
{
"usages": [
{
"customerId": "lorem-ipsum",
"resourceId": "site-1", // optional - required for multiple subscriptions product
"featureId": "feature-seats",
"usage": 5
}
// ...
]
}
- Initiate the bulk import process:
npx @stigg/bulk-import --usage-file usage.json
The import function is idempotent; therefore, importing usage multiple times will produce the same result.
Using the API and SDKs
Use the reportUsageBulk endpoint and include the updateBehavior: UsageUpdateBehavior.SET property in each usage report.