Query recurring subscriptions, billing cycles, and customer assignments.
GraphQL
query GetSubscription($id: ID!) {
Subscription(id: $id) {
id
label
status
frequency_unit
frequency_interval
starts_at
ends_at
next_run_at
total
customer { id label }
line_items {
id
variant { id label }
quantity
price
}
runs {
paginatorInfo { total }
data {
id
run_at
status
invoice { id label }
}
}
}
}
GraphQL
query Subscriptions(
$where: QuerySubscriptionsWhereWhereConditions,
$orderBy: [QuerySubscriptionsOrderByOrderByClause!],
$search: String,
$first: Int,
$page: Int
) {
Subscriptions(
where: $where,
orderBy: $orderBy,
search: $search,
first: $first,
page: $page
) {
paginatorInfo {
total
currentPage
}
data {
id
label
status
next_run_at
total
customer { id label }
}
}
}
GraphQL
query SubscriptionRuns(
$where: QuerySubscriptionRunsWhereWhereConditions,
$orderBy: [QuerySubscriptionRunsOrderByOrderByClause!],
$first: Int,
$page: Int
) {
SubscriptionRuns(
where: $where,
orderBy: $orderBy,
first: $first,
page: $page
) {
paginatorInfo { total }
data {
id
run_at
status
subscription { id label }
invoice { id label }
}
}
}
Field Type Description idInt Unique identifier. labelString Subscription reference number. statusSubscriptionStatus Current status. frequency_unitSubscriptionFrequencyUnit Frequency period (day, week, month, year). frequency_intervalInt Interval between runs. max_cyclesInt Maximum number of occurrences. starts_atDate Start date. ends_atDate End date. next_run_atDate Next scheduled execution. auto_create_shipping_orderBoolean Create shipment automatically. invoice_as_draftBoolean Create invoice as draft. currencyCurrency Billing currency. exchange_rateFloat Exchange rate for currency conversion. tax_typeTaxType Tax calculation method. default_discountFloat Default discount rate. discount_typeDiscountType Discount type (amount or percentage). total_unitsFloat Total quantity per run. subtotalFloat Subtotal per run. total_without_taxFloat Total before taxes. total_ecotaxFloat Total ecotaxes. totalFloat Grand total per run. total_taxes[DocumentTaxRate] List of taxes applied. notesString Public notes for documents. internal_notesString Private notes. for_the_attention_ofString Specific recipient name. external_referenceString Merchant internal reference. created_atDateTime Creation time. updated_atDateTime Last update time. customerCustomer Associated customer. price_levelPriceLevel Applied price level. account_representativeAccountRepresentative Assigned representative. seasonSeason Associated season. invoice_pdf_templatePdfTemplate Template for invoices. shipping_order_pdf_templatePdfTemplate Template for shipping orders. billing_addressAddress Default billing address. shipping_addressAddress Default shipping address. line_items[LineItemSubscription] List of recurring items. runs[SubscriptionRun] Execution history. custom_fields[EntityCustomField] Custom fields for this entity.
The following fields can be used in the where parameter:
id, label, status, next_run_at, created_at, updated_at, customer_id, pending_shipping_order.
Example Filters:
Field Example status{ "column": "STATUS", "operator": "EQ", "value": "active" }customer_id{ "column": "CUSTOMER_ID", "operator": "EQ", "value": 100001 }pending_shipping_order{ "column": "PENDING_SHIPPING_ORDER", "operator": "EXISTS", "value": true }
The following fields can be used in the where parameter:
id, run_at, status, subscription_id, invoice_id, shipping_order_id, created_at, updated_at.
id
label
status
next_run_at
created_at
updated_at
customer_id
id
run_at
status
subscription_id
invoice_id
shipping_order_id
created_at
updated_at
Field Type Description idInt Run ID. run_atDate Date of execution. statusString Status of the run (success/error). errorString Error message if failed. subscriptionSubscription Parent subscription. invoiceInvoice Generated invoice. shipping_orderShippingOrder Generated shipping order.
Field Type Description idInt Run invoice ID. company_idInt Company ID. subscription_run_idInt Parent run ID. subscription_customer_idInt Customer ID. statusString Status (pending, processed, error). errorString Error message if failed. subscription_runSubscriptionRun Parent run. subscription_customerSubscriptionCustomer Customer relationship. invoiceInvoice Generated invoice. shipping_orderShippingOrder Generated shipping order.
Field Type Description idInt Subscription customer ID. company_idInt Company ID. subscription_idInt Parent subscription ID. customer_idInt Customer ID. statusString Status (active, paused, left). joined_atDate Date customer joined. left_atDate Date customer left. discountFloat Customer-specific discount. discount_typeDiscountType Discount type (percentage/amount). customerCustomer Customer relationship. subscriptionSubscription Parent subscription. billing_addressAddress Billing address. shipping_addressAddress Shipping address.
Field Type Description updated_subscriptions_countInt Number of subscriptions updated. updated_line_items_countInt Number of line items updated. queuedBoolean Whether the update was queued for background processing. job_batch_idString Batch job ID if queued.
This is the full subscription entity with all available fields.
Field Type Description idInt Customer subscription ID. customerCustomer Associated customer. joined_atDate Date customer joined. left_atDate Date customer left. statusString Customer status. billing_addressAddress Billing address. shipping_addressAddress Shipping address. discountFloat Customer-specific discount. discount_typeDiscountType Discount type (amount or percentage).
Value Description draftNot yet active. activeRunning as scheduled. pausedTemporarily stopped. cancelledPermanently stopped.
Value Description dayExecutes daily. weekExecutes weekly. monthExecutes monthly. yearExecutes yearly.
Value Description amountFixed discount amount. percentagePercentage-based discount.
Value Description exclusiveTax calculated on top of the net price. inclusiveTax included in the displayed price.