Stigg Product Catalog Management
This skill enables management of Stigg's product catalog through the GraphQL API.
Prerequisites
- •Stigg API key with appropriate permissions
- •Access to Stigg's GraphQL endpoint:
https://api.stigg.io/graphql
Authentication
All requests require the X-API-KEY header:
curl -X POST https://api.stigg.io/graphql \
-H "Content-Type: application/json" \
-H "X-API-KEY: $STIGG_API_KEY" \
-d '{"query": "..."}'
Critical Requirements
1. Always Preview Changes Before Applying
MANDATORY: Before executing any mergeEnvironment mutation that modifies an environment, you MUST:
- •Run
dumpEnvironmentForMergeComparisonto get the pre-merge and post-merge states - •Present a clear summary of the changes to the user (what will be added, modified, or removed)
- •Wait for explicit user confirmation before proceeding
- •Only execute the merge if the user approves the changes
Never apply changes without showing the preview first and receiving user approval.
2. Migration Type Selection
The migrationType field determines how existing customer subscriptions are affected:
- •
NEW_CUSTOMERS(default) - Changes only apply to new subscriptions; existing customers keep their current plan versions - •
ALL_CUSTOMERS- Migrate all existing customers to the new plan versions
MANDATORY: If the user has not explicitly specified the migration type:
- •Default to
NEW_CUSTOMERSin your preview - •Ask the user which migration type they want before executing the merge
- •Explain the difference between the options
- •Do NOT assume
ALL_CUSTOMERSwithout explicit user confirmation
Core Operations
1. List Environments
Fetch all environments in the account:
query {
environments(paging: { first: 25 }) {
edges {
node {
id
slug
displayName
type
description
isSandbox
provisionStatus
createdAt
}
}
}
}
Environment types: DEVELOPMENT, PRODUCTION, SANDBOX
2. Dump Product Catalog
Export the complete product catalog of an environment as JSON:
query DumpCatalog($input: DumpEnvironmentProductCatalogInput!) {
dumpEnvironmentProductCatalog(input: $input) {
dump
}
}
Variables:
{
"input": {
"environmentSlug": "development"
}
}
The dump contains: products, plans, addons, features, featureGroups, coupons, customCurrencies, packageGroups, widgetConfiguration, workflows
3. Preview Merge Changes (Diff)
Compare source and destination environments before merging:
query PreviewMerge($input: DumpEnvironmentForForMergeComparisonInput!) {
dumpEnvironmentForMergeComparison(input: $input) {
preMergeDump
postMergeDump
}
}
Variables:
{
"input": {
"sourceEnvironmentSlug": "development",
"destinationEnvironmentSlug": "production",
"mergeConfiguration": {
"includeCoupons": true
}
}
}
Use this to show users what will change before executing the merge.
4. Merge Environments
The mergeEnvironment mutation supports three use cases:
A. Merge from Source Environment to Destination Environment
mutation MergeEnvToEnv($input: MergeEnvironmentInput!) {
mergeEnvironment(input: $input) {
environmentSlug
taskIds
}
}
Variables:
{
"input": {
"sourceEnvironmentSlug": "development",
"destinationEnvironmentSlug": "production",
"mergeConfiguration": {
"includeCoupons": true
},
"migrationType": "NEW_CUSTOMERS"
}
}
B. Create New Environment from Source Environment
Omit destinationEnvironmentSlug to create a new environment:
{
"input": {
"sourceEnvironmentSlug": "development",
"destinationEnvironmentName": "staging",
"destinationEnvironmentType": "DEVELOPMENT"
}
}
C. Create/Update Environment from JSON Template
Use sourceTemplate instead of sourceEnvironmentSlug to apply a JSON catalog:
{
"input": {
"sourceTemplate": {
/* product catalog JSON */
},
"destinationEnvironmentSlug": "development"
}
}
Or create a new environment from JSON:
{
"input": {
"sourceTemplate": {
/* product catalog JSON */
},
"destinationEnvironmentName": "new-environment",
"destinationEnvironmentType": "DEVELOPMENT"
}
}
Migration Types
When merging, migrationType controls how existing customers are handled:
- •
NEW_CUSTOMERS(default) - Changes only apply to new subscriptions; existing customers keep their current plan versions - •
ALL_CUSTOMERS- Migrate all existing customers to the new plan versions
Important: Always ask the user which migration type they want if not explicitly specified. Do not assume.
Product Catalog JSON Structure
The catalog JSON has these top-level keys:
{
"products": {},
"plans": {},
"addons": {},
"features": {},
"featureGroups": {},
"coupons": {},
"customCurrencies": {},
"packageGroups": {},
"widgetConfiguration": {},
"workflows": {}
}
Key Concepts
Products - Container for plans, the billing entity
- •
refId: Unique identifier (e.g., "product-revvenu") - •
displayName: Human-readable name - •
status:PUBLISHEDorDRAFT - •
productSettings: Subscription behavior settings
Plans - Pricing tiers within a product
- •
refId: Unique identifier (e.g., "plan-basic") - •
pricingType:FREE,PAID, orCUSTOM - •
prices: Pricing configuration by billing model - •
packageEntitlements: Features included in the plan - •
parentPlanRefId: For plan inheritance - •
compatibleAddonRefIds: Add-ons that can be purchased with this plan
Features - Capabilities that can be entitled
- •
featureType:BOOLEAN,NUMBER, orENUM - •
meterType:INCREMENTAL,FLUCTUATING, orNone - •
featureUnits/featureUnitsPlural: Display units
Add-ons - Purchasable extras for plans
- •Same structure as plans
- •Linked via
compatibleAddonRefIdson plans
Prices - Billing configuration
- •
billingModel:FLAT_FEE,PER_UNIT, orUSAGE_BASED - •
billingPeriod:MONTHLYorANNUALLY - •
billingCadence:RECURRINGorONE_TIME
See references/catalog-schema.md for complete schema details.
Common Workflows
Export Catalog to File
- •Query
dumpEnvironmentProductCatalog - •Save the
dumpJSON to a file - •The file can be version-controlled or used as a template
Promote Changes to Production
- •Query
dumpEnvironmentForMergeComparisonto preview changes - •Present a clear summary of what will be added, modified, or removed
- •Ask the user which
migrationTypethey want (NEW_CUSTOMERSorALL_CUSTOMERS) if not already specified - •Wait for explicit user approval before proceeding
- •Only if approved, run
mergeEnvironmentmutation with the confirmed settings
Create Environment from Template
- •Load the JSON template file
- •Run
mergeEnvironmentwithsourceTemplateand target environment
Compare Two Environments
- •Dump both environments using
dumpEnvironmentProductCatalog - •Compare the JSON structures
- •Highlight differences in products, plans, features, and prices
Helper Script
The scripts/stigg_api.py script provides a CLI for common operations:
# Set API key export STIGG_API_KEY="your-api-key" # List environments python scripts/stigg_api.py list-environments # Dump catalog to file python scripts/stigg_api.py dump-catalog --env development --output catalog.json # Preview merge python scripts/stigg_api.py preview-merge --source development --dest production # Merge environments python scripts/stigg_api.py merge --source development --dest production # Create environment from template python scripts/stigg_api.py merge --template catalog.json --new-env staging --type DEVELOPMENT # Apply template to existing environment python scripts/stigg_api.py merge --template catalog.json --dest development
Best Practices
- •Always preview changes with
dumpEnvironmentForMergeComparisonbefore merging and get user confirmation - •Always ask about migration type if the user hasn't specified - default to
NEW_CUSTOMERSbut confirm with the user - •Keep product catalog JSON files in version control
- •Test changes in development/staging before production