The Storefront API is the foundational layer of custom storefronts. It provides you the commerce primitives to build custom, scalable, and performant shopping experiences

## What is the Storefront API?

The Storefront API provides access to Shopify's primitives and capabilities such as displaying products and collections, adding items to the cart, calculating contextual pricing, and more.

You can use the Storefront API to build unique commerce experiences on any platform, including the web, native apps, games, and social media, using the frontend tools of your choice.

![The Storefront API's function as layer between Shopify's backend and its commerce primitives, and customer touchpoints such as mobile, social media, and web](/assets/custom-storefronts/storefront-api/how-does-sfapi-work.png)

## When to use the Storefront API

The Storefront API helps you create a seamless and engaging shopping experience for your customers by leveraging the robust commerce functionality of Shopify. Headless builds are made efficient and performant with the following resources:

- **Built-in commerce essentials**: Leverage the full power of the Shopify admin to manage your back-office products like pricing, inventory, and metafields. Use the Storefront API to deliver performant buyer experiences with optimized cart, contextual pricing, subscriptions, and more.
- **Operate at a global scale**: Backed by the infrastructure that supports over 2 million Shopify businesses, build your custom storefront on the platform that's fast, flexible, and feature-rich.
- **Build your way**: Bring your own tech stack, requirements, and experience. Build on top of Shopify’s proven Storefront API that serves 1M+ queries per minute.
- **[Developer tools](#developer-tools)**: Improve your developer experience by helping you learn about the API.

Because the Storefront API uses the Shopify backend, you can focus on building a unique and customized shopping experience with strong brand representation. You can create custom pages, themes, and order management experiences that are fully integrated with a storefront.

## API versioning

The Storefront API is [versioned](/docs/api/usage/versioning), with new releases four times a year. We strongly recommend updating your apps to make requests to the latest stable API version every quarter. However, if your app uses a stable version that is no longer supported, then Shopify falls forward and responds to your request with the same behavior as the oldest supported stable version.

## Authentication and authorization

There are two methods of authentication for the Storefront API:

**Public Authentication**: The public token is used for client side queries and mutations. As every buyer has a different IP, the token scales to support large amounts of traffic.

**Private Access**: The private token provides authenticated access to the Storefront API and is used for server-side queries and mutations.

> Caution:
> Unlike public access tokens, private access tokens should be treated as secret and not used on the client-side. We recommend only requesting the scopes that your app needs, to reduce the security risk if the token leaks.


Learn more about [authentication](/docs/api/usage/authentication).

## What is the Headless channel?



Make headless and self-hosted Hydrogen experiences possible in the Headless channel without needing to create a custom app.

The Headless channel provides a single place to create and manage access tokens for the [Storefront API](/docs/api/storefront). You can use the channel to create multiple custom storefronts. Storefronts that you create through the channel automatically include public and private access tokens with shop permission for the Storefront API. In the channel, you can rotate your private access token and manage storefront permissions.

Additionally, the channel gives you all of Shopify's channel features, such as product publishing and order attribution, and analytics and reporting sales by channel. Order attribution is at the channel level, and a Headless storefront is treated as a channel.


<figure class="figure"><img src="https://cdn.shopify.com/shopifycloud/shopify_dev/assets/custom-storefronts/storefront-api/headless-channel-3393dd2e7567ff4d90a5d105d1517b4140037aea4b6cbabaaf86a330e196ecd3.png" class="lazyload" alt="An image of a developer installing the Headless channel. The channel provides public and private access tokens, options to manage storefront permissions, and tools for order attribution. Requests to the API for storefront data can be made from public and private contexts. The data is sent to the storefront, which serves data and passes back data such as what is used for attributing orders to the channel" width="3164" height="1252"></figure>

[Get started with the Headless channel](/docs/storefronts/headless/building-with-the-storefront-api/getting-started).




## Reference

<div class="resource-card-grid">
  <div>
  <a class="resource-card" href="/docs/api/storefront" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/graphql"
     data-alt-src="/assets/resource-cards/graphql-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      Storefront API reference
    </h3>
    <p class="resource-card__description">Consult the Storefront API reference for available objects, queries, and mutations.</p>
  </a>
</div>

</div>


## Developer tools

Shopify provides tools to help you learn how to use the Storefront API.

<div class="resource-card-grid">
  <div>
  <a class="resource-card" href="/docs/storefronts/headless/building-with-the-storefront-api/api-exploration/graphiql-storefront-api" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/graphql"
     data-alt-src="/assets/resource-cards/graphql-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      Storefront API GraphiQL explorer
    </h3>
    <p class="resource-card__description">Use the interactive GraphiQL explorer for the Storefront API on a demo shop.</p>
  </a>
</div>

<div>
  <a class="resource-card" href="https://github.com/Shopify/storefront-api-learning-kit" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/growth"
     data-alt-src="/assets/resource-cards/growth-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      Storefront API learning kit
    </h3>
    <p class="resource-card__description">A downloadable package of a complete set of sample GraphQL queries to the Storefront API</p>
  </a>
</div>

</div>


## Limitations

- You can have a maximum of 100 active storefronts and access tokens per shop.


## Next steps

- [Get started](/docs/storefronts/headless/building-with-the-storefront-api/getting-started) building headless with the Storefront API and start querying data.