Shopify Integration API: REST vs GraphQL, Auth & Webhooks

A practical guide to the Shopify integration API: REST vs GraphQL, authentication, webhooks, rate limits, and when to build a custom integration instead of buying an app.

Shopify Integration API: REST vs GraphQL, Auth & Webhooks

The Shopify integration API is the set of endpoints, authentication methods, and event notifications that let external systems read and write store data. If you need to connect Shopify to an ERP, CRM, or custom service, understanding the API is the first step. This guide explains what the API covers, how REST and GraphQL differ, how authentication works, and when a custom integration makes more sense than an off-the-shelf app.

What the Shopify Integration API Covers

The Shopify integration API gives you programmatic access to almost every part of a store: products, variants, inventory levels, orders, customers, discounts, gift cards, metafields, and more. You can use it to sync data with a CRM, automate order fulfillment, or build a custom storefront.

There are two main APIs for admin-level access: the REST Admin API and the GraphQL Admin API. Both are versioned and require authentication. There is also a Storefront API for building custom shopping experiences, and webhooks for real-time event notifications.

If you are building a custom integration, you will likely use a mix of REST or GraphQL for CRUD operations and webhooks for event-driven updates. For more details on our Shopify app development services, see our Shopify apps page.

REST Admin API vs GraphQL Admin API: Which to Use

Shopify supports both REST and GraphQL for admin access. The choice depends on your use case, team skills, and performance needs.

REST Admin API

The REST API is resource-oriented and easy to understand. Each resource (e.g., /admin/api/2024-04/products.json) supports standard HTTP methods. It is a good choice for simple scripts, one-off tasks, and teams already familiar with REST.

However, REST can be inefficient for complex queries because it often requires multiple requests to fetch related data. It also has a higher rate limit cost per request compared to GraphQL.

GraphQL Admin API

GraphQL lets you request exactly the fields you need in a single query, reducing over-fetching and the number of round trips. It is more efficient for complex data shapes and bulk operations. Shopify is investing heavily in GraphQL, and some newer features are only available via GraphQL.

GraphQL has a learning curve, but for high-volume or complex integrations, it is often the better choice. Shopify provides tools like the GraphiQL explorer to help you build queries.

Consideration REST Admin API GraphQL Admin API
Ease of use Simple, resource-based Steeper learning curve
Efficiency Multiple requests for related data Single request for nested data
Rate limits Cost-based (leaky bucket) Cost-based (calculated query cost)
Bulk operations Limited Supported via bulk queries
Future features Some new features may be GraphQL-only Primary focus for new features

For most new integrations, GraphQL is recommended unless you have a specific reason to use REST.

Authentication, Access Scopes and App Types

Every request to the Shopify integration API must be authenticated. The method depends on the type of app you are building.

Public Apps

Public apps are distributed through the Shopify App Store. They use OAuth 2.0 to obtain an access token from the merchant. You register your app in the Partner Dashboard, specify required scopes, and handle the OAuth flow. Access tokens are per-store and should be stored securely.

Custom Apps

Custom apps are built for a single store. You can create them in the Shopify admin and generate an access token directly. They are simpler to set up and do not require OAuth. Custom apps are ideal for private integrations.

Access Scopes

Scopes define what your app can access (e.g., read_products, write_orders). Request only the scopes you need to follow the principle of least privilege. Merchants are more likely to install apps with minimal scopes.

Authentication for REST and GraphQL

For REST, include the access token in the X-Shopify-Access-Token header. For GraphQL, use the same header. For Storefront API, use a storefront access token.

3D illustration of a cloud connected to blocks

Webhooks and Sync: Keeping Data Consistent

Webhooks are essential for real-time integrations. Instead of polling the API for changes, you register a webhook topic (e.g., orders/create) and Shopify sends a POST request to your endpoint when the event occurs.

Common Webhook Topics

  • orders/create, orders/updated, orders/paid, orders/fulfilled
  • products/create, products/update, products/delete
  • customers/create, customers/update
  • inventory_levels/update

Best Practices for Webhooks

  1. Verify the webhook signature using the shared secret to ensure the request is from Shopify.
  2. Respond quickly with a 200 OK to avoid retries. Process the payload asynchronously if needed.
  3. Implement idempotency to handle duplicate deliveries.
  4. Use a queue to handle spikes and avoid timeouts.
  5. Monitor for failed deliveries and set up alerts.

Webhooks are not a replacement for a full sync. For initial data loads or recovery, you still need to fetch data via the API.

Rate Limits and Reliability for High-Volume Stores

Shopify enforces rate limits to ensure fair usage. The limits differ between REST and GraphQL and between plans.

REST Rate Limits

The REST Admin API uses a leaky bucket algorithm. For standard plans, the bucket size is 40 requests and leaks at 2 requests per second. For Shopify Plus, it is 80 requests and 4 per second. If you exceed the limit, you receive a 429 Too Many Requests response with a Retry-After header.

GraphQL Rate Limits

GraphQL uses a calculated cost per query. The limit is 1000 cost points per store per second, with a bucket size of 2000 points for standard and 4000 for Plus. Each query's cost is based on the number of objects and connections requested.

Handling Rate Limits

  • Implement exponential backoff with jitter when you receive a 429.
  • Use bulk operations for large data sets (GraphQL only).
  • Cache data where possible to reduce API calls.
  • Monitor your API usage and adjust your integration accordingly.

Build vs Buy: When a Custom Integration Pays Off

Many integrations can be handled by existing Shopify apps. But custom integrations make sense when:

  • You need to connect to a proprietary or legacy system that no app supports.
  • Your data flow is complex and requires custom logic.
  • You want full control over data and avoid per-order fees.
  • You need real-time sync with high volume and cannot tolerate app limitations.

Building a custom integration requires development resources, but it can be more cost-effective in the long run for complex needs. If you are considering a custom integration, our team can help. We build custom Shopify apps and integrations tailored to your business. Learn more on our Shopify apps page.

Checklist: Do You Need a Custom Integration?

  • Your systems are not supported by any existing app.
  • You need bi-directional sync with custom mapping.
  • You process high volumes and hit app rate limits.
  • You require specific security or compliance measures.
  • You want to avoid recurring per-transaction fees.

If you checked two or more, a custom integration is worth exploring.

Related reading

FAQ

Frequently asked questions

What is the difference between the REST and GraphQL Admin APIs?

REST is resource-based and simpler to use, while GraphQL lets you request exactly the data you need in a single query, reducing over-fetching and round trips. GraphQL is generally more efficient for complex integrations.

How do I authenticate with the Shopify integration API?

Public apps use OAuth 2.0 to obtain an access token per store. Custom apps can generate a token directly in the Shopify admin. Include the token in the X-Shopify-Access-Token header for both REST and GraphQL requests.

What are Shopify webhooks and why use them?

Webhooks are event notifications that Shopify sends to your endpoint when something changes, such as a new order. They enable real-time sync without polling the API, reducing load and latency.

How do I handle Shopify API rate limits?

Implement exponential backoff with jitter when you receive a 429 response. Use bulk operations for large data sets (GraphQL only), cache data, and monitor your usage to stay within limits.

When should I build a custom Shopify integration instead of using an app?

Consider a custom integration when you need to connect to unsupported systems, require complex custom logic, have high volume that hits app limits, or want to avoid recurring per-transaction fees.

Need a custom Shopify integration?

Our team can help you design and build a custom integration that fits your systems and scales with your business.