Skip to main content
PUT
/
api
/
external
/
v2
/
subscription-contracts-add-line-items
curl --request PUT \
  --url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-line-items \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <x-api-key>' \
  --data '
{
  "42549172011164": 1,
  "42549172043932": 2,
  "42549172076700": 1
}
'
{
  "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": [
      {
        "node": {
          "id": "gid://shopify/SubscriptionLine/111111",
          "quantity": 2,
          "variantId": "gid://shopify/ProductVariant/42549172011164",
          "title": "Premium Coffee - Dark Roast",
          "currentPrice": {
            "amount": "59.98",
            "currencyCode": "USD"
          },
          "sellingPlanId": "gid://shopify/SellingPlan/123456",
          "sellingPlanName": "Deliver every month"
        }
      },
      {
        "node": {
          "id": "gid://shopify/SubscriptionLine/222222",
          "quantity": 1,
          "variantId": "gid://shopify/ProductVariant/42549172043932",
          "title": "Organic Tea - Green",
          "currentPrice": {
            "amount": "24.99",
            "currencyCode": "USD"
          },
          "sellingPlanId": "gid://shopify/SellingPlan/123456",
          "sellingPlanName": "Deliver every month"
        }
      },
      {
        "node": {
          "id": "gid://shopify/SubscriptionLine/333333",
          "quantity": 2,
          "variantId": "gid://shopify/ProductVariant/42549172076700",
          "title": "Coffee Filters - 100 pack",
          "currentPrice": {
            "amount": "19.98",
            "currencyCode": "USD"
          },
          "sellingPlanId": "gid://shopify/SellingPlan/123456",
          "sellingPlanName": "Deliver every month"
        }
      }
    ]
  },
  "discounts": {
    "edges": [
      {
        "node": {
          "id": "gid://shopify/SubscriptionManualDiscount/444444",
          "title": "BUILD_A_BOX_DISCOUNT_ABC123",
          "targetType": "ALL_LINES",
          "value": {
            "percentage": 20
          }
        }
      }
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://appstleinc-aeca3e0a.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Headers

X-API-Key
string
required

API Key for authentication

Query Parameters

contractId
integer<int64>
required

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

Required range: x >= 1
api_key
string

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

Body

application/json

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.

The body is of type string.

Response

Products successfully added to subscription

get__typename
string
id
string
createdAt
object
updatedAt
object
nextBillingDate
object
status
enum<string>
Available options:
ACTIVE,
PAUSED,
CANCELLED,
EXPIRED,
FAILED,
$UNKNOWN
deliveryPrice
object
lastPaymentStatus
enum<string>
Available options:
SUCCEEDED,
FAILED,
$UNKNOWN
billingPolicy
object
deliveryPolicy
object
lines
object
customerPaymentMethod
object
deliveryMethod
object
originOrder
object
customer
object
discounts
object
note
string
customAttributes
object[]
billingAttempts
object