Skip to main content
The Stigg GraphQL API provides comprehensive access to pricing, entitlement, and subscription management functionality. This guide covers everything you need to get started.

API Playground

Interact with Stigg’s GraphQL API directly from your browser.

Endpoint

POST https://api.stigg.io/graphql

Authentication

All requests require an API key in the X-API-Key header:
curl -X POST https://api.stigg.io/graphql \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"query": "..."}'

GraphQL Basics

Queries

Queries are used to fetch data without side effects:
query GetCustomer($input: GetCustomerByRefIdInput!) {
  getCustomerByRefId(input: $input) {
    customerId
    name
    email
    subscriptions {
      subscriptionId
      status
    }
  }
}

Mutations

Mutations create, update, or delete data:
mutation ProvisionCustomer($input: ProvisionCustomerInput!) {
  provisionCustomer(input: $input) {
    customer {
      customerId
    }
    subscription {
      subscriptionId
    }
  }
}

Variables

Pass variables separately from the query:
{
  "query": "query GetCustomer($input: GetCustomerByRefIdInput!) { ... }",
  "variables": {
    "input": {
      "customerId": "customer-123"
    }
  }
}

Common Patterns

Pagination

List queries use cursor-based pagination:
query ListCustomers {
  customers(
    paging: { first: 10, after: "cursor123" }
  ) {
    edges {
      node {
        customerId
        name
      }
      cursor
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

Filtering

Filter results using the filter parameter:
query ListActiveCustomers {
  customers(
    filter: {
      hasActiveSubscription: { eq: true }
      createdAt: { gte: "2024-01-01T00:00:00Z" }
    }
  ) {
    edges {
      node {
        customerId
      }
    }
  }
}

Sorting

Sort results using the sorting parameter:
query ListCustomersByDate {
  customers(
    sorting: [{ field: createdAt, direction: DESC }]
  ) {
    edges {
      node {
        customerId
        createdAt
      }
    }
  }
}

Error Handling

Errors are returned in the errors array:
{
  "data": null,
  "errors": [
    {
      "message": "Customer not found",
      "extensions": {
        "code": "CUSTOMER_NOT_FOUND",
        "isValidationError": false
      }
    }
  ]
}

Common Error Codes

CodeDescription
UNAUTHENTICATEDInvalid or missing API key
CUSTOMER_NOT_FOUNDCustomer doesn’t exist
SUBSCRIPTION_NOT_FOUNDSubscription doesn’t exist
FEATURE_NOT_FOUNDFeature doesn’t exist
VALIDATION_ERRORInvalid input parameters
ENTITLEMENT_LIMIT_EXCEEDEDUsage would exceed limit

Subscriptions (Real-time)

The API supports GraphQL subscriptions for real-time updates:
subscription EntitlementsUpdated {
  entitlementsUpdated {
    customerId
    entitlements {
      feature {
        refId
      }
      isGranted
    }
  }
}
Available subscriptions:
  • entitlementsUpdated - Customer entitlement changes
  • usageUpdated - Usage updates
  • creditBalanceUpdated - Credit balance changes
  • packagePublished - Package publication events