> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "Using the Sell Anything API"
---

The Sell Anything API requires you to explicitly request tracking for individual products and stores. This guide will walk you through the steps required to request tracking for products and stores, how to retrieve information about them once they have been tracked, and how to maintain your own copy of the product data.

## Tutorial

### Step 1: Request tracking for products and stores

Rye has three different API operations that can be used to request tracking for products and stores:

* [`requestAmazonProductByURL`](/api-reference/requestamazonproductbyurl)

  Used to request individual **Amazon** products. This operation returns a `productId` field which should be stored on your end for the next step.
* [`requestShopifyProductByURL`](/api-reference/requestshopifyproductbyurl)

  Used to request individual **Shopify** products. This operation returns both a `canonicalDomain` and `productId` field, both of which should be stored on your end for use in the next step.
* [`requestStoreByURL`](/api-reference/requeststorebyurl)

  Used to request entire **Shopify** stores. This operation returns a `canonicalDomain` value which you should keep track of for the next step.

For each product or store you selected in the [previous step](/use-cases/gifting/selecting-products-and-apis), your technical implementation team should send a GraphQL request which hits the relevant API operation. For instance, if you wanted to sell [these Gymshark leggings](https://www.gymshark.com/products/gymshark-adapt-camo-seamless-leggings-black-onyx-grey-aw22) you would send the following GraphQL request:

```graphql
mutation {
  requestShopifyProductByURL(
    url: "https://www.gymshark.com/products/gymshark-adapt-camo-seamless-leggings-black-onyx-grey-aw22"
  ) {
    canonicalDomain
    productId
  }
}
```

This request returns the fields `canonicalDomain` and `productId`. Both of these fields should be stored on your end, as they are useful for subsequent API operations. `canonicalDomain` can be used with [`productsByDomainV2`](/api-reference/productsbydomainv2), and `productId` can be used with [`productByID`](/api-reference/productbyid) to retrieve information about this product at a later date.

These mutations will add your requested product or store to a queue, and it will eventually be processed by our system. This process can take up to 24 hours, but usually completes within a few minutes. You can verify that the data has pulled through to Rye's systems by querying for the product.

<Note>
  We have an in depth tutorial on how to track products and stores using the Sell Anything API [here](/tutorial).
</Note>

### Step 2: Query product information

After you have requested tracking for a product or store, you can retrieve information using the following API operations:

* [`productByID`](/api-reference/productbyid)

  Used to retrieve information about a specific product. This works for both **Amazon** and **Shopify** products. You will need a `productId` value here, which you should have stored from Step 1.
* [`productsByDomainV2`](/api-reference/productsbydomainv2)

  Used to retrieve all products from a specific store. This works for **Shopify** stores. You will need a `canonicalDomain` value here, which you should have stored from Step 1.

We generally recommend using [`productsByDomainV2`](/api-reference/productsbydomainv2)—unless you are selling Amazon products—as it allows you to query product data efficiently in bulk as opposed to fetching everything one-by-one. The following GraphQL documents will retrieve information about the Gymshark leggings we requested in Step 1:

<Tabs items={["productByID (Amazon, Shopify)", "productsByDomainV2 (Shopify)"]}>
  <Tab title="productByID (Amazon, Shopify)">
    ```graphql
    query GetGymsharkLeggingsByID {
      productByID(input: {
        id: "6804983054538"
        marketplace: SHOPIFY
      }) {
        id
        title
      }
    }
    ```
  </Tab>

  <Tab title="productsByDomainV2 (Shopify)">
    ```graphql
    query GetGymsharkProducts {
      productsByDomainV2(
        input: {
          domain: "gymsharkusa.myshopify.com"
        }
        pagination: {
          # Note: Pagination is limited to 100 items per page
          limit: 100
          offset: 0
        }
      ) {
        id
        title
      }
    }
    ```
  </Tab>
</Tabs>

<Note>
  **Forgot to store the `productId` or `canonicalDomain` values from Step 1?**

  You can call the relevant request operation again; requesting the same product or store URL multiple times will only count once towards your API usage limits.
</Note>

Note that there are many more fields available on a product than just the `id` and `title`. Check out the following API reference pages for a complete listing of fields available to query:

* [`AmazonProduct`](/api-reference/amazonproduct)
* [`ShopifyProduct`](/api-reference/shopifyproduct)

## Congratulations!

At this point you have successfully started tracking all of your products and stores inside Rye's API, and are able to pull product catalog data by making GraphQL requests. From here most developers will want to [sync this data to their own system](/get-started/adding-products/syncing-products), but you could also go ahead and jump straight to [placing an order](/payments-and-ordering-overview) if you prefer.


---

*Powered by [holocron.so](https://holocron.so)*
