| [ Web Proxy ] |
| Viewing: https://shopify.dev/docs/api/admin | [Back] [Original] |
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 Shopifys GraphQL API.
Use Shopifys officially supported libraries to build fast, reliable apps with the programming languages and frameworks you already know.
The official package for React Router applications.
Node.jsThe official client library for Node.js apps. No framework dependenciesworks with any Node.js app.
RubyThe official client library for Ruby apps.
cURLUse the curl utility to make API queries directly from the command line.
Direct API Access
Make requests to the Admin API directly from your app using the standard web fetch API. Requests are automatically authenticated and fast because Shopify handles them directly.
Need a different language? Check the list of community-supported libraries.
npm install -g @shopify/cli@latest
shopify app initnpm install --save @shopify/shopify-api
# or
yarn add @shopify/shopify-apibundle add shopify_api# cURL is often available by default on macOS and Linux.
# See http://curl.se/docs/install.html for more details.# Enable Direct API access in App Home.
[access.admin]
embedded_app_direct_api_access = trueEvery GraphQL Admin API request carries an access token in the X-Shopify-Access-Token header. For most apps you don't fetch or set that token yourself: the Shopify CLI template and Direct API access authenticate each request for you. To set up authentication for your app type, see About app authentication. For the token types and the grants that issue them, see access tokens.
The tabs show the same request through Shopify's client libraries and as a raw HTTP call.
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 building apps.
import { authenticate } from "../shopify.server";
export async function loader({request}) {
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`query { shop { name } }`,
);
}const client = new shopify.clients.Graphql({session});
const response = await client.query({data: 'query { shop { name } }'});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: 'query { shop { name } }')# Replace {SHOPIFY_ACCESS_TOKEN} with your actual access token
curl -X POST \
https://{shop}.myshopify.com/admin/api/2026-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {SHOPIFY_ACCESS_TOKEN}' \
-d '{
"query": "query { shop { name } }"
}'// Authentication is handled automatically!
const response = await fetch('shopify:admin/api/2026-07/graphql.json', {
method: 'POST',
body: JSON.stringify({
query: `query { shop { name } }`,
}),
});
const { data } = await response.json();
console.log(data);GraphQL queries are executed by sending POST HTTP requests to the endpoint:
https://{store_name}.myshopify.com/admin/api/2026-07/graphql.json
Queries begin with one of the objects listed under QueryRoot. The QueryRoot is the schemas 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 Shopifys GraphiQL app.
Explore and learn Shopify's Admin API using GraphiQL Explorer. To build queries and mutations with shop data, install Shopifys GraphiQL app.
import { authenticate } from "../shopify.server";
export async function loader({request}) {
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query getProducts {
products (first: 3) {
edges {
node {
id
title
}
}
}
}`,
);
const json = await response.json();
return { products: json?.data?.products?.edges };
}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,
)# Get the ID and title of the three most recently added products
curl -X POST https://{store_name}.myshopify.com/admin/api/2026-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "{
products(first: 3) {
edges {
node {
id
title
}
}
}
}"
}'const response = await fetch('shopify:admin/api/2026-07/graphql.json', {
method: 'POST',
body: JSON.stringify({
query: `{
products(first: 3) {
edges {
node {
id
title
}
}
}
}`,
}),
});
const { data } = await response.json();
console.log(data);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.
All API queries return HTTP status codes that contain more information about the response.
GraphQL HTTP status codes are different from REST API status codes. Most importantly, the GraphQL API can return a 200 OK response code in cases that would typically produce 4xx or 5xx errors in REST.
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 userErrors.
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 doesnt 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.
The 4xx and 5xx errors occur infrequently. They are often related to network communications, your account, or an issue with Shopifys 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.
{
"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/limits#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"
}
}
]
}The 4xx and 5xx errors occur infrequently. They are often related to network communications, your account, or an issue with Shopifys 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 RequestThe server will not process the request.
402 Payment RequiredThe shop is frozen. The shop owner will need to pay the outstanding balance to unfreeze the shop.
403 ForbiddenThe shop is forbidden. Returned if the store has been marked as fraudulent.
404 Not FoundThe resource isnt available. This is often caused by querying for something thats been deleted.
423 LockedThe shop isnt available. This can happen when stores repeatedly exceed API rate limits or due to fraud risk.
5xx ErrorsAn internal error occurred in Shopify. Check out the Shopify status page for more information.
Didnt find the status code youre looking for? View the complete list of API status response and error codes.
Didnt find the status code youre looking for? View the complete list of API status response and error codes.
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"
}| Web Proxy Viewer | New URL | Original Page |