Skip to main content
Version: 2.0.0

GraphQL API

yStore registers its own GraphQL operations on top of Craft CMS's native GraphQL layer. All operations are available at the /api endpoint using POST.

POST /api
Content-Type: application/json

{ "query": "{ products { title } }" }
Endpoint

The default GraphQL endpoint is /api. If you've changed Craft's GraphQL endpoint in config/general.php, use your custom path instead.

Authentication

Operation typeAuth required
Product queriesNo (public)
Cart operations (with cartId)No (guest-safe)
Customer account operationsYes (logged-in customer session)
Order cancellation by guestEmail + order number verification
Token-based auth

If you are building a headless app, make sure your Craft GraphQL token has the correct schema permissions. yStore respects Craft's native GraphQL schema access controls.

Input types reference

All GraphQL mutations accept typed input objects. The most common ones:

Input typeUsed in
CartItemInputaddProductsToCart
AddressInputsetShippingAddressOnCheckout, setBillingAddressOnCheckout
ShippingMethodInputsetShippingMethodOnCheckout
PaymentMethodInputsetPaymentMethodOnCheckout

Checkout flow (mutations sequence)

createGuestCart / createCustomerCart
→ addProductsToCart
→ setShippingAddressOnCheckout
→ setShippingMethodOnCheckout
→ setBillingAddressOnCheckout (or same_as_shipping: true)
→ setPaymentMethodOnCheckout
→ placeOrder
Schema introspection

If any doc page and your runtime schema differ, always trust your running instance. Use GraphQL introspection to inspect the exact available fields for your build:

{ __schema { types { name fields { name } } } }