Overview
The Sidecar SDK is used to interact with the Stigg Sidecar Service, which provides low latency entitlement checks, handles caching, and subscribes to real-time entitlement and usage data updates.Installing the SDK
The first step is to install the Stigg SDK as a dependency in your application:Retrieving the server API Key
In the Stigg app, go to Settings -> Account -> Environments. Copy the Server API key of the relevant environment.Initializing the SDK
Development
Import the Stigg SDK and initialize it with your environment API key:Production
For production use, its recommended to deploy the Sidecar service using the sidecar pattern, or as a standalone service. You set the remote sidecar host and port parameters as part of the SDK initialization:Running in offline or air-gapped environments
In air-gapped or highly secure environments where the Sidecar service cannot be deployed, you can use the Sidecar SDK in offline mode. This mode enables entitlement evaluation entirely in-memory without connecting to a remote or local Sidecar process. Offline mode is ideal for:- Air-gapped deployments
- Environments with restricted network access
- Testing with predefined entitlement data
The Offline mode is only available in Java SDK (v2.420.0+). This mode supports all entitlement types (boolean, numeric, metered). Usage and event reporting (
reportUsage, reportEvents) are disabled in the offline mode.OfflineStiggConfig, supplying a customer-to-entitlements mapping either programmatically or via a JSON string.
Initializing with programmatic config
You can pass static entitlement data directly as Java objects:Initializing from a JSON string
You can also load entitlements from a JSON string:Checking entitlements
All entitlement methods -getXEntitlement and getEntitlements - remain the same:
Getting the entitlement of a customer to a specific feature
Generic entitlement check (recommended)
ThegetEntitlement method provides a unified way to check any type of feature entitlement. It automatically returns the appropriate entitlement type based on the feature configuration.
The generic
getEntitlement method is the recommended approach for checking feature entitlements as it provides a unified interface and automatically handles all entitlement types. For metered features, you can also pass a requestedUsage parameter to proactively check if additional usage would be allowed.Checking the entitlement of a boolean feature
Checking the entitlement of a numeric configuration feature
Checking if a customer has access to a metered feature
Proactively checking if a customer will have access to X units of a metered feature
Getting all of the entitlements for a specific customer
Reporting usage measurements to Stigg
The Stigg SDK allows you to report usage measurements for metered features. The reported usage will be used to track, limit and bill the customer’s usage of metered features. Stigg supports metering of usage from the following data sources:- Calculated usage - usage that has been aggregated and calculated by your application. This type is useful for features, such as: seats.
- Raw events - raw events from your application, which Stigg filters and aggregates aggregate to calculate customer usage. This type is useful for features, such as: monthly active users (MAUs).
Stigg's metering and aggregation capabilities
Validating that a measurement was successfully reported to Stigg is also possible in the customer details section of the relevant customer in the Stigg app.
Calculated usage
updateBehavior parameter:
