Shop Users API
The Shop Users API is a GraphQL API scoped to an individual Shop user. Use it to read and write metafields, manage product lists (wishlists), and access favorites. You authenticate with a user access token obtained from the Shop Partners API.
Anchor to AuthenticationAuthentication
The Shop Users API uses Bearer token authentication. You get user access tokens by calling the fetchTokensForUser mutation on the Shop Partners API.
- Authenticate with the Partners API using your client credentials.
- Call
fetchTokensForUserwith the user's public ID to get anaccessTokenandrefreshToken. - Include the access token as a
Bearertoken in theAuthorizationheader on all Users API requests.
cURL
Access tokens expire after a set time. When a token expires, use the refreshToken to get a new one.
Anchor to Endpoints and queriesEndpoints and queries
Send POST requests to the Users API endpoint:
https://shop.app/api/users/graphql.json
All requests must include a Content-Type: application/json header and a JSON body with a query field containing your GraphQL query or mutation.
Anchor to Key operationsKey operations
Anchor to MetafieldsMetafields
Read and write custom data on the authenticated user's profile. Metafield definitions are created through the Shop Partners API, and you can read or write values for those definitions through the Users API.
| Query | Description |
|---|---|
metafield | Retrieve a single metafield by key |
metafields | List metafields with pagination and filtering |
| Mutation | Description |
|---|---|
metafieldsSet | Set or update metafield values on the user |
metafieldDelete | Delete a metafield from the user |
Metafield definitions are created and managed through the Shop Partners API.
Anchor to FavoritesFavorites
Add and remove items from the user's default favorites list.
| Mutation | Description |
|---|---|
favoritesAdd | Add a product variant to the user's favorites |
favoritesRemove | Remove a product variant from the user's favorites |
You can also query favorites through the user query:
Query favorites
Anchor to Product listsProduct lists
Create and manage named product lists (for example, wishlists) for the authenticated user. Each user has a default favorites list and can create additional lists.
| Query | Description |
|---|---|
user.productList | Retrieve a single product list by ID |
user.productLists | List all product lists for the user |
| Mutation | Description |
|---|---|
productListCreate | Create a new product list |
productListUpdate | Update a product list's name or privacy status |
productListDelete | Delete a product list |
productListItemAdd | Add a product variant to a list |
productListItemRemove | Remove a product variant from a list |
Product lists support a privacyStatus of PUBLIC or PRIVATE (default).