Skip to content

External APIs (0.0.1)

Comprehensive API documentation for managing subscriptions, payments, and related operations. These APIs allow you to programmatically manage subscription lifecycles, handle payments, configure products, and integrate subscription functionality into your applications.

Languages
Servers
https://subscription-admin.appstle.com

Subscription Management

Core APIs for managing the complete subscription lifecycle including creation, updates, pausing, resuming, and cancellation of subscriptions.

Operations

Subscription Payments

APIs for managing subscription payment methods, processing payments, handling payment retries, and updating billing information.

Operations

Subscription Contracts

APIs for managing subscription contracts including delivery schedules, pricing, order notes, billing cycles, and shipping addresses.

Operations

Subscription Products

APIs for managing products within subscriptions including adding, removing, updating quantities, and swapping products.

Operations

Remove multiple products from subscription

Request

Removes multiple product line items from an existing subscription contract in a single request. Products are removed sequentially, allowing partial success if errors occur.

Key Features:

  • Sequential processing - items removed one by one
  • Partial success allowed - previous removals persist if later ones fail
  • Validates each removal against current subscription state
  • Smart discount cleanup for line-specific discounts
  • Comprehensive validation for each product removal
  • Triggers all side effects after each successful removal

Processing Order Matters: Items are removed in the order provided:

  1. First item validated and removed
  2. Second item validated against updated state
  3. Continue until all processed or error occurs
  4. Returns final subscription state

Validation Per Item:

  • Line item must exist in subscription
  • At least one recurring product must remain
  • Build-a-Box min/max quantities maintained
  • Minimum cycle commitments honored
  • One-time and free products don't count toward minimum

Discount Handling: When removeDiscount=true:

  • Removes discounts applied ONLY to the removed line
  • Preserves discounts that apply to multiple lines
  • Each removal evaluates discounts independently
  • Build-a-Box discounts auto-adjust based on quantity

Side Effects Per Removal: Each successful removal triggers:

  • Activity log entry created
  • Customer email sent (except one-time products)
  • Shipping price recalculation
  • Build-a-Box discount resync
  • Product discount adjustments

Partial Success Scenarios: If removing 3 items and the 2nd fails:

  • 1st item: Successfully removed
  • 2nd item: Fails, error returned
  • 3rd item: Not attempted
  • Result: Subscription with 1st item removed

Performance Considerations:

  • Each removal is a separate Shopify API transaction
  • Multiple emails may be sent to customer
  • Consider using single remove for 1-2 items
  • Large batches may timeout
  • Recommended max: 5-10 items per request

Build-a-Box Handling: For Build-a-Box subscriptions:

  • Validates total quantity after EACH removal
  • May fail mid-batch if minimum breached
  • Discounts recalculate after each item
  • Consider removal order carefully

Important Notes:

  • NOT atomic - no rollback on partial failure
  • Order of line IDs affects success probability
  • Customer receives email per removed item
  • All validations apply as if removing individually
  • Response shows final state after all attempts

Authentication: Requires valid X-API-Key header

Query
contractIdinteger(int64)required

Subscription contract ID to remove products from

Example: contractId=123456789
removeDiscountboolean

When true, removes discounts that apply only to each removed line item. When false, attempts to retain all discounts. Discounts that apply to multiple lines are always retained regardless of this setting.

Default false
api_keystringDeprecated

API Key (Deprecated - Use Header X-API-Key instead)

Headers
X-API-Keystringrequired

API Key for authentication

Bodyapplication/jsonrequiredArray [
string
]
curl -i -X PUT \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-remove-line-items?contractId=123456789&removeDiscount=false&api_key=string' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: string' \
  -d '[
    "string"
  ]'

Responses

Products successfully removed from subscription (full or partial success)

