Skip to main content

Fetch products by multiple IDs

Retrieve a batch of products by their IDs in a single query.

Query

query GetProductsByIds($productIds: [Int!]!) {
products(input: {
productIds: $productIds
}) {
itemsFound
items {
... on Product {
productId
sku
names { language value }
status
}
}
}
}

Variables

{
"productIds": [25, 1895, 1920]
}

Response

{
"data": {
"products": {
"itemsFound": 3,
"items": [
{ "productId": 25, "sku": "BOSCH-GBH-2-26", "names": [{ "language": "NL", "value": "Bosch GBH 2-26 boorhamer" }], "status": "A" },
{ "productId": 1895, "sku": "HP-450G10-I5", "names": [{ "language": "NL", "value": "HP ProBook 450 G10 i5" }], "status": "A" },
{ "productId": 1920, "sku": "LN-T14S-G4", "names": [{ "language": "NL", "value": "Lenovo ThinkPad T14s Gen 4" }], "status": "A" }
]
}
}
}

How it works

Only returns products with status A by default. If some of your IDs refer to products with other statuses, add statuses: [A, N, P, S, R, T] to get them all. The same pattern works for skus: [...] to batch-fetch by SKU.

See also