Core customer portal APIs for managing customer account settings, authentication, and portal configurations.
- Update custom attributes on a subscription contract
Customer Portal APIs (0.0.1)
Comprehensive API documentation for the customer-facing subscription portal. These APIs enable customers to manage their subscriptions, update billing information, modify delivery schedules, and access their account details through your storefront.
Important: These APIs must be called from your shop's domain (e.g., https://www.myshop.com/apps/subscriptions/cp/api/**) and require customer authentication. Unauthenticated requests will return a 401 Unauthorized error.
Request
Updates the shipping address or delivery method for a subscription contract. Supports standard shipping, local delivery, and pickup options with comprehensive address validation.
Delivery Method Types:
- SHIPPING: Standard shipping to customer address (default)
- LOCAL: Local delivery within specified zip codes
- PICK_UP: Customer pickup at designated location
Key Features:
- Zip code restrictions for customer portal access
- Optional ShipperHQ address validation
- Automatic phone number handling for local delivery
- Email notifications to customers
- Shipping price recalculation
- Activity log tracking with old/new addresses
Zip Code Validation (Customer Portal Only): When called from customer portal:
- Standard shipping: Validates against 'allowToSpecificZipCode' setting
- Local delivery: Validates against 'allowToSpecificZipCodeForLocalDelivery' setting
- External API calls bypass zip code restrictions
Address Validation:
- If ShipperHQ is configured, addresses are validated for deliverability
- Invalid addresses will return appropriate error messages
- Helps prevent failed deliveries and shipping issues
Special Handling:
- Local delivery addresses missing phone numbers are auto-populated
- Uses customer's phone if available, otherwise defaults to placeholder
- Handles missing address components gracefully
Post-Update Actions:
- Sends 'SHIPPING_ADDRESS_UPDATED' email to customer
- Creates activity log with address change details
- Triggers asynchronous shipping price recalculation
- May remove invalid discount codes automatically
Important Notes:
- Province codes should use ISO 3166-2 format (e.g., 'NY' for New York)
- Country codes should use ISO 3166-1 alpha-2 format (e.g., 'US')
- Phone numbers should include country code for international addresses
- Pickup locations must be pre-configured in Shopify
Authentication: Requires valid X-API-Key header
New shipping address and delivery method details
- https://www.myshop.com/apps/subscriptions/cp/api/subscription-contracts-update-shipping-address
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PUT \
'https://www.myshop.com/apps/subscriptions/cp/api/subscription-contracts-update-shipping-address?contractId=0' \
-H 'Content-Type: application/json' \
-d '{
"methodType": "SHIPPING",
"firstName": "John",
"lastName": "Doe",
"company": "Acme Corp",
"address1": "456 New Street",
"address2": "Suite 200",
"city": "Los Angeles",
"provinceCode": "CA",
"countryCode": "US",
"zip": "90001",
"phone": "+12135551234"
}'{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-03-01T00:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com" }, "deliveryMethod": { "__typename": "SubscriptionDeliveryMethodShipping", "address": { … } }, "deliveryPrice": { "amount": "7.99", "currencyCode": "USD" } }
Request
Updates or replaces custom key-value attributes on a subscription contract. These attributes are stored with the subscription and can be used to track custom data, preferences, or metadata that's important for your business processes.
Custom Attributes Overview: Custom attributes are key-value pairs that allow you to store additional information on subscriptions. They are:
- Visible in the Shopify admin and accessible via API
- Included in order data when subscription orders are created
- Preserved across subscription lifecycle events
- Useful for integrations and custom workflows
Update Modes:
- Merge Mode (overwriteExistingAttributes=false): Adds new attributes and updates existing ones with matching keys. Other attributes remain unchanged.
- Replace Mode (overwriteExistingAttributes=true): Completely replaces all existing attributes with the provided list.
Common Use Cases:
- Store gift messages or special instructions
- Track referral sources or marketing campaigns
- Add internal reference numbers or tracking codes
- Store customer preferences or customization options
- Integration data for third-party systems
Important Notes:
- Attribute keys should not conflict with Shopify's reserved attributes
- Both keys and values are stored as strings
- Changes are logged in the activity history
- Invalid discount codes may be automatically removed during update
Authentication: Requires valid X-API-Key header
The ID of the subscription contract to update
List of custom attributes to set on the subscription contract. Each attribute is a key-value pair that will be stored with the subscription.
The attribute key. Should be a unique identifier for this attribute. Use descriptive keys like 'gift_message', 'delivery_instructions', etc.
- https://www.myshop.com/apps/subscriptions/cp/api/update-custom-note-attributes
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://www.myshop.com/apps/subscriptions/cp/api/update-custom-note-attributes \
-H 'Content-Type: application/json' \
-d '{
"subscriptionContractId": 123456789,
"customAttributesList": [
{
"key": "gift_message",
"value": "Happy Birthday! Enjoy your subscription!"
}
]
}'{ "message": "Attributes updated successfully" }
Request
Creates a new subscription contract by either splitting (moving) or duplicating selected line items from an existing contract. This endpoint allows you to divide a subscription into multiple contracts or create a copy with specific products.
Split vs Duplicate Mode:
- Split (isSplitContract=true): Moves the selected line items from the original contract to a new contract. The original contract will no longer contain these items.
- Duplicate (isSplitContract=false): Creates a new contract with copies of the selected line items while keeping them in the original contract.
Important Notes:
- When splitting, at least one subscription product must remain in the original contract
- The new contract inherits all settings from the original: customer, payment method, billing/delivery policies, shipping address, and custom attributes
- Billing schedule is automatically generated for the new contract
- One-time products and free products don't count towards the minimum product requirement
Use Cases:
- Split a subscription when customer wants different delivery schedules for different products
- Create a gift subscription from an existing subscription
- Separate products for different shipping addresses
- Duplicate a subscription for testing or backup purposes
Authentication: Requires valid X-API-Key header
- https://www.myshop.com/apps/subscriptions/cp/api/subscription-contract-details/split-existing-contract
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
'https://www.myshop.com/apps/subscriptions/cp/api/subscription-contract-details/split-existing-contract?contractId=0&isSplitContract=false&attemptBilling=false' \
-H 'Content-Type: application/json' \
-d '[
"string"
]'{ "id": "gid://shopify/SubscriptionContract/987654321", "status": "ACTIVE", "nextBillingDate": "2024-02-15T00:00:00Z", "originOrder": { "id": "gid://shopify/Order/123456789" }, "customer": { "id": "gid://shopify/Customer/111111", "email": "customer@example.com" }, "billingPolicy": { "interval": "MONTH", "intervalCount": 1 }, "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 }, "lines": { "edges": [ … ] }, "customAttributes": [ { … }, { … } ] }