Skip to main content
POST
/
api
/
v1
/
products
/
subscribe
JavaScript
import CheckoutIntents from 'checkout-intents';

const client = new CheckoutIntents({
  apiKey: process.env['CHECKOUT_INTENTS_API_KEY'], // This is the default and can be omitted
});

const productSubscription = await client.products.subscribe({
  type: 'store',
  url: 'https://store.myshopify.com',
});

console.log(productSubscription);
import os
from checkout_intents import CheckoutIntents

client = CheckoutIntents(
    api_key=os.environ.get("CHECKOUT_INTENTS_API_KEY"),  # This is the default and can be omitted
)
product_subscription = client.products.subscribe(
    type="store",
    url="https://store.myshopify.com",
)
print(product_subscription)
package com.rye.example;

import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.products.ProductSubscribeParams;
import com.rye.models.products.ProductSubscription;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();

        ProductSubscribeParams params = ProductSubscribeParams.builder()
            .type(ProductSubscribeParams.Type.STORE)
            .url("https://store.myshopify.com")
            .build();
        ProductSubscription productSubscription = client.products().subscribe(params);
    }
}
curl https://staging.api.rye.com/api/v1/products/subscribe \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
    -d '{
          "type": "store",
          "url": "https://store.myshopify.com"
        }'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://staging.api.rye.com/api/v1/products/subscribe",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'url' => 'https://store.myshopify.com'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <api-key>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://staging.api.rye.com/api/v1/products/subscribe"

	payload := strings.NewReader("{\n  \"url\": \"https://store.myshopify.com\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://staging.api.rye.com/api/v1/products/subscribe")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"https://store.myshopify.com\"\n}"

response = http.request(request)
puts response.read_body
{
  "subscribed": true,
  "url": "<string>",
  "id": "<string>",
  "type": "product"
}
{
  "name": "<string>",
  "message": "<string>",
  "stack": "<string>"
}
{
  "name": "<string>",
  "message": "<string>",
  "stack": "<string>"
}
{
  "name": "<string>",
  "message": "<string>",
  "status": 123,
  "fields": {},
  "stack": "<string>"
}
{
  "name": "<string>",
  "message": "<string>",
  "stack": "<string>",
  "retryAfter": "<string>"
}
{
  "name": "<string>",
  "message": "<string>",
  "stack": "<string>"
}

Authorizations

Authorization
string
header
required

Rye API key

Body

application/json
url
string
required

Store or product URL to subscribe or unsubscribe.

Example:

"https://store.myshopify.com"

type
enum<string>
required

Scope of the subscription change.

Available options:
store,
product

Response

Product subscription

subscribed
boolean
required

Whether the resolved product is subscribed after the mutation.

url
string
required

Product subscription URL.

id
string
required

Product id.

type
enum<string>
required

Scope of the subscription change.

Available options:
product