> ## Documentation Index
> Fetch the complete documentation index at: https://docs-test.rye.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscribe to product events

> Subscribe to product events for one integrated Shopify URL.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/checkout-intents/openapi.documented.yml post /api/v1/products/subscribe
openapi: 3.0.0
info:
  title: Universal Checkout API
  version: 1.0.5
  description: >-
    Turn any product URL into a completed checkout. Instantly retrieve price,
    tax, and shipping for any product, and let users buy without ever leaving
    your native AI experience.


    View the [Rye API docs](https://docs.rye.com).
  termsOfService: https://rye.com/terms-of-service
  license:
    name: UNLICENSED
  contact:
    name: Rye
    email: dev@rye.com
    url: https://docs.rye.com
servers:
  - url: https://staging.api.rye.com
security: []
paths:
  /api/v1/products/subscribe:
    post:
      tags:
        - Products
      summary: Subscribe to product events
      description: Subscribe to product events for one integrated Shopify URL.
      operationId: Subscribe
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductSubscriptionRequest'
      responses:
        '200':
          description: Product subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductSubscriptionResponse'
        '401':
          description: Authentication Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuntimeError'
      security:
        - bearerAuth:
            - products:write
      x-codeSamples:
        - lang: JavaScript
          source: |-
            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);
        - lang: Python
          source: |-
            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)
        - lang: Java
          source: |-
            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);
                }
            }
        - lang: cURL
          source: |-
            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"
                    }'
components:
  schemas:
    ProductSubscriptionRequest:
      properties:
        url:
          type: string
          description: Store or product URL to subscribe or unsubscribe.
          example: https://store.myshopify.com
        type:
          $ref: '#/components/schemas/ProductSubscriptionTargetType'
          description: Scope of the subscription change.
      required:
        - url
        - type
      type: object
    ProductSubscriptionResponse:
      anyOf:
        - $ref: '#/components/schemas/ProductSubscriptionProductResponse'
        - $ref: '#/components/schemas/ProductSubscriptionStoreResponse'
    AuthenticationError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    NotFoundError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    ValidateError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
        status:
          type: number
          format: double
        fields:
          $ref: '#/components/schemas/FieldErrors'
      required:
        - name
        - message
        - status
        - fields
      type: object
      additionalProperties: false
    TooManyRequestsError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
        retryAfter:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    RuntimeError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    ProductSubscriptionTargetType:
      type: string
      enum:
        - store
        - product
    ProductSubscriptionProductResponse:
      properties:
        subscribed:
          type: boolean
          description: Whether the resolved product is subscribed after the mutation.
        url:
          type: string
          description: Product subscription URL.
        id:
          type: string
          description: Product id.
        type:
          type: string
          enum:
            - product
          nullable: false
          description: Scope of the subscription change.
      required:
        - subscribed
        - url
        - id
        - type
      type: object
    ProductSubscriptionStoreResponse:
      properties:
        subscribed:
          type: boolean
          description: Whether the resolved store is subscribed after the mutation.
        url:
          type: string
          description: Store subscription URL.
        domain:
          type: string
          description: Store domain.
        type:
          type: string
          enum:
            - store
          nullable: false
          description: Scope of the subscription change.
      required:
        - subscribed
        - url
        - domain
        - type
      type: object
    FieldErrors:
      properties: {}
      type: object
      additionalProperties:
        properties:
          value: {}
          message:
            type: string
        required:
          - message
        type: object
  securitySchemes:
    bearerAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Rye API key

````