Skip to main content

Create and update a session

Create a session with the session mutation. A bare minimum session requires no inputs and returns its automatically generated ID:

mutation {
session(
input: {
}
)
{
id
}
}

When you need to update an existing session, you just need the id to retrieve it:

mutation {
session(
input: {
id: "72f1b7aa-ae56-4c84-b289-863f33e7c219"
}
)
{
id
}
}

The SessionInput type allows you to configure session details.

By default, currency is configured in the merchant configuration, while the language is defined by the OS or browser locale. To override them, set a currency and a language for the session:

mutation {
session(
input: {
currency: EUR,
language: EN
}
)
{
id
}
}