The Admin REST API client provides methods for making REST requests to the Shopify Admin API.
createAdminRestApiClient()
Creates a REST client for the Shopify Admin API with methods for GET, POST, PUT, and DELETE requests.
import { createAdminRestApiClient } from '@shopify/shopify-app-js' ;
const client = createAdminRestApiClient ({
storeDomain: 'my-store.myshopify.com' ,
apiVersion: '2025-10' ,
accessToken: 'shpat_xxxxx' ,
});
Parameters
The Shopify store domain (e.g., my-store.myshopify.com)
The Admin API version to use (e.g., 2025-10)
Admin API access token for authentication
Optional prefix to add to the User-Agent header
Number of retry attempts for failed requests
customFetchApi
CustomFetchApi
default: "fetch"
Custom fetch implementation (defaults to global fetch)
Logger function for debugging and monitoring requests
scheme
'https' | 'http'
default: "'https'"
URL scheme to use for requests
Default wait time in milliseconds between retry attempts
Automatically format paths to include /admin/api/{version}/ and .json extension
Set to true to skip server-side usage validation during testing
Returns
REST API client instance with HTTP methods: Execute GET request client . get ( path : string , options ?: GetRequestOptions )
Execute POST request client . post ( path : string , options : PostRequestOptions )
Execute PUT request client . put ( path : string , options : PutRequestOptions )
Execute DELETE request client . delete ( path : string , options ?: DeleteRequestOptions )
Client Methods
get()
Execute a GET request to the Admin REST API.
const response = await client . get ( '/products' , {
searchParams: {
limit: 10 ,
status: 'active' ,
},
});
const products = await response . json ();
API endpoint path (e.g., /products or /products/123) When formatPaths is true (default), the path is automatically formatted:
/products → /admin/api/2025-10/products.json
Leading slashes are removed
.json extension is added if not present
Request options: URL query parameters as key-value pairs. Supports nested objects and arrays: searchParams : {
limit : 10 ,
fields : [ 'id' , 'title' ],
created_at : {
min : '2024-01-01' ,
},
}
Additional headers to include in the request
Override the client’s default retry count for this request
Override the client’s default API version for this request
post()
Execute a POST request to the Admin REST API.
const response = await client . post ( '/products' , {
data: {
product: {
title: 'New Product' ,
body_html: '<p>Product description</p>' ,
vendor: 'My Vendor' ,
},
},
});
const newProduct = await response . json ();
options
PostRequestOptions
required
Request options: data
Record<string, any> | string
required
Request body data. Objects are automatically serialized to JSON.
Additional headers to include in the request
Override the client’s default retry count for this request
Override the client’s default API version for this request
put()
Execute a PUT request to the Admin REST API.
const response = await client . put ( '/products/123' , {
data: {
product: {
title: 'Updated Product Title' ,
},
},
});
const updatedProduct = await response . json ();
options
PutRequestOptions
required
Request options (same as POST options)
delete()
Execute a DELETE request to the Admin REST API.
const response = await client . delete ( '/products/123' );
if ( response . ok ) {
console . log ( 'Product deleted successfully' );
}
Request options (same as GET options)
Response Handling
All methods return a standard Response object from the Fetch API. You can parse the response using:
// Parse JSON response
const data = await response . json ();
// Get response text
const text = await response . text ();
// Check status
if ( response . ok ) {
// Status is 2xx
}
// Get headers
const rateLimit = response . headers . get ( 'X-Shopify-Shop-Api-Call-Limit' );
Example Usage
Get Products
Create Product
Update Product
Delete Product
Search Params
Custom Headers
Error Handling
Rate Limit Handling
import { createAdminRestApiClient } from '@shopify/shopify-app-js' ;
const client = createAdminRestApiClient ({
storeDomain: 'my-store.myshopify.com' ,
apiVersion: '2025-10' ,
accessToken: process . env . SHOPIFY_ADMIN_TOKEN ,
});
// Get all products
const response = await client . get ( '/products' , {
searchParams: {
limit: 50 ,
status: 'active' ,
},
});
const { products } = await response . json ();
console . log ( `Found ${ products . length } products` );
By default, the client automatically formats paths:
// With formatPaths: true (default)
client . get ( '/products' );
// → GET https://my-store.myshopify.com/admin/api/2025-10/products.json
// Disable automatic formatting
const client = createAdminRestApiClient ({
storeDomain: 'my-store.myshopify.com' ,
apiVersion: '2025-10' ,
accessToken: 'token' ,
formatPaths: false ,
});
client . get ( '/admin/api/2025-10/products.json' );
// → GET https://my-store.myshopify.com/admin/api/2025-10/products.json
Search Parameters
The searchParams option supports:
Primitives : strings, numbers, booleans
Arrays : converted to key[]=value format
Objects : converted to key[nested]=value format
{
searchParams : {
limit : 10 , // → limit=10
fields : [ 'id' , 'title' ], // → fields[]=id&fields[]=title
created_at : {
min : '2024-01-01' , // → created_at[min]=2024-01-01
max : '2024-12-31' , // → created_at[max]=2024-12-31
},
}
}
Types
type SearchParams = Record < string , SearchParamFields >;
type SearchParamFields =
| string
| number
| SearchParamField []
| Record < string , SearchParamField | SearchParamField []>;
type HeaderOptions = Record < string , string | number | string []>;
interface GetRequestOptions {
headers ?: HeaderOptions ;
searchParams ?: SearchParams ;
retries ?: number ;
apiVersion ?: string ;
}
interface PostRequestOptions extends GetRequestOptions {
data : Record < string , any > | string ;
}
interface PutRequestOptions extends PostRequestOptions {}
interface DeleteRequestOptions extends GetRequestOptions {}