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.
Other
Other libraries are available in addition to the ones listed here. Check the list of developer tools for custom storefronts.
Anchor to AuthenticationAuthentication
The Storefront API is unauthenticated, meaning all users have read-only access, with no username or password required.
Apps that enable the Storefront API must explicitly request relevant unauthenticated access scopes during OAuth, or during authentication in the Shopify admin.
Requests to the GraphQL Storefront API require a valid Shopify access token.
The Storefront API has the following types of 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
Anchor to VersioningVersioning
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.
Anchor to GraphiQL explorerGraphi QL explorer
Explore and learn Shopify's Storefront API using the GraphiQL explorer. To build queries and mutations with shop data, install Shopify's GraphiQL app.
Anchor to Usage limitationsUsage limitations
- 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.
Anchor to DirectivesDirectives
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
.
Anchor to Rate limitsRate limits
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 Status and error codesStatus and error codes
All API queries return HTTP status codes that contain more information about the response.
Anchor to 200 OK200 OK
The Storefront API can return a 200 OK
response code in cases that would typically produce 4xx errors in REST.
Anchor to Error handlingError handling
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
A list of all errors returned
Contains details about the error(s).
Provides more information about the error(s) including properties and metadata.
Shows error codes common to Shopify. Additional error codes may also be shown.
The client doesn’t have correct authentication credentials. Similar to 401 Unauthorized.
The shop is not active. This can happen when stores repeatedly exceed API rate limits or due to fraud risk.
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.
Anchor to 400 Bad Request400 Bad Request
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.
Anchor to 403 Forbidden403 Forbidden
The shop is forbidden. Returned if the store has been marked as fraudulent.
Anchor to 404 Not Found404 Not Found
The resource isn’t available. This is often caused by querying for something that’s been deleted.
Anchor to 423 Locked423 Locked
The shop isn’t available. This can happen when stores repeatedly exceed API rate limits or due to fraud risk.
Anchor to 5xx Errors5xx Errors
An internal error occurred in Shopify. Check out the Shopify status page for more information.
Didn’t find the status code you’re looking for? View the complete list of API status response and error codes.