Skip to main content

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.
Node.js applications do not require the Sidecar. The Node.js SDK provides full feature parity with the Sidecar, including low-latency entitlement checks, caching, and real-time updates.
Learn more about the Stigg Sidecar service.
Since Sidecar SDK version 3.0.0, the TLS connection method has been deprecated in favor of non-TLS. Please ensure you are running a compatible Sidecar image version 2.494.0 or later. For backwards compatibility details, check the changelog. TLS self-signed certificates will expire on January 26, 2026, so upgrading the Sidecar image is strongly recommended.

Installing the SDK

The first step is to install the Stigg SDK as a dependency in your application:

Retrieving the full access key

In the Stigg app, go to Integrations > API keys. Copy the Full access key of the relevant environment.

Initializing the SDK

Development

For development, first run the Sidecar service using Docker. Run the service with the latest version in the ECR Public Gallery:
Once the Sidecar service is running, you can initialize the SDK with the remote sidecar host and port parameters.

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:
Learn more about running the Sidecar service as separate container.

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.
You can initialize the SDK with 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:
Example JSON:

Checking entitlements

All entitlement methods - getXEntitlement and getEntitlements - remain the same:

Getting the entitlement of a customer to a specific feature

The getEntitlement 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

Reload entitlements for a specific customer

Invalidate the cache and reload entitlements of a customer or customer resource. Note: this method skips the Edge API, so use it only when you need “read-after-write” consistency after entitlements presumably have changed.

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:
  1. Calculated usage - usage that has been aggregated and calculated by your application. This type is useful for features, such as: seats.
  2. 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).
More details about Stigg’s metering and aggregation capabilities can be found here:

Stigg's metering and aggregation capabilities

  1. Reporting of measurements to Stigg should be done only after the relevant resources have been provisioned in your application.
  2. To ensure that the provisioned resources are aligned with the measurements that are reported to Stigg, ensure that customers are not allowed to allocate new resources until an acknowledgement about the processed measurement is received from the Stigg backend.
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

By default, the value reported should represent the change in usage of the feature, for example user added 2 more seats then the report usage call should have the value of 2. In some cases, it’s more useful to set the usage to some value instead of reporting the change value, it’s possible by passing the updateBehavior parameter:

Report in bulks

Calculated usage measurements can also be reported in bulks:

Raw events

It’s also possible to send a batch of events in one invocation.
The dimensions field support key value pairs, while keys are strictly of type string values can be string | number | boolean

Access to additional Stigg APIs

The Sidecar SDK exposes a type-safe generated API client that can be used for send requests to the Stigg API:
You can find all the available API client functions under each SDK language:

PythonPython

RubyRuby

goGo

javaJava

Persistent caching

In order for the cache to survive between restarts or to be shared across multiple instances of the Sidecar service, you can configure the Sidecar to use Redis as a cache provider.

Prerequisites

Run a Persistent Cache Service in a separate process.

SDK configuration

SDK changelog

Sidecar SDK changelog