Getting started with the Storefront API

The Storefront API provides unauthenticated access to products, collections, customers, checkouts, and other store resources that you can use to build custom purchasing experiences.

This tutorial shows you how to accomplish some common tasks with the Storefront API.

Requirements

  • You've authenticated using basic HTTP authentication for your private app or using OAuth for your public or custom app. If you're authenticating to the Storefront API as a public app, then you need to turn your app into a sales channel.

    The following example URL shows how you request unauthenticated scopes during OAuth:

  • You've obtained a Storefront API access token and included it in your request header:

  • You've created products, product variants, and collections in your store.

Recommendations

If you're a Shopify Partner, then you can create a development store to test Storefront API queries.

1. Retrieve products

To retrieve a list of products, you can query products. The products field uses an argument (for example, first) to specify the number of results to retrieve.

The following example shows how to retrieve the IDs of the first 5 products in your store. For more information on selecting which set of results to retrieve, refer to Paginating results with GraphQL.

Query: POST /api/2021-07/graphql.json

View response

2. Retrieve a single product

Products are ide