Shopify Product API for Developers a Comprehensive Guide
Introduction
If you're a Shopify store owner or developer looking to enhance your store’s functionality, understanding the Shopify Product API is crucial for developers. Whether you're adding new products, updating existing ones, or managing variants, the Shopify Product API allows you to do it all programmatically. In this guide, we'll explore the Shopify Product API for Developers, a complete guide to managing your product catalog with ease, from authentication to practical implementation.
Let’s dive into the key features of this powerful tool and show you how to use it to streamline your store’s operations.
If you're looking to further customize your store, consider checking out our Shopify Custom Theme Development Services.
What is the Shopify Product API?
The Shopify Product API is used to manage the product catalog using custom coding. By using the Shopify Product API, you can:
- Add new products to your Shopify Store.
- Update/Edit product details such as title, description, price, images, and variants.
- View the product in the form of a list or an array.
- Delete Products from the store.
- Manage Product Variants and Inventory
Accessing the Shopify Product API
To use the Shopify API first, you have to do the authentication. There are 2 ways to do authentication listed below.
1. Custom Apps using Access Token
- Develop a custom app inside your Shopify admin.
- Add the necessary permissions for Product and Inventory APIs.
-
Copy the Admin/Storefront API access token, which you’ll use in your API requests.
2. Public Apps OAuth 2.0
- Setting up OAuth is mandatory if your store is live
- During the OAuth flow, request the required API scopes to gain access.
Example Endpoint
https://{store-name}.myshopify.com/admin/api/{version}/products.json
When making API calls, update the URL by replacing:
- Store-name with your store’s Shopify subdomain (for example, myshop.myshopify.com).
- Version with the desired API version, such as 2025-01.
This ensures you’re using the correct store and API version in your requests.
Once you’re familiar with authentication, you can move forward with tasks like Shopify Website Maintenance Services for seamless store operations.
Shopify Product API Endpoints
There are different endpoints for the Shopify Product API for Developers. Some of these are listed below.
1. Get All Products
GET /admin/api/2025-01/products.json
Example URL:
curl -X GET "https://{store-name}.myshopify.com/admin/api/2025-01/products.json" \
-H "X-Shopify-Access-Token: {access_token}"
2. Get a Single Product
GET /admin/api/2025-01/products/{product_id}.json
3. Create a New Product
POST /admin/api/2025-01/products.json
{
"product": {
"title": "Custom T-Shirt",
"body_html": "Premium cotton",
"vendor": "Your Brand",
"product_type": "Apparel",
"variants": [
{
"option1": "Small",
"price": "19.99",
"sku": "TSHIRT-SM"
}
]
}
}
4. Update a Product
PUT /admin/api/2025-01/products/{product_id}.json
{
"product": {
"id": 123456789,
"title": "Updated T-Shirt Title"
}
}
5. Delete a Product
DELETE /admin/api/2025-01/products/{product_id}.json
6. Working with Variants
Variants are managed through the Product Variant API.
GET /admin/api/2025-01/products/{product_id}/variants.json
REST vs GraphQL for Products
Shopify supports two types of API endpoints:
- REST API: It is an easier and beginner-friendly way to get data.
- GraphQL API: It is the most advanced and flexible way to get data using an API. You can request the data exactly as you want, no need to fetch all the data and then extract the required one.
Example GraphQL query:
{
products(first: 5) {
edges {
node {
id
title
variants(first: 2) {
edges {
node {
id
price
}
}
}
}
}
}
}
Common Use Cases for Product API
Shopify Product API is used for adding new things that Shopify does not support by default. Some common use cases are given below, where you can use the Shopify Product API:
- Add Product Reviews to your Store.
- Add Discounts based on custom conditions.
- Allow Product Personalization so that customers can customize their products in real time to see how it will look.
- Sync your Shopify Products with different platforms like Amazon, Etsy, and eBay.
Practical Example Shopify Product API Workflow
In this example, we'll show you a practical example of using the Shopify Product API using the Storefront API Access token. Follow these steps to practically add the Shopify Product API.
Step 1: Navigate to the Shopify Admin > Settings.

Step 2: Scroll down to the Apps and sales channels tab and click on the Develop apps.

Step 3: Click on the Create an app button.

Step 4: Add the name of the app and click on the Create app button.

Step 5: Select the Storefront API Scopes.

Step 6: Select the Product Permissions and click the Save button.

Step 7: Install the app in your Shopify store.

Step 8: Copy the access token and save it somewhere for future use.

Step 9: Navigate to Oline Store > Themes > Edit code.

Step 10: Navigate to the main-product.liquid file or theme.liquid file.

Step 11: Add this code to your file.
<script>
const shopDomain = "test-shop-schema-markup.myshopify.com";
const apiVersion = "2025-01";
const storefrontToken = "849b82640e1c045341181c1134002527";
const endpoint = `https://${shopDomain}/api/${apiVersion}/graphql.json`;
async function getProducts() {
const query = `
{
products(first: 5) {
edges {
node {
id
title
handle
description
variants(first: 2) {
edges {
node {
id
title
price {
amount
currencyCode
}
}
}
}
}
}
}
}
`;
const response = await fetch(endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Storefront-Access-Token": storefrontToken
},
body: JSON.stringify({ query })
});
const data = await response.json();
console.log("Products:", data.data.products.edges);
}
getProducts();
</script>
Step 12: Save the changes.
Step 13: Press CTRL + Shift + I or right-click and click Inspect elements.

Step 14: You will see the products array like this.

Conclusion
For more insights into optimizing your Shopify store, don't forget to check out our Shopify eCommerce SEO Audit Service.