GraphQL Endpoint - https://<store domain>/api/graphql/
Use the GraphiQL browser client to write, validate, and test your GraphQL queries.
Returns current user account information.
{
me {
id
firstName
lastName
metadata
pk
email
}
}
mutation {
register(
input: {email: "<EMAIL>", password: "<PASSWORD>", language: en, acceptsMarketing: true}
) {
success
errors
}
}
Returns a JWT authentication token to make authenticated requests.
mutation {
tokenAuth(input: {email: "<USER EMAIL>", password: "<USER PASSWORD>"}) {
success
user {
id
email
firstName
lastName
}
errors
token
}
}
Verify a JWT token is valid, used to check if need to ask the current user needs to re-authenticate.
mutation {
verifyToken(
input: {token: "<JWT TOKEN>"}
) {
success
payload
}
}
Update the current authenticated user account. Requires Authorization header with valid JWT token
mutation {
updateAccount(input: {lastName: "Example", acceptsMarketing: false}) {
success
errors
}
}
Use the tokenAuth
endpoint to get a valid JWT token.
{
"Authorization": "JWT <AUTH TOKEN>"
}
Create a new cart, also allows you to get the ID of the current cart by passing an empty object to input, ie input:{}
.
mutation {
createCart(
input: {lines: [{productPk: 1, quantity: 1}], replace: true, attribution: {utmSource: "test12123"}}
) {
cart {
id
pk
totalInclTax
totalExclTax
lines {
pk
unitPriceExclTax
linePriceExclTax
linePriceExclTaxInclDiscounts
discountValue
attributes {
option
value
}
}
attribution {
utmSource
}
user {
email
}
}
success
errors
}
}
Add line items to a cart.
mutation {
addCartLines(
input: {cartId: "Q2FydE5vZGU6ODExMDU=", lines: [{productPk: 1, quantity: 2, subscription: {interval: "week", intervalCount: 8}}]}
) {
cart {
id
pk
totalInclTax
totalExclTax
numLines
numItems
status
offerDiscounts {
name
description
amount
}
lines {
pk
linePriceInclTax
discountValue
attributes {
option
value
}
}
}
success
errors
}
}
Udpate the attribution for a cart.
mutation{
updateCartAttribution(input:{
cartId: "Q2FydE5vZGU6ODExMDU=",
attribution: {
utmSource: "TEST",
utmMedium: "aa",
}
}){
cart{
attribution{
utmSource,utmTerm,utmMedium, metadata
}
}
}
}
Empty a cart of all its line items.
mutation{
emptyCart(input:{cartId:"Q2FydE5vZGU6ODExMDU="}){
success,
errors,
cart{
numItems, numItems
}
}
}