Meet Toki Operator

Docs/Manage API

Gift cards

Issued gift cards and the gift card products you sell.

Toki issues each gift card in all your stores, both in Toki and as a Shopify gift card, and keeps the balances in step when a card is spent. Gift card products are gift cards you sell: Toki creates and maintains a Shopify product for each, and issues a gift card for every one sold.

giftCards#

Lists the gift cards in the current store, newest first.

Arguments

  • queryString

    Part of the code, order ID, or holder's or gifter's email.

  • reverseBoolean

    Reverse the sort order.

  • giftCardProductIdString

    Only gift cards bought through this gift card product.

  • userIdString

    Only gift cards this member holds or gifted.

Returns

TokiGiftCardConnection!

A page of TokiGiftCard in nodes, with pageInfo for the next page. Each item:

A gift card issued through Toki, as recorded for one of your stores.

  • orderIdString

    The numeric ID of the Shopify order the gift card was bought in; null unless it was bought through a gift card product.

  • shopDomainString!

    The store this record belongs to. Toki issues each gift card in all your stores, one record per store.

  • codeString!

    The code customers enter at checkout.

  • balanceString!

    The remaining value in currencyCode, as a decimal string such as 25.5. Toki refreshes it from Shopify when it processes an order paid with the gift card.

  • currencyCodeString

    The gift card's three-letter currency code, such as USD.

  • userIdID

    The member who holds the gift card.

  • userEmailString

    The email of the member in userId.

  • userPhoneString

    The phone number of the member in userId.

  • giftedByIdID

    The member who bought the gift card for someone else, if any.

  • giftedByEmailString

    The email of the member in giftedById.

  • giftedByPhoneString

    The phone number of the member in giftedById.

  • createdAtString
  • updatedAtString
  • expiresAtString

    Toki issues gift cards without an expiry date, so this is null.

  • shopifyIdString

    The GID of the gift card in this store's Shopify admin, such as gid://shopify/GiftCard/123; null if it doesn't exist in Shopify.

  • deliverAtString

    When the gift card is scheduled to be delivered, or was delivered, to its recipient; null if no delivery was scheduled.

  • internalProductIdID

    The ID of the TokiGiftCardProduct the gift card was bought through; null if it was issued another way.

  • noteString

    The message stored with the gift card, such as the buyer's personal note. Delivery emails show it where their template has {{note}}.

  • usagesCountInt!

    How many orders in shopDomain were paid with the gift card.

  • usagesTokiGiftCardUsageConnection!

    Orders in shopDomain that were paid with the gift card, newest first.

query GiftCards($first: Int) {
  giftCards(first: $first) {
    nodes {
      orderId
      code
      balance
      createdAt
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "giftCards": {
      "nodes": [
        {
          "orderId": "9e2e98b8-9f2e-4a4b-a02e-9bdea12e9d71",
          "code": "TOKI-7Q2M-4KXD",
          "balance": "Balance",
          "createdAt": "2026-10-14T09:30:00.000Z"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Y3Vyc29yOjE5"
      }
    }
  }
}

giftCardUsages#

Lists the orders paid with a gift card in any of your stores, newest first. Toki records a usage when it processes a Shopify order paid with the gift card.

Arguments

  • reverseBoolean

    Reverse the sort order.

  • codeString!Required

    The gift card's code.

Returns

TokiGiftCardUsageConnection!

A page of TokiGiftCardUsage in nodes, with pageInfo for the next page. Each item:

An order that was paid with a gift card.

  • idID!
  • orderIdString!

    The numeric ID of the Shopify order.

  • shopDomainString!

    The store where the order was placed.

  • createdAtString!

    When Toki processed the order and recorded the usage.

query GiftCardUsages($code: String!, $first: Int) {
  giftCardUsages(code: $code, first: $first) {
    nodes {
      id
      orderId
      shopDomain
      createdAt
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Variables
{
  "code": "TOKI-7Q2M-4KXD",
  "first": 10
}
Response
{
  "data": {
    "giftCardUsages": {
      "nodes": [
        {
          "id": "ecc188cd-ebc1-473a-aac1-85a7e9c18414",
          "orderId": "5ba0eae5-5aa0-4952-a9a0-e7bf58a0e62c",
          "shopDomain": "your-store.myshopify.com",
          "createdAt": "2026-10-14T09:30:00.000Z"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Y3Vyc29yOjE5"
      }
    }
  }
}
mutation

giftCardBalanceUpdate#

Sets a gift card's balance in all your stores, adjusting each Shopify gift card by the difference. Where a record has no Shopify gift card yet (shopifyId is null), Toki creates one with the new balance if it is above 0. Each store is updated on its own, and errors lists the ones that failed.

Input

TokiGiftCardBalanceUpdateInput!
  • codeString!Required

    The code of the gift card to update.

  • newBalanceFloat!Required

    The new balance in the gift card's currency, as a decimal amount such as 25.5. 0 empties the gift card but doesn't disable it in Shopify.

Returns

TokiGiftCardBalanceUpdatePayload!
  • resultBoolean!

    true if every store was updated.

  • errors[String!]!

    One message per store that failed, starting with Shop and the store's domain.

mutation GiftCardBalanceUpdate($input: TokiGiftCardBalanceUpdateInput!) {
  giftCardBalanceUpdate(input: $input) {
    result
    errors
  }
}
Variables
{
  "input": {
    "code": "TOKI-7Q2M-4KXD",
    "newBalance": 49.99
  }
}
Response
{
  "data": {
    "giftCardBalanceUpdate": {
      "result": false,
      "errors": [
        "Errors"
      ]
    }
  }
}
mutation

giftCardDeliveryUpdate#

Schedules the delivery of a gift card: Toki's gift card email, the Product Gift Card Delivered event for your email tools, or both (see deliveryProvider). It replaces a delivery that hasn't gone out yet; once one has gone out, calling it again delivers the gift card again.

Input

TokiGiftCardDeliveryUpdateInput!
  • codeString!Required

    The code of the gift card to update.

  • deliverAtString

    When to deliver, as an ISO 8601 date-time in UTC such as 2025-12-24T09:00:00Z. A time in the past delivers right away. Required unless sendNow is true.

  • sendNowBoolean

    true delivers right away and ignores deliverAt.

  • giftCardSubjectString

    The email subject for this delivery, used when useCustomTemplate is true.

  • giftCardTemplateString

    The HTML email body for this delivery, used when useCustomTemplate is true. The subject and body can use {{code}}, {{amount}}, {{note}}, {{recipientEmail}} and {{domain}}.

  • useCustomTemplateBoolean

    true uses giftCardSubject and giftCardTemplate instead of your gift card email template. Both are then required, unless deliveryProvider is external.

  • userIdString

    The member to deliver to instead of the gift card's holder. The holder doesn't change.

  • deliveryProviderTokiGiftCardDeliveryUpdateDeliveryProvider

    What the delivery sends. default, or leaving it out, follows the gift card product's delivery provider: Toki's email if that is toki or the gift card has no product, unless the assignCustomerToGiftCard loyalty setting is on, plus the Product Gift Card Delivered event. toki sends only the email, external only the event, and both sends both.

    defaulttokiexternalboth

Returns

Boolean!

true when the change was made. Anything that stops it comes back as an error.

mutation GiftCardDeliveryUpdate($input: TokiGiftCardDeliveryUpdateInput!) {
  giftCardDeliveryUpdate(input: $input)
}
Variables
{
  "input": {
    "code": "TOKI-7Q2M-4KXD"
  }
}
Response
{
  "data": {
    "giftCardDeliveryUpdate": true
  }
}
mutation

giftCardCreate#

Issues a gift card with your code and amount in each of your stores, in Toki and in Shopify. If that fails in some stores, errors lists them; if it fails in all of them, the call returns an error. To email the gift card to the member, call giftCardDeliveryUpdate.

Input

TokiGiftCardCreateInput!
  • codeString!Required

    The gift card code: 8 to 20 letters and digits, as Shopify requires. Stored in lowercase. A retry completes missing cards after partial creation and skips cards already created in Shopify. If all active stores already have the card, the request is rejected. giftCardCodeGenerate returns a random code.

  • amountFloat!Required

    The gift card's value in the current store's currency, as a decimal amount such as 25.5.

  • userIdString

    The member who holds the gift card. Leave it out for no holder.

  • noteString

    A note stored with the gift card. It isn't sent to Shopify, but delivery emails show it where their template has {{note}}, as the default template does.

Returns

TokiGiftCardCreatePayload!
  • codeString!

    The normalized lowercase code.

  • resultBoolean!

    Always true; if no store could create the gift card, the call fails instead.

  • errors[TokiGiftCardCreateErrors!]!

    The stores where creating the gift card failed, and why. New local records are saved after Shopify creation succeeds. A retry can finish missing cards without recreating successful ones.

mutation GiftCardCreate($input: TokiGiftCardCreateInput!) {
  giftCardCreate(input: $input) {
    code
    result
    errors {
      shopDomain
      error
    }
  }
}
Variables
{
  "input": {
    "code": "TOKI-7Q2M-4KXD",
    "amount": 49.99,
    "userId": "06ea6783-05ea-45f0-a8ea-6aa907ea6916",
    "note": "Prefers email over SMS."
  }
}
Response
{
  "data": {
    "giftCardCreate": {
      "code": "TOKI-7Q2M-4KXD",
      "result": false,
      "errors": [
        {
          "shopDomain": "your-store.myshopify.com",
          "error": "Error"
        }
      ]
    }
  }
}
mutation

giftCardCodeGenerate#

Returns a random 16-character code of lowercase letters and digits, without o and 0, for giftCardCreate. It doesn't create a gift card or reserve the code.

Input

TokiGiftCardCodeGenerateInput!

Nothing to set: pass an empty input: {}.

Returns

TokiGiftCardCodeGeneratePayload!
  • codeString!
mutation GiftCardCodeGenerate($input: TokiGiftCardCodeGenerateInput!) {
  giftCardCodeGenerate(input: $input) {
    code
  }
}
Variables
{
  "input": {}
}
Response
{
  "data": {
    "giftCardCodeGenerate": {
      "code": "TOKI-7Q2M-4KXD"
    }
  }
}
query

giftCardProduct#

Returns a gift card product, or null if there is none with this ID.

Arguments

  • idID!Required

Returns

TokiGiftCardProduct

A gift card you sell, as a Shopify product in each of your stores with one variant per amount.

  • idID!
  • merchantIdID!

    Your merchant ID, shown under Settings in the Toki app.

  • nameString!

    The title Toki gives the Shopify products when it creates them, and on each update when syncEnabled is true.

  • descriptionString

    The Shopify product description, as HTML; set like name.

  • imageUrlString

    The URL of the product image; set like name.

  • options[TokiGiftCardProductOptions!]!

    The amounts customers choose from, each a variant of the Shopify products.

  • isActiveBoolean!

    Whether Toki sets the Shopify products to active (true) or draft.

  • deliveryProviderString

    toki if Toki emails the gift cards bought through the product; otherwise Toki leaves the emails to your connected email tools.

  • syncEnabledBoolean!

    Whether updates overwrite the title, description and image of the Shopify products.

  • fulfillmentTokiGiftCardProductFulfillment!

    Whether Toki fulfills purchases of the product itself, which decides when it issues the gift cards.

  • productDataTokiGiftCardProductProductData!

    The Shopify product Toki manages for this gift card product in each store.

query GiftCardProduct($id: ID!) {
  giftCardProduct(id: $id) {
    id
    merchantId
    name
    description
    imageUrl
    isActive
    deliveryProvider
    options {
      price
    }
  }
}
Variables
{
  "id": "602753cd-5f27-423a-ae27-50a75d274f14"
}
Response
{
  "data": {
    "giftCardProduct": {
      "id": "602753cd-5f27-423a-ae27-50a75d274f14",
      "merchantId": "7a6c8ff1-796c-4e5e-a86c-8ccb776c8b38",
      "name": "Gold",
      "description": "Earn double points on every order in July.",
      "imageUrl": "https://example.com/toki/webhooks",
      "isActive": true,
      "deliveryProvider": "Delivery provider",
      "options": [
        {
          "price": 49.99
        }
      ]
    }
  }
}

giftCardProducts#

Lists your gift card products, newest first.

Arguments

  • reverseBoolean

    Reverse the sort order.

Returns

TokiGiftCardProductConnection!

A page of TokiGiftCardProduct in nodes, with pageInfo for the next page. Each item:

A gift card you sell, as a Shopify product in each of your stores with one variant per amount.

  • idID!
  • merchantIdID!

    Your merchant ID, shown under Settings in the Toki app.

  • nameString!

    The title Toki gives the Shopify products when it creates them, and on each update when syncEnabled is true.

  • descriptionString

    The Shopify product description, as HTML; set like name.

  • imageUrlString

    The URL of the product image; set like name.

  • options[TokiGiftCardProductOptions!]!

    The amounts customers choose from, each a variant of the Shopify products.

  • isActiveBoolean!

    Whether Toki sets the Shopify products to active (true) or draft.

  • deliveryProviderString

    toki if Toki emails the gift cards bought through the product; otherwise Toki leaves the emails to your connected email tools.

  • syncEnabledBoolean!

    Whether updates overwrite the title, description and image of the Shopify products.

  • fulfillmentTokiGiftCardProductFulfillment!

    Whether Toki fulfills purchases of the product itself, which decides when it issues the gift cards.

  • productDataTokiGiftCardProductProductData!

    The Shopify product Toki manages for this gift card product in each store.

query GiftCardProducts($first: Int) {
  giftCardProducts(first: $first) {
    nodes {
      id
      merchantId
      name
      description
      options {
        price
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "giftCardProducts": {
      "nodes": [
        {
          "id": "2f3685e1-2e36-444e-ad36-82bb2c368128",
          "merchantId": "8d4c7f35-8c4c-4da2-ab4c-7c0f8a4c7a7c",
          "name": "Gold",
          "description": "Earn double points on every order in July.",
          "options": [
            {
              "price": 49.99
            }
          ]
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Y3Vyc29yOjE5"
      }
    }
  }
}
mutation

giftCardProductCreate#

Creates a gift card product and a Shopify product for it in each of your stores: product type Gift Card, vendor Toki, and an Amount option with one variant per amount that isn't taxable and needs no shipping. A store where that fails is left out of productData; if every store fails, the call returns an error.

Input

TokiGiftCardProductCreateInput!
  • nameString!Required

    The title of the Shopify product.

  • descriptionString

    The Shopify product description, as HTML. On update, null or leaving it out keeps the current one.

  • imageUrlString

    The URL of the image Toki adds to the Shopify product.

  • options[TokiGiftCardProductCreateOptionsInput!]!Required

    The amounts customers choose from, at least one. Each is a variant of the Shopify product; on update, Toki matches them to the existing variants by position.

  • isActiveBoolean!Required

    true sets the Shopify products to active, false to draft.

  • deliveryProviderString

    toki to have Toki email the gift cards bought through the product. Any other value, such as external, or null leaves the emails to your connected email tools, which get the gift card events either way. Leaving it out sets null.

  • syncEnabledBoolean

    true makes each update overwrite the title, description and image of the Shopify products with name, description and imageUrl. Creating always sets them, and status and amounts are always kept in sync. Defaults to false.

  • fulfillmentTokiGiftCardProductCreateFulfillmentInput

    Whether Toki fulfills purchases of the product itself, which decides when it issues the gift cards. Defaults to { enabled: true }.

Returns

TokiGiftCardProduct!

A gift card you sell, as a Shopify product in each of your stores with one variant per amount.

  • idID!
  • merchantIdID!

    Your merchant ID, shown under Settings in the Toki app.

  • nameString!

    The title Toki gives the Shopify products when it creates them, and on each update when syncEnabled is true.

  • descriptionString

    The Shopify product description, as HTML; set like name.

  • imageUrlString

    The URL of the product image; set like name.

  • options[TokiGiftCardProductOptions!]!

    The amounts customers choose from, each a variant of the Shopify products.

  • isActiveBoolean!

    Whether Toki sets the Shopify products to active (true) or draft.

  • deliveryProviderString

    toki if Toki emails the gift cards bought through the product; otherwise Toki leaves the emails to your connected email tools.

  • syncEnabledBoolean!

    Whether updates overwrite the title, description and image of the Shopify products.

  • fulfillmentTokiGiftCardProductFulfillment!

    Whether Toki fulfills purchases of the product itself, which decides when it issues the gift cards.

  • productDataTokiGiftCardProductProductData!

    The Shopify product Toki manages for this gift card product in each store.

mutation GiftCardProductCreate($input: TokiGiftCardProductCreateInput!) {
  giftCardProductCreate(input: $input) {
    id
    merchantId
    name
    description
    imageUrl
    isActive
    deliveryProvider
    options {
      price
    }
  }
}
Variables
{
  "input": {
    "name": "Gold",
    "options": [
      {
        "price": 49.99
      }
    ],
    "isActive": true
  }
}
Response
{
  "data": {
    "giftCardProductCreate": {
      "id": "b571f3e9-b471-4256-a371-f0c3b271ef30",
      "merchantId": "0917440d-0817-427a-a717-40e706173f54",
      "name": "Gold",
      "description": "Earn double points on every order in July.",
      "imageUrl": "https://example.com/toki/webhooks",
      "isActive": true,
      "deliveryProvider": "Delivery provider",
      "options": [
        {
          "price": 49.99
        }
      ]
    }
  }
}
mutation

giftCardProductUpdate#

Updates a gift card product and its Shopify products: status and amounts always, and title, description and image when syncEnabled is true. A store without the product gets a new one; stores where the update fails aren't reported. Leaving out deliveryProvider, syncEnabled or fulfillment resets it to its default.

Input

TokiGiftCardProductUpdateInput!
  • idID!Required
  • nameString!Required

    The title of the Shopify product.

  • descriptionString

    The Shopify product description, as HTML. On update, null or leaving it out keeps the current one.

  • imageUrlString

    The URL of the image Toki adds to the Shopify product.

  • options[TokiGiftCardProductCreateOptionsInput!]!Required

    The amounts customers choose from, at least one. Each is a variant of the Shopify product; on update, Toki matches them to the existing variants by position.

  • isActiveBoolean!Required

    true sets the Shopify products to active, false to draft.

  • deliveryProviderString

    toki to have Toki email the gift cards bought through the product. Any other value, such as external, or null leaves the emails to your connected email tools, which get the gift card events either way. Leaving it out sets null.

  • syncEnabledBoolean

    true makes each update overwrite the title, description and image of the Shopify products with name, description and imageUrl. Creating always sets them, and status and amounts are always kept in sync. Defaults to false.

  • fulfillmentTokiGiftCardProductCreateFulfillmentInput

    Whether Toki fulfills purchases of the product itself, which decides when it issues the gift cards. Defaults to { enabled: true }.

Returns

TokiGiftCardProduct!

A gift card you sell, as a Shopify product in each of your stores with one variant per amount.

  • idID!
  • merchantIdID!

    Your merchant ID, shown under Settings in the Toki app.

  • nameString!

    The title Toki gives the Shopify products when it creates them, and on each update when syncEnabled is true.

  • descriptionString

    The Shopify product description, as HTML; set like name.

  • imageUrlString

    The URL of the product image; set like name.

  • options[TokiGiftCardProductOptions!]!

    The amounts customers choose from, each a variant of the Shopify products.

  • isActiveBoolean!

    Whether Toki sets the Shopify products to active (true) or draft.

  • deliveryProviderString

    toki if Toki emails the gift cards bought through the product; otherwise Toki leaves the emails to your connected email tools.

  • syncEnabledBoolean!

    Whether updates overwrite the title, description and image of the Shopify products.

  • fulfillmentTokiGiftCardProductFulfillment!

    Whether Toki fulfills purchases of the product itself, which decides when it issues the gift cards.

  • productDataTokiGiftCardProductProductData!

    The Shopify product Toki manages for this gift card product in each store.

mutation GiftCardProductUpdate($input: TokiGiftCardProductUpdateInput!) {
  giftCardProductUpdate(input: $input) {
    id
    merchantId
    name
    description
    imageUrl
    isActive
    deliveryProvider
    options {
      price
    }
  }
}
Variables
{
  "input": {
    "id": "3a471b78-3b47-4d0b-ac47-1e9e3d472031",
    "name": "Gold",
    "options": [
      {
        "price": 49.99
      }
    ],
    "isActive": true
  }
}
Response
{
  "data": {
    "giftCardProductUpdate": {
      "id": "50d9fcca-51d9-4e5d-aed9-f9a44fd9fb37",
      "merchantId": "0736193a-0836-4acd-a536-1614063617a7",
      "name": "Gold",
      "description": "Earn double points on every order in July.",
      "imageUrl": "https://example.com/toki/webhooks",
      "isActive": true,
      "deliveryProvider": "Delivery provider",
      "options": [
        {
          "price": 49.99
        }
      ]
    }
  }
}
mutation

giftCardProductDelete#

Deletes a gift card product and sets its Shopify products to draft, so customers can't buy it. The Shopify products stay in your catalog, and gift cards already issued keep working.

Input

TokiGiftCardProductDeleteInput!
  • idID!Required

Returns

Boolean!

true when the change was made. Anything that stops it comes back as an error.

mutation GiftCardProductDelete($input: TokiGiftCardProductDeleteInput!) {
  giftCardProductDelete(input: $input)
}
Variables
{
  "input": {
    "id": "ec9f11ce-ed9f-4361-aa9f-0ea8eb9f103b"
  }
}
Response
{
  "data": {
    "giftCardProductDelete": true
  }
}