Documentation
Documentation
https://docs.stigg.io/api-and-sdks/integration/backend/graphql
Documentation
https://docs.stigg.io/api-and-sdks/integration/overview
openapi: 3.0.3
info:
title: Stigg Coupons Subscriptions API
description: Stigg is a pricing and packaging platform providing feature management, entitlements, and usage-based billing for SaaS and API products. The Stigg API exposes GraphQL and REST endpoints for customer provisioning, subscription management, entitlement checking, and usage reporting. Authentication requires a Full access key passed via the X-API-KEY header.
version: '1.0'
contact:
url: https://www.stigg.io/
termsOfService: https://www.stigg.io/terms
servers:
- url: https://api.stigg.io
description: Stigg Production API
security:
- ApiKey: []
tags:
- name: Subscriptions
description: Subscription lifecycle management.
paths:
/graphql:
post:
operationId: executeGraphQL
summary: Execute GraphQL Query or Mutation
description: Execute any Stigg GraphQL query or mutation. Stigg uses GraphQL as its primary API. Send a JSON body with a query/mutation string and optional variables. Supports customer management, subscription operations, entitlement checks, and usage reporting.
tags:
- Subscriptions
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/GraphQLRequest'
examples:
provisionCustomer:
summary: Provision a Customer
value:
query: "mutation ProvisionCustomer($input: ProvisionCustomerInput!) {\n provisionCustomer(input: $input) {\n customer { id name email }\n subscription { id status plan { id name } }\n }\n}\n"
variables:
input:
customerId: customer-123
name: Acme Corp
email: admin@acme.com
checkEntitlement:
summary: Check Feature Entitlement
value:
query: "query GetCustomerEntitlement($customerId: String!, $featureId: String!) {\n customerEntitlement(customerId: $customerId, featureId: $featureId) {\n isGranted\n usageLimit\n currentUsage\n resetPeriod\n }\n}\n"
variables:
customerId: customer-123
featureId: feature-api-calls
reportUsage:
summary: Report Feature Usage
value:
query: "mutation ReportUsage($input: ReportUsageInput!) {\n reportUsage(input: $input) { id }\n}\n"
variables:
input:
customerId: customer-123
featureId: feature-api-calls
value: 100
responses:
'200':
description: GraphQL response (may contain data or errors).
content:
application/json:
schema:
$ref: '#/components/schemas/GraphQLResponse'
'401':
description: Invalid or missing X-API-KEY header.
/api/v1/subscriptions:
post:
tags:
- Subscriptions
summary: Provision subscription
description: Creates a new subscription for an existing customer. When payment is required and no payment method exists, returns a checkout URL.
operationId: SubscriptionController_provisionSubscription
parameters:
- name: X-ACCOUNT-ID
in: header
required: false
schema:
type: string
- name: X-ENVIRONMENT-ID
in: header
required: false
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ProvisionSubscriptionRequestDto'
examples:
basic:
summary: Provision a subscription
value:
customerId: customer-123
planId: plan-pro
responses:
'201':
description: The newly created subscription object.
content:
application/json:
schema:
$ref: '#/components/schemas/SubscriptionResponseDto'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/BadInputErrorResponseDto'
'401':
description: User is not authenticated.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedErrorResponseDto'
'403':
description: User is not allowed to access this resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ForbiddenErrorResponseDto'
'409':
description: Subscription conflict error.
content:
application/json:
schema:
$ref: '#/components/schemas/ConflictErrorResponseDto'
'429':
description: Too many requests.
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequestsErrorResponseDto'
get:
tags:
- Subscriptions
summary: List subscriptions
description: Retrieves a paginated list of subscriptions, with optional filters for customer, status, and plan.
operationId: SubscriptionController_getSubscriptions
parameters:
- name: after
required: false
in: query
schema:
format: uuid
type: string
- name: before
required: false
in: query
schema:
format: uuid
type: string
- name: limit
required: false
in: query
schema:
minimum: 1
maximum: 100
default: 20
type: integer
- name: customerId
required: false
in: query
description: Filter by customer ID
schema:
type: string
- name: status
required: false
in: query
description: Filter by subscription status
schema:
type: string
enum:
- active
- canceled
- trial
- paused
- name: X-ACCOUNT-ID
in: header
required: false
schema:
type: string
- name: X-ENVIRONMENT-ID
in: header
required: false
schema:
type: string
responses:
'200':
description: A paginated list of subscription objects.
content:
application/json:
schema:
$ref: '#/components/schemas/SubscriptionListResponseDto'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/BadInputErrorResponseDto'
'401':
description: User is not authenticated.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedErrorResponseDto'
'403':
description: User is not allowed to access this resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ForbiddenErrorResponseDto'
'429':
description: Too many requests.
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequestsErrorResponseDto'
/api/v1/subscriptions/{id}:
get:
tags:
- Subscriptions
summary: Get subscription by ID
description: Retrieves a subscription by its unique identifier, including plan details, billing period, status, and add-ons.
operationId: SubscriptionController_getSubscription
parameters:
- name: id
required: true
in: path
description: The unique identifier of the subscription
schema:
minLength: 1
maxLength: 255
type: string
- name: X-ACCOUNT-ID
in: header
required: false
schema:
type: string
- name: X-ENVIRONMENT-ID
in: header
required: false
schema:
type: string
responses:
'200':
description: The subscription object.
content:
application/json:
schema:
$ref: '#/components/schemas/SubscriptionResponseDto'
'401':
description: User is not authenticated.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedErrorResponseDto'
'403':
description: User is not allowed to access this resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ForbiddenErrorResponseDto'
'404':
description: Subscription not found.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundErrorResponseDto'
'429':
description: Too many requests.
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequestsErrorResponseDto'
/api/v1/subscriptions/{id}/cancel:
post:
tags:
- Subscriptions
summary: Cancel subscription
description: Cancels an active subscription, either immediately or at a specified time such as end of billing period.
operationId: SubscriptionController_cancelSubscription
parameters:
- name: id
required: true
in: path
description: The unique identifier of the subscription
schema:
minLength: 1
maxLength: 255
type: string
- name: X-ACCOUNT-ID
in: header
required: false
schema:
type: string
- name: X-ENVIRONMENT-ID
in: header
required: false
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/CancelSubscriptionRequestDto'
responses:
'200':
description: The canceled subscription object.
content:
application/json:
schema:
$ref: '#/components/schemas/SubscriptionResponseDto'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/BadInputErrorResponseDto'
'401':
description: User is not authenticated.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedErrorResponseDto'
'403':
description: User is not allowed to access this resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ForbiddenErrorResponseDto'
'404':
description: Subscription not found.
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundErrorResponseDto'
'429':
description: Too many requests.
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequestsErrorResponseDto'
/api/v1/subscriptions/preview:
post:
tags:
- Subscriptions
summary: Preview subscription
description: Previews the pricing impact of creating or updating a subscription without making changes. Returns estimated costs, taxes, and proration details.
operationId: SubscriptionController_previewSubscription
parameters:
- name: X-ACCOUNT-ID
in: header
required: false
schema:
type: string
- name: X-ENVIRONMENT-ID
in: header
required: false
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PreviewSubscriptionRequestDto'
responses:
'200':
description: Subscription pricing preview.
content:
application/json:
schema:
$ref: '#/components/schemas/PreviewSubscriptionResponseDto'
'400':
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/BadInputErrorResponseDto'
'401':
description: User is not authenticated.
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthenticatedErrorResponseDto'
'403':
description: User is not allowed to access this resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ForbiddenErrorResponseDto'
'429':
description: Too many requests.
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequestsErrorResponseDto'
components:
schemas:
GraphQLResponse:
type: object
properties:
data:
type: object
description: Response data from the GraphQL operation.
additionalProperties: true
errors:
type: array
description: Array of GraphQL errors if any occurred.
items:
$ref: '#/components/schemas/GraphQLError'
SubscriptionListResponseDto:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/SubscriptionDto'
pagination:
$ref: '#/components/schemas/PaginationDto'
required:
- data
- pagination
description: Paginated list of subscriptions.
SubscriptionResponseDto:
type: object
properties:
data:
$ref: '#/components/schemas/SubscriptionDto'
required:
- data
description: Single subscription response.
NotFoundErrorResponseDto:
type: object
properties:
message:
type: string
code:
type: string
nullable: true
required:
- message
- code
description: Resource not found error response.
PreviewSubscriptionResponseDto:
type: object
properties:
data:
type: object
properties:
immediateInvoice:
type: object
properties:
total:
type: number
description: Total invoice amount.
subtotal:
type: number
description: Subtotal before tax.
tax:
type: number
description: Tax amount.
currency:
type: string
description: Invoice currency code.
description: Immediate invoice details.
nextInvoice:
type: object
properties:
total:
type: number
subtotal:
type: number
tax:
type: number
currency:
type: string
description: Next recurring invoice details.
description: Subscription pricing preview response.
TooManyRequestsErrorResponseDto:
type: object
properties:
message:
type: string
code:
type: string
enum:
- RateLimitExceeded
nullable: true
required:
- message
- code
description: Rate limit exceeded error response.
SubscriptionDto:
type: object
properties:
id:
type: string
description: Unique subscription identifier.
customerId:
type: string
description: The customer this subscription belongs to.
planId:
type: string
description: The plan this subscription is for.
status:
type: string
enum:
- ACTIVE
- CANCELED
- TRIAL
- PAUSED
- IN_TRIAL
description: Subscription lifecycle status.
billingPeriod:
type: string
enum:
- MONTHLY
- ANNUALLY
description: Billing recurrence period.
startDate:
type: string
format: date-time
description: Subscription start date.
endDate:
type: string
format: date-time
description: Subscription end date (if applicable).
nullable: true
trialEndDate:
type: string
format: date-time
description: Trial period end date.
nullable: true
addons:
type: array
items:
$ref: '#/components/schemas/AddonDto'
description: Add-ons attached to this subscription.
metadata:
type: object
additionalProperties:
type: string
description: Additional metadata.
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- id
- customerId
- planId
- status
- createdAt
- updatedAt
description: A subscription linking a customer to a pricing plan.
GraphQLRequest:
type: object
required:
- query
properties:
query:
type: string
description: GraphQL query or mutation string.
variables:
type: object
description: Variables for the GraphQL operation.
additionalProperties: true
operationName:
type: string
description: Named operation to execute when the document contains multiple.
GraphQLError:
type: object
properties:
message:
type: string
description: Human-readable error message.
locations:
type: array
items:
type: object
properties:
line:
type: integer
column:
type: integer
path:
type: array
items:
type: string
extensions:
type: object
additionalProperties: true
ProvisionSubscriptionRequestDto:
type: object
properties:
customerId:
type: string
description: The ID of the customer to provision the subscription for.
planId:
type: string
description: The ID of the plan to subscribe the customer to.
billingPeriod:
type: string
enum:
- MONTHLY
- ANNUALLY
description: Billing recurrence period.
addons:
type: array
items:
$ref: '#/components/schemas/AddonDto'
description: Add-ons to include in the subscription.
startDate:
type: string
format: date-time
description: When the subscription should start (defaults to now).
nullable: true
trialPeriodDays:
type: integer
description: Number of trial days before billing begins.
nullable: true
metadata:
type: object
additionalProperties:
type: string
description: Additional metadata.
required:
- customerId
- planId
additionalProperties: false
description: Creates a new subscription for an existing customer.
ForbiddenErrorResponseDto:
type: object
properties:
message:
type: string
code:
type: string
enum:
- IdentityForbidden
- AccessDeniedError
- NoFeatureEntitlementError
nullable: true
required:
- message
- code
description: Authorization error response.
CancelSubscriptionRequestDto:
type: object
properties:
endDate:
type: string
format: date-time
description: When to cancel the subscription (defaults to immediate cancellation).
nullable: true
cancelAt:
type: string
enum:
- END_OF_BILLING_PERIOD
- IMMEDIATE
description: Cancellation timing strategy.
nullable: true
additionalProperties: false
description: Options for canceling a subscription.
UnauthenticatedErrorResponseDto:
type: object
properties:
message:
type: string
code:
type: string
enum:
- Unauthenticated
nullable: true
required:
- message
- code
description: Authentication error response.
PaginationDto:
type: object
properties:
next:
type: string
format: uuid
description: Cursor for fetching the next page of results, or null if no additional pages exist.
nullable: true
prev:
type: string
format: uuid
description: Cursor for fetching the previous page of results, or null if at the beginning.
nullable: true
required:
- next
- prev
description: Pagination metadata including cursors for navigating through results.
AddonDto:
type: object
properties:
addonId:
type: string
description: The add-on identifier.
quantity:
type: integer
description: The quantity of the add-on.
description: An add-on attached to a subscription.
PreviewSubscriptionRequestDto:
type: object
properties:
customerId:
type: string
description: The customer ID.
planId:
type: string
description: The plan ID.
billingPeriod:
type: string
enum:
- MONTHLY
- ANNUALLY
description: Billing recurrence period.
addons:
type: array
items:
$ref: '#/components/schemas/AddonDto'
description: Add-ons to include in the preview.
required:
- customerId
- planId
description: Parameters for previewing a subscription without creating it.
BadInputErrorResponseDto:
type: object
properties:
message:
type: string
description: Human-readable error message.
code:
type: string
description: Machine-readable error code.
nullable: true
required:
- message
- code
description: Bad request error response.
ConflictErrorResponseDto:
type: object
properties:
message:
type: string
code:
type: string
enum:
- DuplicatedEntityNotAllowed
- EntitlementBelongsToFeatureGroupError
nullable: true
required:
- message
- code
description: Conflict error response (e.g., duplicate resource).
securitySchemes:
ApiKey:
type: apiKey
in: header
name: X-API-KEY
description: Full access key from the Stigg dashboard (Integrations > API keys).