> ## 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.

# Resource-specific credit pools

Resource-specific credit pools let you isolate credit balances, ledgers, and auto-recharge configurations for individual customer resources — such as workspaces, projects, or individual team members — within a single billing account.

Without resource isolation, all credits for a customer are drawn from one shared pool. With resource-specific pools, each resource gets its own wallet that can only be funded and consumed independently.

## How it works

When you provision a subscription and assign it to a specific resource by passing a `resourceId`, Stigg automatically creates an isolated credit pool for that resource. The resource pool operates as a fully independent wallet:

* **Dedicated credit grants** — credits awarded or sold are locked to that resource and cannot be shared with other resources or the global pool.
* **Isolated credit ledger** — every grant, consumption, and expiry is tracked separately, giving a precise audit trail per resource.
* **Independent credit pools** — a low balance or depletion on one resource does not draw from or affect another resource's pool.

<Frame caption="Resource ID filter in the Credits tab showing resource-scoped pool">
  <img src="https://mintcdn.com/stigg/-OizVNAUe4vspCwF/images/docs/credits-resource-pools.png?fit=max&auto=format&n=-OizVNAUe4vspCwF&q=85&s=e2233737bdf6307c7e10cf61ef731a84" width="2400" height="827" data-path="images/docs/credits-resource-pools.png" />
</Frame>

## Use cases

* **Per-workspace pools** — in a B2B product where each customer has multiple workspaces, prevent one active workspace from draining the balance of all others.
* **Per-user pools** — give each team member a dedicated credit quota (e.g., 1,000 credits/month each) that cannot be consumed by colleagues.
* **Per-API-key pools** — enforce spending boundaries at the API key or integration level, not just at the account level.

## Get started

Resource-level credit pools require no manual initialization. They are created automatically when you provision a subscription with a `resourceId`.

### Provision a subscription with a resource

Pass the `resourceId` when provisioning a subscription:

<CodeGroup>
  ```typescript TypeScript theme={null}
  const subscription = await stiggClient.provisionSubscription({
    customerId: 'customer-demo-01',
    planId: 'plan-basic',
    resourceId: 'workspace-example-com',
  });
  ```

  ```python Python theme={null}
  subscription = stigg_client.provision_subscription(
      customer_id='customer-demo-01',
      plan_id='plan-basic',
      resource_id='workspace-example-com',
  )
  ```
</CodeGroup>

Once provisioned, Stigg automatically creates a resource-scoped credit pool for `workspace-example-com`.

### Grant credits to a resource pool

Pass the `resourceId` when creating a credit grant:

<CodeGroup>
  ```typescript TypeScript theme={null}
  await stiggClient.grantCredits({
    customerId: 'customer-demo-01',
    resourceId: 'workspace-example-com',
    creditTypeId: 'ai-tokens',
    amount: 5000,
  });
  ```

  ```python Python theme={null}
  stigg_client.grant_credits(
      customer_id='customer-demo-01',
      resource_id='workspace-example-com',
      credit_type_id='ai-tokens',
      amount=5000,
  )
  ```
</CodeGroup>

### Report usage against a resource pool

Pass the `resourceId` when reporting usage events so that deductions are made from the correct resource pool:

<CodeGroup>
  ```typescript TypeScript theme={null}
  await stiggClient.reportUsage({
    customerId: 'customer-demo-01',
    resourceId: 'workspace-example-com',
    featureId: 'feature-ai-tokens',
    value: 150,
  });
  ```

  ```python Python theme={null}
  stigg_client.report_usage(
      customer_id='customer-demo-01',
      resource_id='workspace-example-com',
      feature_id='feature-ai-tokens',
      value=150,
  )
  ```
</CodeGroup>

## Viewing resource pools in the Stigg app

In the **Customers** page, open a customer and go to the **Credits** tab. The **Resource ID** dropdown at the top lets you switch between the global pool and each resource-specific pool. Selecting a resource scopes all views — usage overview, usage chart, and ledger — to that resource's isolated wallet.

The **Subscription** view for a resource-specific subscription also displays the dedicated credit pool history and auto-recharge status inline.

## Auto-recharge

Auto-recharge is configured at the customer and credit currency level. A single auto-recharge policy covers all credit pools for that customer and currency, including resource-scoped pools.

See [Configuring auto-recharge](./auto-recharge/configuring-auto-recharge) for setup steps.

<Note>
  Resource-specific credit pools do not share credits with the global pool or with other resource pools under the same customer. A low balance on one resource will not draw from another resource's pool.
</Note>
