Skip to main content

Simple IDs in the REST Admin API

Legacy

The REST Admin API is a legacy API as of October 1, 2024. All apps and integrations should be built with the GraphQL Admin API. For details and migration steps, visit our migration guide.

This guide describes how simple IDs work in the REST Admin API and how to retrieve simple IDs for different resources.


Shopify's REST Admin API contains simple IDs, which differ from global IDs. A simple ID is a unique series of numbers that identifies a REST resource:

Simple ID example

"id": 123456789

For example, the REST Admin API's DiscountCode resource includes an id property that has a simple ID as a value:

DiscountCode resource

{
"code": "SUMMERSALE10OFF",
"created_at": "2022-03-13T16:09:54-04:00",
"updated_at": "2022-03-13T16:09:54-04:00",
"id": 9808080986,
...
}

Simple IDs also exist for properties that have descriptive names appended by id. For example, the REST Admin API's GiftCard resource includes the following properties that each have a simple ID as a value:

GiftCard resource

{
"api_client_id": 123456789,
"customer_id": 234567890,
"line_item_id": 345678901,
"order_id": 456789012,
"user_id": 567890123,
...
}

Anchor to Finding equivalent IDs between REST and GraphQLFinding equivalent IDs between REST and GraphQL

Most REST Admin API resources include an admin_graphql_api_id property, which provides a global ID for the equivalent object in the GraphQL Admin API. For example, the following two properties on the Customer resource are equivalent:

Customer resource

{
"id": 123456789, // A simple ID for a Customer resource in the REST Admin API
"admin_graphql_api_id": "gid://shopify/Customer/123456789" // A global ID for the equivalent Customer object in the GraphQL Admin API
}

Similarly, most GraphQL Admin API objects include a legacyResourceId field, which provides a simple ID for the equivalent resource in the REST Admin API. For example, the following two fields on the Product object are equivalent:

POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

GraphQL query

{
products(first:5) {
edges {
node {
id # A global ID for the Product object in the GraphQL Admin API
legacyResourceId # A simple ID for the equivalent Product resource in the REST Admin API
}
}
}
}

JSON response

{
"data": {
"products": {
"edges": [
{
"node": {
"id": "gid://shopify/Product/4353554645014",
"legacyResourceId": "4353554645014"
}
},
{
"node": {
"id": "gid://shopify/Product/4353554710550",
"legacyResourceId": "4353554710550"
}
},
{
"node": {
"id": "gid://shopify/Product/4358159007766",
"legacyResourceId": "4358159007766"
}
},
{
"node": {
"id": "gid://shopify/Product/5591484858390",
"legacyResourceId": "5591484858390"
}
},
{
"node": {
"id": "gid://shopify/Product/5591485448214",
"legacyResourceId": "5591485448214"
}
}
]
}
}
}

Was this page helpful?