
How to Integrate External Data with Your Shopify Store — Using Shopify APIs for Data Integration
As more businesses adopt Shopify, we hear from many merchants who say things like, "I've been running my online store on a different platform and want to migrate to Shopify!" or "I want to connect Shopify with our shipping service or warehouse management system!"
In this article, we'll explain how Shopify structures its data and introduce efficient methods for integrating data using the Shopify API.
Download the Store Design Guide for High-Converting Stores (Free)
Important Considerations When Using Shopify APIs
Before diving into Shopify API integrations, there are a few important points to keep in mind.
Shopify APIs Have Request Rate Limits Based on Your Store's Plan
The key distinction here is whether you are on Shopify Plus or a standard plan — both have a maximum number of API calls allowed per second. Please be aware of these limits.
For details on the specific rate limits for each API type, please refer to this page. Operations such as registering products or importing customer data often involve large datasets, so extra caution is advised.
When Receiving a Webhook, Return a Success Status Code Before Processing Data
This is a point that is briefly mentioned in Shopify's webhook tutorial and is easy to overlook: when Shopify sends a webhook notification, it determines whether the notification was received based on whether it gets a 2xx status code in response.
If your endpoint responds with anything other than a 2xx status code, Shopify will consider the notification a failure and will retry up to 19 times over a 48-hour period.
If the notification failed because your server was down, you can still return a 2xx response once your server recovers — as long as it comes back within 48 hours.
Shopify will not send any further notifications after that, but if your endpoint consistently responds with non-2xx codes and all 19 retries fail, Shopify will automatically delete the registered webhook. Please be careful.
Fetch Actual Inventory via API After Receiving a Webhook to Prevent Inventory Discrepancies
When using webhooks for inventory synchronization, a common approach is to subtract the quantity of ordered items from the inventory count in your external system whenever an order/create event is triggered.
In this case, the safer approach is to use the API to check the actual inventory on Shopify after receiving the webhook, and then update your external system based on that confirmed value.
While not an everyday occurrence, there are scenarios where discrepancies can arise — such as when a slow response causes a request to be sent multiple times, or when a sudden surge of orders comes in and Shopify runs out of stock before your external system catches up. These discrepancies can disrupt your operations.
To achieve real-time synchronization, it is best practice to verify the current inventory on Shopify using the Product API after receiving a webhook, and then update your external data accordingly.
Use Cases for Data Integration
So far, we've covered the key points to keep in mind when integrating data via Shopify's API and webhooks.
Now let's look at some concrete examples of the types of data used and the scenarios where data integration becomes useful.
Order Data Integration
Retrieving Order Data Created in Shopify
- Identify the scenarios in which order data retrieval is needed
With webhooks, you can retrieve order data in the following scenarios:
- Order created
- Order deleted
- Order cancelled
- Order fulfilled
- Order paid
- Order updated
- POST /admin/api/2021-01/webhooks.json — Create an endpoint to receive webhooks
Create a webhook via the API for the event(s) you identified in step 1.
{
"webhook": {
"topic": "orders/create",
"address": "https://whatever.hostname.com/",
"format": "json"
}
}
The "topic" field corresponds to the event from step 1 that allows you to retrieve order data.
Importing Past Order Data from Your Own Database into Shopify
1. POST /admin/apo/2021-01/orders.json — Create an order record
When creating an order record, the line_items field is required. The data for each ordered product must be structured in the following format:
"fulfillable_quantity"
"fulfillment_service"
"grams"
"id"
"price"
"price_set"
"product_id"
"quantity"
"requires_shipping"
"sku"
"title"
"variant_id"
"variant_title"
"vendor"
"name"
"gift_card"
"properties"
"taxable"
"tax_lines"
"tip_payment_gateway"
"tip_payment_method"
"total_discount"
"total_discount_set"
"discount_allocations"
"origin_location"
"duties"Order data can also be linked to customer data. If you want to associate an order with an existing Shopify customer, you will need to register the customer in Shopify first and obtain their customer ID beforehand.
Customer Data Integration
Retrieving New Customer Data Created in Shopify
- Identify the scenarios in which customer data retrieval is needed
With webhooks, you can retrieve customer data in the following scenarios:
- Customer created
- Customer updated
- Customer deleted
- Customer enabled
- Customer disabled
- POST /admin/api/2021-01/webhooks.json — Create an endpoint to receive webhooks
Create a webhook via the API for the event(s) you identified in step 1.
{
"webhook": {
"topic": "customers/create",
"address": "https://whatever.hostname.com/",
"format": "json"
}
}As with order data, the "topic" field corresponds to the event from step 1 that allows you to retrieve customer data.
Importing Customer Data from Your Own Database into Shopify
1. POST /admin/api/2021-01/customers.json — Create a customer record
2. POST /admin/apo/2021-01/customers/{customer_id}/addresses.json — Register the customer's address and link it to the customer record
Product Data Integration
For product data integration, you need to understand how Shopify structures product data and decide which fields to map your data to.

In Shopify's product data model, product images and variant data are stored separately, and variant data is linked to inventory data. For example, inventory quantity and fulfillment service information are attributes of ProductVariant, not Product.
As mentioned earlier, Shopify APIs have a rate limit on the number of calls per second. If your initial product catalog is very large, it may be safer to import your master product list via file import rather than through the API.
After importing your master products via file, the typical API integration flow looks like this:
1. POST /admin/api/2021-01/products/{product_id}/images.json — Upload product images
2. PUT /admin/api/2021-01/inventory_items/{inventory_item_id}.json — Update inventory item details
3. GET /admin/api/2021-01/locations.json — Retrieve location information registered in the admin
4. POST /admin/api/2021-01/inventory_levels/set.json — Set the actual inventory quantity
5. PUT /admin/api/2021-01/variants/{variant_id}.json — Update product variant data as needed
Summary
For merchants migrating from another e-commerce platform or a custom-built system, one of the first challenges is figuring out how to map your existing data to Shopify's data structure and determining which APIs to use for the integration.
At StoreHero, we offer data integration consulting as part of our store setup support services, drawing on our extensive experience in this area.
Whether you've finished building your store in-house and now want to connect your existing database with Shopify, or you're just starting to think about what data you can pull from Shopify for external integrations — feel free to reach out to us at any time.
StoreHero is here to support you from store design to launch. Get in touch with us today. =>View StoreHero's Service Overview (Free)