GraphQL Admin API reference
The Admin API lets you build apps and integrations that extend and enhance the Shopify admin.
This page will help you get up and running with Shopify’s GraphQL API.
Client libraries
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.
Remix
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.
Ruby
The official client library for Ruby apps.
Other
Need a different language? Check the list of community-supported libraries.
1npm install --save @shopify/shopify-app-remix2# or3yarn add @shopify/shopify-app-remix
# cURL is often available by default on macOS and Linux.
#
# See http://curl.se/docs/install.html for more details.
npm install --save @shopify/shopify-app-remix
# or
yarn add @shopify/shopify-app-remix
npm install --save @shopify/shopify-api
# or
yarn add @shopify/shopify-api
bundle add shopify_api
Authentication
All GraphQL Admin API queries require a valid Shopify access token.
Public and custom apps created in the Partner Dashboard generate tokens using OAuth, and custom apps made in the Shopify admin are authenticated in the Shopify admin.
Include your token as a X-Shopify-Access-Token
header on all API queries. Using Shopify’s supported client libraries can simplify this process.
To keep the platform secure, apps need to request specific access scopes during the install process. Only request as much data access as your app needs to work.
Learn more about getting started with authentication and building apps.
1const {admin} = shopify.authenticate.admin(request);
curl -X POST \
https://{shop}.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {password}' \
-d '{
"query": "{your_query}"
}'
const {admin} = shopify.authenticate.admin(request);
const client = new shopify.clients.Graphql({session});
const response = await client.query({data: '{your_query}'});
session = ShopifyAPI::Auth::Session.new(
shop: 'your-development-store.myshopify.com',
access_token: access_token,
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
response = client.query(query: '{your_query}')
Endpoint and queries
GraphQL queries are executed by sending POST HTTP requests to the endpoint:
POSThttps:/
Queries begin with one of the objects listed under QueryRoot. The QueryRoot is the schema’s entry-point for queries.
Queries are equivalent to making a GET request in REST. The example shown is a query to get the ID and title of the first three products.
Learn more about API usage.
Explore and learn Shopify’s Admin API using GraphiQL Explorer. To build queries and mutations with shop data, install Shopify’s GraphiQL app.
https://{store_name}.myshopify.com/admin/api/2025-01/graphql.json
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query getProducts {6 products (first: 3) {7 edges {8 node {9 id10 title11 }12 }13 }14 }`15);1617const data = await response.json();
# Get the ID and title of the three most recently added products
curl -X POST https://{store_name}.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "{
products(first: 3) {
edges {
node {
id
title
}
}
}
}"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query getProducts {
products (first: 3) {
edges {
node {
id
title
}
}
}
}`
);
const data = await response.json();
const queryString = `{
products (first: 3) {
edges {
node {
id
title
}
}
}
}`
// `session` is built as part of the OAuth process
const client = new shopify.clients.Graphql({session});
const products = await client.query({
data: queryString,
});
query = <<~GQL
{
products (first: 3) {
edges {
node {
id
title
}
}
}
}
GQL
# session is built as part of the OAuth process
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
products = client.query(
query: query,
)
Rate limits
The GraphQL Admin API is rate-limited using calculated query costs, measured in cost points. Each field returned by a query costs a set number of points. The total cost of a query is the maximum of possible fields selected, so more complex queries cost more to run.
Learn more about rate limits.
{} Request
1{2 products(first: 1) {3 edges {4 node {5 title6 }7 }8 }9}
{} Response
1{2 "data": {3 "products": {4 "edges": [5 {6 "node": {7 "title": "Hiking backpack"8 }9 }10 ]11 }12 },13 "extensions": {14 "cost": {15 "requestedQueryCost": 3,16 "actualQueryCost": 3,17 "throttleStatus": {18 "maximumAvailable": 1000.0,19 "currentlyAvailable": 997,20 "restoreRate": 50.021 }22 }23 }24}
Status and error codes
All API queries return HTTP status codes that contain more information about the response.
200 OK
GraphQL HTTP status codes are different from REST API status codes. Most importantly, the GraphQL API can return a response code in cases that would typically produce 4xx or 5xx errors in REST.
Error 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 .
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 has exceeded the rate limit. Similar to 429 Too Many Requests.
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.
{} Sample 200 error responses
1{2 "errors": [3 {4 "message": "Query cost is 2003, which exceeds the single query max cost limit (1000).56See https://shopify.dev/concepts/about-apis/rate-limits for more information on how the7cost of a query is calculated.89To query larger amounts of data with fewer limits, bulk operations should be used instead.10See https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api for usage details.11",12 "extensions": {13 "code": "MAX_COST_EXCEEDED",14 "cost": 2003,15 "maxCost": 1000,16 "documentation": "https://shopify.dev/api/usage/rate-limits"17 }18 }19 ]20}
{
"errors": [
{
"message": "Query cost is 2003, which exceeds the single query max cost limit (1000).
See https://shopify.dev/concepts/about-apis/rate-limits for more information on how the
cost of a query is calculated.
To query larger amounts of data with fewer limits, bulk operations should be used instead.
See https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api for usage details.
",
"extensions": {
"code": "MAX_COST_EXCEEDED",
"cost": 2003,
"maxCost": 1000,
"documentation": "https://shopify.dev/api/usage/rate-limits"
}
}
]
}
{
"errors": [
{
"message": "Internal error. Looks like something went wrong on our end.
Request ID: 1b355a21-7117-44c5-8d8b-8948082f40a8 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "1b355a21-7117-44c5-8d8b-8948082f40a8"
}
}
]
}
4xx 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.
400 Bad Request
The server will not process the request.
402 Payment Required
The shop is frozen. The shop owner will need to pay the outstanding balance to unfreeze the shop.
403 Forbidden
The shop is forbidden. Returned if the store has been marked as fraudulent.
404 Not Found
The resource isn’t available. This is often caused by querying for something that’s been deleted.
423 Locked
The shop isn’t available. This can happen when stores repeatedly exceed API rate limits or due to fraud risk.
5xx 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.
{} Sample error codes
12HTTP/1.1 400 Bad Request3{4 "errors": {5 "query": "Required parameter missing or invalid"6 }7}
HTTP/1.1 400 Bad Request
{
"errors": {
"query": "Required parameter missing or invalid"
}
}
HTTP/1.1 402 Payment Required
{
"errors": "This shop's plan does not have access to this feature"
}
HTTP/1.1 403 Access Denied
{
"errors": "User does not have access"
}
HTTP/1.1 404 Not Found
{
"errors": "Not Found"
}
HTTP/1.1 423 Locked
{
"errors": "This shop is unavailable"
}
HTTP/1.1 500 Internal Server Error
{
"errors": "An unexpected error occurred"
}