> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Backend

Stigg provides backend SDKs and APIs that allow you to manage customers, subscriptions, entitlements, and usage reporting from your server-side application.

<Note>
  For the Sidecar SDK (gRPC-based, optimized for low-latency entitlement checks), see the dedicated [Sidecar SDK](/api-and-sdks/integration/backend/sidecar) page.
</Note>

## Authentication

All backend SDKs authenticate using the **Full access key**, which can be found in the Stigg app under [Integrations > API keys](https://app.stigg.io/account/settings).

<Warning>
  The Full access key should only be used in server-side applications and should never be exposed in client-side code.
</Warning>

## Installing the SDK

<CodeGroup>
  ```shell Node.js theme={null}
  npm install @stigg/node-server-sdk
  ```

  ```shell Python theme={null}
  pip install stigg-api-client-v2
  ```

  ```shell Go theme={null}
  go get github.com/stiggio/api-client-go/v3
  ```

  ```shell Ruby theme={null}
  bundle add stigg-api-client
  ```

  ```groovy Java theme={null}
  // Gradle (build.gradle)
  dependencies {
    implementation 'io.stigg:stigg-api-client:+'
    implementation 'com.apollographql.apollo3:apollo-runtime:3.8.2'
    implementation 'com.apollographql.apollo3:apollo-api-jvm:3.8.2'
    implementation 'com.apollographql.apollo3:apollo-adapters-jvm:3.8.2'
  }

  repositories {
    mavenCentral()
  }

  // Maven (pom.xml)
  <dependencies>
  	<dependency>
  		<groupId>io.stigg</groupId>
  		<artifactId>stigg-api-client</artifactId>
  		<version>LATEST</version>
  	</dependency>
  	<dependency>
  		<groupId>com.apollographql.apollo3</groupId>
  		<artifactId>apollo-runtime</artifactId>
  		<version>3.8.2</version>
  	</dependency>
  	<dependency>
  		<groupId>com.apollographql.apollo3</groupId>
  		<artifactId>apollo-api-jvm</artifactId>
  		<version>3.8.2</version>
  	</dependency>
  	<dependency>
  		<groupId>com.apollographql.apollo3</groupId>
  		<artifactId>apollo-adapters-jvm</artifactId>
  		<version>3.8.2</version>
  	</dependency>
  </dependencies>
  ```

  ```shell .NET theme={null}
  dotnet add package Stigg.Api.Client
  ```
</CodeGroup>

## SDK initialization

All SDKs are initialized with the Full access key. The SDK instance should be initialized once per process (singleton pattern) and reused throughout your application, as it maintains an internal cache and supports retries.

<CodeGroup>
  ```javascript Node.js theme={null}
  import { Stigg } from '@stigg/node-server-sdk';

  const stiggClient = Stigg.initialize({ apiKey: 'YOUR_FULL_ACCESS_KEY' });

  export default stiggClient;
  ```

  ```python Python theme={null}
  from stigg import Stigg

  client = Stigg.create_client("STIGG_FULL_ACCESS_KEY")
  ```

  ```go Go theme={null}
  import (
    "context"
    "github.com/stiggio/api-client-go/v3"
    "os"
  )

  func Ptr[T any](v T) *T {
    return &v
  }

  func main() {
    apiKey := os.Getenv("STIGG_FULL_ACCESS_KEY")
    client := stigg.NewStiggClient(apiKey, nil, nil)
  }
  ```

  ```ruby Ruby theme={null}
  require("stigg")

  api_key = ENV["STIGG_FULL_ACCESS_KEY"]
  client = Stigg.create_client(api_key)
  ```

  ```java Java theme={null}
  import io.stigg.api.client.Stigg;

  class App {
      public static void main(String[] ...args) {
          var stigg = Stigg.createClient("<FULL-ACCESS-KEY>");
      }
  }
  ```

  ```c# .NET theme={null}
  using Stigg.Api.Client;

  class App {
      public static void main() {
          var stigg = Stigg.createClient("<FULL-ACCESS-KEY>");
      }
  }
  ```
</CodeGroup>

## Operations

<CardGroup cols={2}>
  <Card title="Customer management" icon="user" href="./backend/customers">
    Provision, update, retrieve, and archive customers
  </Card>

  <Card title="Subscription management" icon="repeat" href="./backend/subscriptions">
    Provision, update, cancel, list, and migrate subscriptions
  </Card>

  <Card title="Entitlement checks" icon="shield-check" href="./backend/entitlements">
    Check feature access and retrieve entitlements
  </Card>

  <Card title="Usage, billing & credits" icon="chart-bar" href="./backend/usage-and-billing">
    Report usage, estimate costs, manage credits and promotions
  </Card>
</CardGroup>

## Products

Retrieve all products configured in Stigg, including display names, descriptions, metadata, and downgrade plan information.

<CodeGroup>
  ```javascript Node.js theme={null}
  const products = await stiggClient.getProducts();
  ```

  ```c# .NET theme={null}
  var resp = await stigg.GetProducts.ExecuteAsync();
  ```
</CodeGroup>

## Real-time updates

The **Node.js Server SDK** supports a streaming connection to receive real-time updates with low latency when customer entitlements or usage change.

Available events:

* **Entitlements updated** - fired when a customer's entitlements change
* **Usage updated** - fired when a customer's usage is updated

<CodeGroup>
  ```javascript Node.js theme={null}
  // listen to customer entitlement updates
  stiggClient.addListener('entitlementsUpdated', (data) => {
    console.log('entitlements updated: ', data.customerId, data.entitlements);
  });

  // listen to customer usage updates
  stiggClient.addListener('usageUpdated', (data) => {
    console.log('entitlement usage updated', data.entitlement, data.usage);
  });
  ```
</CodeGroup>

## Advanced features

### Persistent caching

Configure a persistent cache (Redis) to survive restarts and share cache across multiple instances.

<Card title="Persistent caching" icon="database" horizontal href="/documentation/high-availability-and-scale/persistent-caching" />

### Offline mode

The **Node.js Server SDK** supports offline mode for local development and testing, avoiding network requests to the Stigg API. In offline mode, entitlement evaluations use fallback values.

The **Sidecar SDK (Java)** supports an offline/air-gapped mode for environments with restricted network access, enabling in-memory entitlement evaluation without connecting to a Sidecar process.

### Sidecar service

The Sidecar service provides low-latency entitlement checks, handles caching, and subscribes to real-time entitlement and usage data updates. It can be deployed as a sidecar container or a standalone service.

<Card title="Sidecar service" icon="server" horizontal href="/documentation/high-availability-and-scale/sidecar/overview" />

## SDK references

<CardGroup cols={2}>
  <Card title="Node.js SDK" icon="code" href="https://node-sdk-docs.stigg.io/classes/stigg">
    Full reference for the Node.js Server SDK
  </Card>

  <Card title="Python SDK" icon="code" href="https://python-sdk-docs.stigg.io/stigg.client.StiggClient">
    Full reference for the Python API client
  </Card>

  <Card title="Go SDK" icon="code" href="https://pkg.go.dev/github.com/stiggio/api-client-go/v5">
    Full reference for the Go API client
  </Card>

  <Card title="GraphQL API" icon="code" href="https://studio.apollographql.com/public/Stigg-API/variant/Production/explorer">
    Interactive GraphQL API playground
  </Card>
</CardGroup>

## SDK changelogs

<CardGroup cols={2}>
  <Card title="Node.js" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/node">
    Node.js SDK changelog
  </Card>

  <Card title="Python" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/python">
    Python SDK changelog
  </Card>

  <Card title="Ruby" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/ruby">
    Ruby SDK changelog
  </Card>

  <Card title="Go" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/go">
    Go SDK changelog
  </Card>

  <Card title="Java" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/java">
    Java SDK changelog
  </Card>

  <Card title=".NET" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/dotnet">
    .NET SDK changelog
  </Card>

  <Card title="Sidecar" icon="list-timeline" href="/api-and-sdks/changelog/backend-graphql/sidecar">
    Sidecar SDK changelog
  </Card>
</CardGroup>
