NoActiveSubscription.
Core setup
1
Install and initialize the client
Install the Stigg TypeScript client and initialize it with your server-side API key.All examples in the governance docs use this
client instance.2
Define entity types
Entity types are the categories of resource you want to govern, such as The upsert is idempotent, so re-submitting the same payload is safe. You can send up to 100 types per request.
department, team, user, and agent. Define them once per environment. The attributionKeys are the dimension keys your ingest events carry to identify instances of each type.Example response
Example response
3
Provision entities per customer
When a customer creates a department, team, or user in your product, provision the matching entity in governance. Entities belong to a Stigg customer, so pass the customer ID as the first argument.
- You can send up to 100 entities per request. The upsert is idempotent, so it’s safe to re-run during re-syncs.
- Keys in
metadatamerge over existing values. Set a key to""to delete it. Omitmetadatato leave the stored metadata unchanged.
Example response
Example response
4
Create entity entitlements
An entity entitlement sets the usage limit for an entity on a feature or credit. Entity entitlements appear as columns in the customer’s Governance tab in the Stigg app. Your customers usually create them through an in-app interface you build, but you can also set them in code.
- Set either
featureIdfor a feature budget orcurrencyIdfor a credit budget, never both. - An upsert updates the existing entity entitlement with the same
entityId,featureIdorcurrencyId, andscopeEntityIds. Any other combination creates a new one. - On re-upsert, omitting
usageLimitorcadencekeeps the existing value. On first create, both are required. - Set
usageLimittonullto track usage without a limit. Usage still counts and appears in check responses, but never blocks. This is useful for observing usage before you enforce it.
Example response
Example response
Place entities in a hierarchy
TheparentId field places an entity under a parent in the governance hierarchy. Check evaluates every budget on the path from the entity up to the root, and grants a request only when all of them allow it.
parentId is sent on an entity entitlement, but the parent belongs to the entity. An entity has one parent across all its features and credit currencies.
parentId has three states. Omitting it leaves the current parent unchanged, and new entities start at the root. null detaches the entity to the root. An entity ID sets or changes the parent. Only leaf entities can move, so an entity with children stays put.Add dimension-scoped sub-budgets
SetscopeEntityIds to add a tighter budget for a specific context. The scoped budget applies only when every listed entity is in the request’s resolved set.
List and manage
List entity types
List entities
Get a single entity
Archive entities
Archiving is a soft delete. The entity drops out of the list but you can still fetch it by ID. To restore it, upsert it again.{ data: { ids: ['old-project'] } }.
List entity entitlements
What’s next
Check and ingest
Gate access before consumption and record usage after
Query the governance tree
Fetch usage and budget data for dashboards and admin UIs