GraphQL
Compose store, product, collection, seller, and review reads through POST /graphql.
Last updated:
GraphQL is an additional way to consume selected Storefront API reads. REST retains the complete contract and remains the interface for every write operation.
GraphQL and REST coexist
Use GraphQL when a screen needs to combine several reads or select a small set of fields. Use REST for carts, checkout, customers, geography, tracking, analytics, and every operation that changes data.
Quick start
Send a document through POST and resolve the store with x-Store-Domain:
curl --request POST "https://storefront.ecomiq.pe/graphql" \
--header "Content-Type: application/json" \
--header "x-Store-Domain: my-store" \
--data-binary '{
"query": "query Store { store { id name currency language } }"
}'{
"data": {
"store": {
"id": "7204558912004325301",
"name": "My store",
"currency": "PEN",
"language": "en"
}
}
}IDs are opaque strings. Store and send them back without interpreting their format.
Available queries
These are all reads currently published on the root Query:
store
Store identity, basic branding, type, currency, and language.
products
Paginated search with filters, facets, and sorting.
product
Complete product details by slug.
relatedProducts
Related products from a product ID.
collections
Visible collections with search and sorting.
collection
One published collection by slug.
sellers
Visible sellers and their public reputation.
seller
A seller's public profile and policies.
productReviews
Reviews with cursor, search, rating, and sorting.
Choose GraphQL or REST
| Need | Recommended interface |
|---|---|
| Combine store, seller, and products in one response | GraphQL |
| Request only a subset of a resource's fields | GraphQL |
| Search products with filters equivalent to the REST catalog | GraphQL or REST |
| Create or update a cart, checkout, or customer | REST |
| Read geography, tracking, or analytics | REST |
| Consume an OpenAPI contract or Postman collection | REST |
The current schema exposes Query and does not expose Mutation. The REST reference documents the rest of Storefront API.