Create Customer Intent to Buy Product
LegacyAPI v1 is the older API. It still works and is supported, but new integrations should use API v2. Migrating from v1 to v2
const url = 'https://app.stoqapp.com/api/v1/intents.json';const options = { method: 'POST', headers: {'X-Shopify-Shop-Domain': 'example', 'Content-Type': 'application/json'}, body: '{"intent":{"shopify_variant_id":43900910010503,"shopify_product_id":7891234567890,"channel":"email","quantity":1,"source":"api"},"customer":{"email":"shopper@example.com","name":"Alex Shopper","accepts_marketing":true,"country":"us"}}'};
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://app.stoqapp.com/api/v1/intents.json \ --header 'Content-Type: application/json' \ --header 'X-Shopify-Shop-Domain: example' \ --data '{ "intent": { "shopify_variant_id": 43900910010503, "shopify_product_id": 7891234567890, "channel": "email", "quantity": 1, "source": "api" }, "customer": { "email": "shopper@example.com", "name": "Alex Shopper", "accepts_marketing": true, "country": "us" } }'Create a new intent for a customer to be notified when a product is back in stock. Unlike other API endpoints for Back in Stock, this API endpoint does not require an API Key.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The Shopify shop domain (e.g. ‘restock-rocket-demo.myshopify.com’)
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
The ID for the Shopify Variant
The ID for the Shopify Product
The ID for the Shopify Market (for multi-market stores)
The notification channel (email requires customer.email, sms requires customer.phone, push requires customer.push)
The quantity of the Variant they want
Should be set to ‘api’
object
Optional customer id from previous API call response
Customer’s name (Shop must be on standard plan or above)
Customer email address (required if channel is email)
Customer phone number with country code but without ‘+’ (required if channel is sms)
Push notification token (required if channel is push)
Country code for the customer phone number
Country in two letter code for the customer (improves phone number validation)
Whether the customer has agreed to receive email content from your online store
Customer locale
Customer’s Shopify Market ID for multi-market stores
Customer’s Shopify ID
Product data is only needed if you have optin confirmation or alerts to your shop set up
object
The number of variants the Shopify Product has
The title for the Shopify Product
The title for the Shopify Variant
The vendor/brand of the product
The SKU of the variant
Example
{ "intent": { "shopify_variant_id": 43900910010503, "shopify_product_id": 7891234567890, "channel": "email", "quantity": 1, "source": "api" }, "customer": { "email": "shopper@example.com", "name": "Alex Shopper", "accepts_marketing": true, "country": "us" }}Responses
Section titled “Responses”Request processed but with errors
object
Example generated
{ "errors": [ "example" ]}Intent created successfully
object
Created intent details
object
Example
{ "intents": [ { "id": "8f3c2b1a-7d4e-4c2a-9f10-2b3c4d5e6f70", "channel": "email", "email": "shopper@example.com", "phone": null, "quantity": 1, "notified_at": null, "optin_confirmed": true, "source": "api", "type": "restock", "sent_notifications_count": 0, "created_at": "2026-06-20T14:30:00Z", "updated_at": "2026-06-20T14:30:00Z", "customer_id": "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f", "shop_id": "a1b2c3d4-5e6f-7081-92a3-b4c5d6e7f809", "shopify_product_id": 7891234567890, "shopify_variant_id": 43900910010503, "accepts_marketing": true } ], "errors": []}Bad request
Unauthorized
Thanks for letting us know.
Still stuck? Ask Quinn or chat with support