Bodyapplication/json
get__typenamestring
idstring
createdAtobject
updatedAtobject
nextBillingDateobject
statusstring
Enum"ACTIVE""PAUSED""CANCELLED""EXPIRED""FAILED""$UNKNOWN"
deliveryPriceobject(DeliveryPrice)
lastPaymentStatusstring
Enum"SUCCEEDED""FAILED""$UNKNOWN"
billingPolicyobject(BillingPolicy)
deliveryPolicyobject(DeliveryPolicy)
linesobject(Lines)
customerPaymentMethodobject(CustomerPaymentMethod)
deliveryMethodobject(DeliveryMethod)
originOrderobject(OriginOrder)
customerobject(Customer)
discountsobject(Discounts)
notestring
customAttributesArray of objects(CustomAttribute1)
billingAttemptsobject(BillingAttempts)
Response
application/json
{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-04-01T00:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com" }, "lines": { "edges": [] }, "discounts": { "edges": [] } }

Remove product from subscription

Request

Removes a specific product line item from an existing subscription contract. Can optionally retain prorated discounts associated with the removed product.

Key Features:

  • Validates minimum subscription requirements before removal
  • Handles discount cleanup for line-specific discounts
  • Enforces minimum cycle commitments on products
  • Supports Build-a-Box quantity validation
  • Automatic retry on concurrent modification conflicts
  • Email notifications for subscription changes

Validation Rules:

  • At least one recurring subscription product must remain after removal
  • One-time products and free products don't count toward the minimum
  • Products with minimum cycle commitments cannot be removed until fulfilled
  • Build-a-Box subscriptions validate against minimum/maximum quantity rules

Discount Handling: When removeDiscount=true (default):

  • Discounts applied only to the removed line item are deleted
  • Discounts applied to multiple line items are retained
  • System automatically identifies which discounts to remove

Retry Mechanism: The endpoint automatically retries in these scenarios:

  • Concurrent modification detected (another process updated the subscription)
  • Invalid discount code errors (removes problematic discount and retries)
  • This ensures reliable operation in high-traffic environments

Post-Removal Actions:

  • Activity log created for audit trail
  • Email notification sent to customer (except for one-time products)
  • Shipping price recalculated asynchronously
  • Build-a-Box discounts resynced if applicable
  • Product-specific discounts resynced

Authentication: Requires valid X-API-Key header

Query
contractIdstring^[0-9]+$required

Subscription contract ID to remove product from. Provide the numeric ID without the gid:// prefix

Example: contractId=123456789
lineIdstringrequired

Line item ID of the product to remove. Must be the full GraphQL ID including the gid:// prefix

Example: lineId=gid://shopify/SubscriptionLine/123456789
removeDiscountboolean

Controls whether to remove discounts that apply only to this line item. When true (default), line-specific discounts are removed. When false, attempts to retain discounts where possible. Note: Discounts that apply to multiple lines are always retained regardless of this setting

Default true
Example: removeDiscount=true
api_keystringDeprecated

API Key (Deprecated - Use X-API-Key header instead)

Headers
X-API-Keystringrequired

API Key for authentication

Example: sk_live_1234567890abcdef
curl -i -X PUT \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-remove-line-item?contractId=123456789&lineId=gid%3A%2F%2Fshopify%2FSubscriptionLine%2F123456789&removeDiscount=true&api_key=string' \
  -H 'X-API-Key: sk_live_1234567890abcdef'

Responses

Product successfully removed from subscription

Bodyapplication/json
get__typenamestring
idstring
createdAtobject
updatedAtobject
nextBillingDateobject
statusstring
Enum"ACTIVE""PAUSED""CANCELLED""EXPIRED""FAILED""$UNKNOWN"
deliveryPriceobject(DeliveryPrice)
lastPaymentStatusstring
Enum"SUCCEEDED""FAILED""$UNKNOWN"
billingPolicyobject(BillingPolicy)
deliveryPolicyobject(DeliveryPolicy)
linesobject(Lines)
customerPaymentMethodobject(CustomerPaymentMethod)
deliveryMethodobject(DeliveryMethod)
originOrderobject(OriginOrder)
customerobject(Customer)
discountsobject(Discounts)
notestring
customAttributesArray of objects(CustomAttribute1)
billingAttemptsobject(BillingAttempts)
Response
application/json
{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-03-01T00:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com", "firstName": "John", "lastName": "Doe" }, "billingPolicy": { "interval": "MONTH", "intervalCount": 1 }, "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 }, "lines": { "edges": [] }, "discounts": { "edges": [] } }

Add multiple products to subscription

Request

Adds multiple product line items to an existing subscription contract in a single request. This batch operation is more efficient than making multiple individual requests and ensures all products are added with consistent processing.

