Shop Users API
The Shop Users API is a GraphQL API scoped to an individual Shop user. Use it to read and write metafields that your app owns on a Shop user's profile. 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.