Skip to content

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

POST
/intents.json
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.

X-Shopify-Shop-Domain
required
string

The Shopify shop domain (e.g. ‘restock-rocket-demo.myshopify.com’)

Media typeapplication/json
object
intent
required
object
shopify_variant_id
required

The ID for the Shopify Variant

integer
shopify_product_id
required

The ID for the Shopify Product

integer
shopify_market_id

The ID for the Shopify Market (for multi-market stores)

integer
channel
required

The notification channel (email requires customer.email, sms requires customer.phone, push requires customer.push)

string
Allowed values: email sms push
quantity
required

The quantity of the Variant they want

integer
source
required

Should be set to ‘api’

string
Allowed values: api
customer
required
object
id

Optional customer id from previous API call response

string
name

Customer’s name (Shop must be on standard plan or above)

string
email

Customer email address (required if channel is email)

string
phone

Customer phone number with country code but without ‘+’ (required if channel is sms)

string
push

Push notification token (required if channel is push)

string
country_code

Country code for the customer phone number

string
country

Country in two letter code for the customer (improves phone number validation)

string
/^[a-z]{2}$/
accepts_marketing

Whether the customer has agreed to receive email content from your online store

boolean
locale

Customer locale

string
shopify_market_id

Customer’s Shopify Market ID for multi-market stores

integer
shopify_customer_id

Customer’s Shopify ID

string
product

Product data is only needed if you have optin confirmation or alerts to your shop set up

object
variant_count

The number of variants the Shopify Product has

integer
title

The title for the Shopify Product

string
variant_title

The title for the Shopify Variant

string
vendor

The vendor/brand of the product

string
sku

The SKU of the variant

string

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"
}
}

Request processed but with errors

Media typeapplication/json
object
errors
Array<string>

Example generated

{
"errors": [
"example"
]
}

Intent created successfully

Media typeapplication/json
object
intents
Array<object>

Created intent details

object
errors
Array<string>

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

Was this page helpful?

Still stuck? Ask Quinn or chat with support