Create one or more subscriptions
POST
/api/subscriptions
const url = 'https://api.usegro.co/api/subscriptions';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"profile_id":"example","shopify_payment_method_id":"example","next_delivery_date":"example","delivery_slot_id":"example","delivery_address_id":"example","delivery_amount":1,"note":"example","notify_customer":true,"lines":[{"shopify_product_id":"example","shopify_variant_id":"example","product_title":"example","variant_title":"example","sku":"example","price":1,"quantity":1,"selling_plan_id":"example","subscription_variant_id":"example","selection_items":[{"slot_id":"example","shopify_product_id":"example","shopify_variant_id":"example","product_title":"example","variant_title":"example","quantity":1,"price":1}]}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.usegro.co/api/subscriptions \ --header 'Content-Type: application/json' \ --data '{ "profile_id": "example", "shopify_payment_method_id": "example", "next_delivery_date": "example", "delivery_slot_id": "example", "delivery_address_id": "example", "delivery_amount": 1, "note": "example", "notify_customer": true, "lines": [ { "shopify_product_id": "example", "shopify_variant_id": "example", "product_title": "example", "variant_title": "example", "sku": "example", "price": 1, "quantity": 1, "selling_plan_id": "example", "subscription_variant_id": "example", "selection_items": [ { "slot_id": "example", "shopify_product_id": "example", "shopify_variant_id": "example", "product_title": "example", "variant_title": "example", "quantity": 1, "price": 1 } ] } ] }'Creates new subscriptions for a profile. Lines split across entities will produce multiple subscription records; the response returns the IDs of every subscription created.
Request Body
Section titled “Request Body”Media typeapplication/json
object
profile_id
required
string
shopify_payment_method_id
required
string
next_delivery_date
required
string
delivery_slot_id
string
delivery_address_id
string
delivery_amount
number
note
string
notify_customer
boolean
lines
required
Array<object>
object
shopify_product_id
required
string
shopify_variant_id
required
string
product_title
required
string
variant_title
string
sku
string
price
required
number
quantity
required
number
selling_plan_id
required
string
subscription_variant_id
string
selection_items
Array<object>
object
slot_id
required
string
shopify_product_id
required
string
shopify_variant_id
required
string
product_title
required
string
variant_title
string
quantity
required
number
price
required
number
Example generated
{ "profile_id": "example", "shopify_payment_method_id": "example", "next_delivery_date": "example", "delivery_slot_id": "example", "delivery_address_id": "example", "delivery_amount": 1, "note": "example", "notify_customer": true, "lines": [ { "shopify_product_id": "example", "shopify_variant_id": "example", "product_title": "example", "variant_title": "example", "sku": "example", "price": 1, "quantity": 1, "selling_plan_id": "example", "subscription_variant_id": "example", "selection_items": [ { "slot_id": "example", "shopify_product_id": "example", "shopify_variant_id": "example", "product_title": "example", "variant_title": "example", "quantity": 1, "price": 1 } ] } ]}Responses
Section titled “Responses”Subscriptions created
Media typeapplication/json
object
ids
required
IDs of the created subscriptions
Array<string>
Example generated
{ "ids": [ "example" ]}Invalid request — see error message for details
Media typeapplication/json
Example
{ "error": "Failed to create subscription"}