Key Features:

  • Batch addition of multiple products in one API call
  • All products are added as recurring items (not one-time)
  • Automatic quantity defaulting (0 or null becomes 1)
  • Sequential processing with full validation for each item
  • Returns final subscription state after all additions
  • Same pricing and discount logic as single-item endpoint

Processing Behavior:

  • Products are added sequentially, not in parallel
  • If any product fails, previous additions remain
  • Each product goes through full validation
  • Existing product handling follows store settings
  • Activity logs created for each product added

Duplicate Product Handling: If a product already exists in the subscription:

  • With 'updateExistingQuantityOnAddProduct' enabled: Updates quantity
  • Without setting: Adds as new line item
  • Setting applies to all products in the batch

Pricing and Discounts: Each product receives:

  • Appropriate selling plan assignment
  • Discount carry-forward based on store settings
  • Currency and country-specific pricing
  • Fulfillment frequency multiplier application

Build-a-Box Validation:

  • Applied if any product has _bb_id attribute
  • Validates total quantity after all additions
  • May fail entire batch if limits exceeded

Post-Processing: After all products are added:

  • Build-a-Box discounts recalculated once
  • Product discounts synchronized
  • Single email notification sent
  • Shipping price updated once

Important Notes:

  • Maximum recommended batch size: 10-20 products
  • Larger batches may timeout
  • All products become recurring items
  • Use single-item endpoint for one-time products

Authentication: Requires valid X-API-Key header

Query
contractIdinteger(int64)>= 1required

Subscription contract ID to add products to. Provide the numeric ID without the gid:// prefix

Example: contractId=123456789
api_keystringDeprecated

API Key (Deprecated - Use X-API-Key header instead)

Headers
X-API-Keystringrequired

API Key for authentication

Example: sk_live_1234567890abcdef
Bodyapplication/jsonrequired

Map of variant IDs to quantities. Keys are variant IDs (numeric only, no gid:// prefix), values are quantities to add. Null or 0 quantities default to 1.

string
curl -i -X PUT \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-line-items?contractId=123456789&api_key=string' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: sk_live_1234567890abcdef' \
  -d '{
    "42549172011164": 1,
    "42549172043932": 2,
    "42549172076700": 1
  }'

Responses

Products successfully added to subscription

Bodyapplication/json
get__typenamestring
idstring
createdAtobject
updatedAtobject
nextBillingDateobject
statusstring
Enum"ACTIVE""PAUSED""CANCELLED""EXPIRED""FAILED""$UNKNOWN"
deliveryPriceobject(DeliveryPrice)
lastPaymentStatusstring
Enum"SUCCEEDED""FAILED""$UNKNOWN"
billingPolicyobject(BillingPolicy)
deliveryPolicyobject(DeliveryPolicy)
linesobject(Lines)
customerPaymentMethodobject(CustomerPaymentMethod)
deliveryMethodobject(DeliveryMethod)
originOrderobject(OriginOrder)
customerobject(Customer)
discountsobject(Discounts)
notestring
customAttributesArray of objects(CustomAttribute1)
billingAttemptsobject(BillingAttempts)
Response
application/json
{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-04-01T12:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com" }, "billingPolicy": { "interval": "MONTH", "intervalCount": 1 }, "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 }, "lines": { "edges": [] }, "discounts": { "edges": [] } }

Billing & Payments

APIs for handling billing operations, payment processing, and financial transactions related to subscriptions.

Operations

Subscription Discounts

APIs for managing discounts and promotional codes applied to subscriptions.

Operations

Subscription One-Time Products

APIs for managing one-time add-on products that can be purchased alongside recurring subscription items.

Operations

Subscription Plans

APIs for managing subscription plans, pricing tiers, and plan configurations.

Operations

Build-a-Box & Bundles

APIs for managing customizable product boxes and bundles where customers can select multiple items.

Operations

Product Catalog

APIs for managing the product catalog including product information, variants, and inventory.

Operations

Operations & Settings

APIs for managing operational settings, configurations, and administrative functions.

Operations

Customer Portal

APIs powering the customer-facing portal where subscribers can manage their own subscriptions.

Operations

Customers

APIs for managing customer information, profiles, and account details.

Operations