Skip to main content

GraphQL Storefront API

Create unique customer experiences with the Storefront API on any platform, including the web, apps, and games. The API offers a full range of commerce options making it possible for customers to view products and collections, add products to a cart, and check out.

Explore Hydrogen, Shopify’s official React-based framework for building headless commerce at global scale.

Anchor to Development frameworks and SDKsDevelopment frameworks and SDKs

Use Shopify’s officially supported libraries to build fast, reliable apps with the programming languages and frameworks you already know.

cURL

Use the curl utility to make API queries directly from the command line.

Hydrogen

A React-based framework for building custom storefronts on Shopify, Hydrogen has everything you need to build fast, and deliver personalized shopping experiences.

Storefront API Client

The official lightweight client for any Javascript project interfacing with Storefront API and our recommended client for building custom storefronts without Hydrogen.

Remix (Apps)

The official package for Remix applications, with full TypeScript support.

Node.js

The official client library for Node.js applications, with full TypeScript support. It has no framework dependencies, so it can be used by any Node.js app.

Shopify API (Apps)

The full suite library for TypeScript/JavaScript Shopify apps to access the GraphQL and REST Admin APIs and the Storefront API.

Ruby

The official client library for Ruby applications. It has no framework dependencies, so it can be used by any Ruby app. This API applies a rate limit based on the IP address making the request, which will be your server’s address for all requests made by the library. Learn more about rate limits.

Android

The official client library for Android apps.

iOS

The official client library for iOS applications.

Other

Other libraries are available in addition to the ones listed here. Check the list of developer tools for custom storefronts.


The Storefront API supports both tokenless access and token-based authentication.

Tokenless access allows API queries without an access token providing access to essential features such as:

  • Products and Collections
  • Selling Plans
  • Search
  • Pages, Blogs, and Articles
  • Cart (read/write)

Tokenless access has a query complexity limit of 1,000. Query complexity is calculated based on the cost of each field in the query. For more information, see the Cost calculation section.

Anchor to Token-based authenticationToken-based authentication

For access to all Storefront API features, an access token is required. The following features require token-based authentication:

  • Product Tags
  • Metaobjects and Metafields
  • Menu (Online Store navigation)
  • Customers

The Storefront API has the following types of token-based access:

  • Public access: Used to query the API from a browser or mobile app.
  • Private access: Used to query the API from a server or other private context, like a Hydrogen backend.

Learn more about access tokens for the Storefront API.


Anchor to Endpoints and queriesEndpoints and queries

The Storefront API is available only in GraphQL. There's no REST API for storefronts.

All Storefront API queries are made on a single GraphQL endpoint, which only accepts POST requests:

https://{store_name}.myshopify.com/api/2025-04/graphql.json

The Storefront API is versioned, with new releases four times a year. To keep your app stable, make sure that you specify a supported version in the URL.

Explore and learn Shopify's Storefront API using the GraphiQL explorer. To build queries and mutations with shop data, install Shopify's GraphiQL app.

  • Shopify Plus bot protection is only available for the Cart object. It isn't available for the Checkout object.
  • You can't use Storefront API to duplicate existing Shopify functionality—be sure to check the API terms of service before you start.

A directive provides a way for apps to describe additional options to the GraphQL executor. It lets GraphQL change the result of the query or mutation based on the additional information provided by the directive.

Anchor to Storefront DirectivesStorefront Directives

@inContext (Country Code)

In the Storefront API, the @inContext directive takes an optional country code argument and applies this to the query or mutation.

This example shows how to retrieve a list of available countries and their corresponding currencies for a shop that's located in France @inContext(country: FR).

@inContext (Language)

In the Storefront API, beyond version 2022-04, the @inContext directive can contextualize any query to one of a shop's available languages with an optional language code argument.

This example shows how to return a product's title, description, and options translated into Spanish @inContext(language: ES).

@inContext (Buyer Identity)

In the Storefront API, beyond version 2024-04, the @inContext directive can contextualize any query to a logged in buyer of a shop with an optional buyer argument.

This example shows how to return a product's price amount contextualized for a business customer buyer @inContext(buyer: {customerAccessToken: 'token', companyLocationId: 'gid://shopify/CompanyLocation/1'}).

@defer

The @defer directive allows clients to prioritize part of a GraphQL query without having to make more requests to fetch the remaining information. It does this through streaming, where the first response contains the data that isn't deferred.

The directive accepts two optional arguments: label and if. The label is included in the fragment response if it's provided in the directive. When the if argument is false, the fragment isn't deferred.

This example shows how to return a product's title and description immediately, and then return the descriptionHtml and options after a short delay.

The @defer directive is available as a developer preview in unstable.


The Storefront API is designed to support businesses of all sizes. The Storefront API will scale to support surges in buyer traffic or your largest flash sale. There are no rate limits applied on the number of requests that can be made to the API.

The Storefront API provides protection against malicious users, such as bots, from consuming a high level of capacity. If a request appears to be malicious, Shopify will respond with a 430 Shopify Security Rejection error code to indicate potential security concerns. Ensure requests to the Storefront API include the correct Buyer IP header.

Anchor to Query complexity limit for tokenless accessQuery complexity limit for tokenless access

Tokenless access has a query complexity limit of 1,000. This limit is calculated based on the cost of each field in the query in the same way as the GraphQL Admin API. For more information on how query costs are calculated, see the Cost calculation section in the API rate limits documentation.

When using tokenless access, query complexity that exceeds 1,000 will result in an error.


Anchor to Status and error codesStatus and error codes

All API queries return HTTP status codes that contain more information about the response.

The Storefront API can return a 200 OK response code in cases that would typically produce 4xx errors in REST.

The response for the errors object contains additional detail to help you debug your operation.

The response for mutations contains additional detail to help debug your query. To access this, you must request userErrors.

Properties

errors•array

A list of all errors returned

errors[n].message•string

Contains details about the error(s).

errors[n].extensions•object

Provides more information about the error(s) including properties and metadata.

extensions.code•string

Shows error codes common to Shopify. Additional error codes may also be shown.

ACCESS_DENIED

The client doesn’t have correct authentication credentials. Similar to 401 Unauthorized.

SHOP_INACTIVE

The shop is not active. This can happen when stores repeatedly exceed API rate limits or due to fraud risk.

INTERNAL_SERVER_ERROR

Shopify experienced an internal error while processing the request. This error is returned instead of 500 Internal Server Error in most circumstances.


Anchor to 4xx and 5xx status codes4xx and 5xx status codes

The 4xx and 5xx errors occur infrequently. They are often related to network communications, your account, or an issue with Shopify’s services.

Many errors that would typically return a 4xx or 5xx status code, return an HTTP 200 errors response instead. Refer to the 200 OK section above for details.


The server will not process the request.


Anchor to 402 Payment Required402 Payment Required

The shop is frozen. The shop owner will need to pay the outstanding balance to unfreeze the shop.


The shop is forbidden. Returned if the store has been marked as fraudulent.


The resource isn’t available. This is often caused by querying for something that’s been deleted.


The shop isn’t available. This can happen when stores repeatedly exceed API rate limits or due to fraud risk.


An internal error occurred in Shopify. Check out the Shopify status page for more information.


Info

Didn’t find the status code you’re looking for? View the complete list of API status response and error codes.


Was this page helpful?