Swell's GraphQL server allows you to implement frontend features like displaying products, managing carts, and applying discounts.

The GraphQL API is in an experimental alpha state and has multiple limitations detailed below. We intend to release a new version in the future with an improved implementation, but do not have a development timeframe. The current API will remain available, however features and bug fixes will not be prioritized.

  • Pre-load storefront pages by fetching specific products, categories, store settings, nav menus, and custom content ahead of time
  • Create, recover, and update accounts
  • Manage changes and statuses of shopping carts
  • Authenticate customers and allow them to edit account details, orders, and subscriptions
  • Format prices in localized currencies
  • Does not support nested queries
  • Does not return records from the content model namespace in results unless they have published: true
  • Does not support custom input arguments for client-side field editing
  • Does not return saved customer cards and addresses
  • Cannot render payment elements or tokenize cards, as this requires insertion of secure DOM elements
  • Cannot update cart email for guest checkout flows
  • Cannot recover abandoned carts

Swell offers a GraphQL playground to test and optimize your queries. To use it, login to your dashboard and navigate directly to https://<your-store-id>.swell.store/playground.

Start by adding your public key to the HTTP Headers section.

Authorization header
{
  "Authorization": "pk_test..."
}

Your store's GraphQL server is available at https://<your-store-id>.swell.store/graphql/v2. You will need to include the authorization header as shown above.

Queries accept the following arguments. Combine them as needed: for example, (limit: 5, page: 1) returns the first page of results, 5 per page.

ArgumentTypeDescription
idStringID of the record to return, in single-record queries.
slugStringSlug of the record to return, in single-record queries on models that have one, such as products and categories.
numberStringNumber of the record to return, in single-record queries on models identified by number, such as orders.
searchStringText to search results by.
whereJSONCriteria to filter results by field values.
sortStringField to sort results by, for example `name`.
limitIntMaximum number of results to return.
pageIntPage of results to return.
_localeStringLocale code to return content in, with or without a country code, for example `en` or `en-US`.
_currencyStringThree-letter ISO currency code to return prices in, for example `USD`.
_pricingProductPricingProduct queries only. An object with `quantity` and `accountId` to calculate prices for.
_previewBooleanContent model queries only. Indicates whether to return preview content.