Meet Toki Operator

Docs/Manage API

Campaigns

Push, email and wallet notifications, sent on a schedule or when something happens.

A campaign sends a message to members by push notification to their wallet pass, email or wallet notification. manual campaigns send to their whole audience at the times in settings.executions; automatically campaigns message a member each time they trigger the campaign's event. campaignTest and emailTemplateTestSend send real messages right away to the members you choose.

query

campaign#

Returns a campaign, or null if it doesn't exist. Unlike campaigns, it fills in settings.executions with the scheduled sends and their live status.

Arguments

  • idID!Required

    The campaign's campaignId.

Returns

TokiCampaign

A message Toki sends to members by wallet pass push notification, email or wallet notification, either at times you schedule (manual) or when a member triggers its event (automatically).

  • campaignIdID!

    The ID the other campaign operations take as id.

  • merchantIdID!

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

  • nameString!
  • typeTokiCampaignType!

    How a campaign sends: a manual campaign (On Schedule in the Toki app) sends to its whole audience at the times in settings.executions, and an automatically campaign messages a member each time they trigger its action.type.

    manualautomatically
  • segmentIdID

    Only members of this segment receive the campaign; null sends it to all members.

  • createdAtString!
  • updatedAtString!
  • statusString!

    active or inactive (a draft). Only active campaigns react to member events or queue scheduled sends, and deactivating a campaign cancels its sends that are still waiting.

  • settingsTokiCampaignSettings!

    The message for each channel (push, email, wallet), the condition automatic sends must meet, and a manual campaign's scheduled sends in executions, each with its current status. Only campaign, campaignCreate and campaignUpdate fill in executions; in campaigns it is always empty.

  • actionTokiCampaignActionObject

    For automatically campaigns, the member event that triggers a send, in type, such as points_earned or tier_unlocked. manual campaigns ignore it.

query Campaign($id: ID!) {
  campaign(id: $id) {
    campaignId
    merchantId
    name
    type
    segmentId
    createdAt
    status
    settings {
      push {
        content
        header
        enabled
      }
      email {
        enabled
        subject
        message
        asHTML
      }
      wallet {
        enabled
        title
        body
        metadata
      }
    }
  }
}
Variables
{
  "id": "8517f0c0-8617-4253-a717-f3e68817f579"
}
Response
{
  "data": {
    "campaign": {
      "campaignId": "15119006-1611-4199-a311-8ce014118e73",
      "merchantId": "5cf66cd4-5df6-4e67-aef6-6ffa5ff6718d",
      "name": "Gold",
      "type": "manual",
      "segmentId": "bd675b67-bc67-49d4-af67-5e8dbe675cfa",
      "createdAt": "2026-10-14T09:30:00.000Z",
      "status": "active",
      "settings": {
        "push": {
          "content": "Content",
          "header": "Header",
          "enabled": true
        },
        "email": {
          "enabled": true,
          "subject": "Subject",
          "message": "Message",
          "asHTML": false
        },
        "wallet": {
          "enabled": true,
          "title": "Summer double points",
          "body": "Body",
          "metadata": {}
        }
      }
    }
  }
}

campaigns#

Lists your campaigns, newest first. settings.executions is always empty here; use campaign to read scheduled sends.

Arguments

  • reverseBoolean

    Reverse the sort order.

  • typeTokiCampaignType

    Only items whose type equals this value.

    manualautomatically

Returns

TokiCampaignConnection!

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

A message Toki sends to members by wallet pass push notification, email or wallet notification, either at times you schedule (manual) or when a member triggers its event (automatically).

  • campaignIdID!

    The ID the other campaign operations take as id.

  • merchantIdID!

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

  • nameString!
  • typeTokiCampaignType!

    How a campaign sends: a manual campaign (On Schedule in the Toki app) sends to its whole audience at the times in settings.executions, and an automatically campaign messages a member each time they trigger its action.type.

    manualautomatically
  • segmentIdID

    Only members of this segment receive the campaign; null sends it to all members.

  • createdAtString!
  • updatedAtString!
  • statusString!

    active or inactive (a draft). Only active campaigns react to member events or queue scheduled sends, and deactivating a campaign cancels its sends that are still waiting.

  • settingsTokiCampaignSettings!

    The message for each channel (push, email, wallet), the condition automatic sends must meet, and a manual campaign's scheduled sends in executions, each with its current status. Only campaign, campaignCreate and campaignUpdate fill in executions; in campaigns it is always empty.

  • actionTokiCampaignActionObject

    For automatically campaigns, the member event that triggers a send, in type, such as points_earned or tier_unlocked. manual campaigns ignore it.

query Campaigns($first: Int) {
  campaigns(first: $first) {
    nodes {
      name
      type
      createdAt
      status
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "campaigns": {
      "nodes": [
        {
          "name": "Gold",
          "type": "manual",
          "createdAt": "2026-10-14T09:30:00.000Z",
          "status": "active"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Y3Vyc29yOjE5"
      }
    }
  }
}
query

campaignCounts#

Counts how many of a campaign's notifications reached members: push notifications delivered to wallet passes and wallet notifications viewed. Test sends aren't counted.

Arguments

  • idID!Required

    The campaign's campaignId.

Returns

TokiCampaignCountsPayload!

Delivery counts for a campaign: push counts its push notifications that reached a member's wallet pass, and wallet its wallet notifications that members have viewed and not deleted.

  • campaignIdString!

    The id you asked for.

  • pushInt!

    How many of the campaign's push notifications reached a member's wallet pass.

  • walletInt!

    How many of the campaign's wallet notifications members have viewed and not deleted.

query CampaignCounts($id: ID!) {
  campaignCounts(id: $id) {
    campaignId
    push
    wallet
  }
}
Variables
{
  "id": "fd3dc3c0-fe3d-4553-af3d-c6e6003dc879"
}
Response
{
  "data": {
    "campaignCounts": {
      "campaignId": "8e3ec306-8f3e-4499-ac3e-bfe08d3ec173",
      "push": 1,
      "wallet": 1
    }
  }
}
mutation

campaignCreate#

Creates a campaign. If status is active, it goes live at once: an automatically campaign messages members as they trigger action.type, and a manual campaign queues a send to its audience for each entry in settings.executions, at its scheduledAt (ISO 8601) or right away if that is empty or past.

Input

TokiCampaignCreateInput!
  • campaignTokiCampaignInput!Required

    The campaign to save. Its fields mean the same as on TokiCampaign.

Returns

TokiCampaign!

A message Toki sends to members by wallet pass push notification, email or wallet notification, either at times you schedule (manual) or when a member triggers its event (automatically).

  • campaignIdID!

    The ID the other campaign operations take as id.

  • merchantIdID!

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

  • nameString!
  • typeTokiCampaignType!

    How a campaign sends: a manual campaign (On Schedule in the Toki app) sends to its whole audience at the times in settings.executions, and an automatically campaign messages a member each time they trigger its action.type.

    manualautomatically
  • segmentIdID

    Only members of this segment receive the campaign; null sends it to all members.

  • createdAtString!
  • updatedAtString!
  • statusString!

    active or inactive (a draft). Only active campaigns react to member events or queue scheduled sends, and deactivating a campaign cancels its sends that are still waiting.

  • settingsTokiCampaignSettings!

    The message for each channel (push, email, wallet), the condition automatic sends must meet, and a manual campaign's scheduled sends in executions, each with its current status. Only campaign, campaignCreate and campaignUpdate fill in executions; in campaigns it is always empty.

  • actionTokiCampaignActionObject

    For automatically campaigns, the member event that triggers a send, in type, such as points_earned or tier_unlocked. manual campaigns ignore it.

mutation CampaignCreate($input: TokiCampaignCreateInput!) {
  campaignCreate(input: $input) {
    campaignId
    merchantId
    name
    type
    segmentId
    createdAt
    status
    settings {
      push {
        content
        header
        enabled
      }
      email {
        enabled
        subject
        message
        asHTML
      }
      wallet {
        enabled
        title
        body
        metadata
      }
    }
  }
}
Variables
{
  "input": {
    "campaign": {
      "name": "Gold",
      "type": "manual",
      "status": "active",
      "settings": {}
    }
  }
}
Response
{
  "data": {
    "campaignCreate": {
      "campaignId": "f0efc1f6-f1ef-4389-aeef-bed0efefc063",
      "merchantId": "8d8124e4-8e81-4677-af81-280a9081299d",
      "name": "Gold",
      "type": "manual",
      "segmentId": "54cb6a17-53cb-4884-a6cb-6d3d55cb6baa",
      "createdAt": "2026-10-14T09:30:00.000Z",
      "status": "active",
      "settings": {
        "push": {
          "content": "Content",
          "header": "Header",
          "enabled": true
        },
        "email": {
          "enabled": true,
          "subject": "Subject",
          "message": "Message",
          "asHTML": false
        },
        "wallet": {
          "enabled": true,
          "title": "Summer double points",
          "body": "Body",
          "metadata": {}
        }
      }
    }
  }
}
mutation

campaignUpdate#

Updates a campaign, replacing its fields with campaign; an omitted segmentId or action keeps its value. The campaign type cannot be changed after creation. For an active manual campaign, settings.executions entries without an id are queued as new sends, entries with an id and a canceledAt are canceled, and the rest are rescheduled to their scheduledAt and pick up your changes; leaving an existing entry out does not cancel it. Setting status to inactive cancels every send still waiting.

Input

TokiCampaignUpdateInput!
  • campaignTokiCampaignInput!Required

    The campaign to save. Its fields mean the same as on TokiCampaign.

  • idID!Required

    The campaign's campaignId.

Returns

TokiCampaign!

A message Toki sends to members by wallet pass push notification, email or wallet notification, either at times you schedule (manual) or when a member triggers its event (automatically).

  • campaignIdID!

    The ID the other campaign operations take as id.

  • merchantIdID!

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

  • nameString!
  • typeTokiCampaignType!

    How a campaign sends: a manual campaign (On Schedule in the Toki app) sends to its whole audience at the times in settings.executions, and an automatically campaign messages a member each time they trigger its action.type.

    manualautomatically
  • segmentIdID

    Only members of this segment receive the campaign; null sends it to all members.

  • createdAtString!
  • updatedAtString!
  • statusString!

    active or inactive (a draft). Only active campaigns react to member events or queue scheduled sends, and deactivating a campaign cancels its sends that are still waiting.

  • settingsTokiCampaignSettings!

    The message for each channel (push, email, wallet), the condition automatic sends must meet, and a manual campaign's scheduled sends in executions, each with its current status. Only campaign, campaignCreate and campaignUpdate fill in executions; in campaigns it is always empty.

  • actionTokiCampaignActionObject

    For automatically campaigns, the member event that triggers a send, in type, such as points_earned or tier_unlocked. manual campaigns ignore it.

mutation CampaignUpdate($input: TokiCampaignUpdateInput!) {
  campaignUpdate(input: $input) {
    campaignId
    merchantId
    name
    type
    segmentId
    createdAt
    status
    settings {
      push {
        content
        header
        enabled
      }
      email {
        enabled
        subject
        message
        asHTML
      }
      wallet {
        enabled
        title
        body
        metadata
      }
    }
  }
}
Variables
{
  "input": {
    "campaign": {
      "name": "Gold",
      "type": "manual",
      "status": "active",
      "settings": {}
    },
    "id": "438c21ad-428c-401a-a18c-1e87408c1cf4"
  }
}
Response
{
  "data": {
    "campaignUpdate": {
      "campaignId": "6f74a679-6e74-44e6-ad74-a3536c74a1c0",
      "merchantId": "db3fcf43-da3f-4db0-ad3f-d269dc3fd0d6",
      "name": "Gold",
      "type": "manual",
      "segmentId": "9875c562-9975-46f5-a675-c23c9775c3cf",
      "createdAt": "2026-10-14T09:30:00.000Z",
      "status": "active",
      "settings": {
        "push": {
          "content": "Content",
          "header": "Header",
          "enabled": true
        },
        "email": {
          "enabled": true,
          "subject": "Subject",
          "message": "Message",
          "asHTML": false
        },
        "wallet": {
          "enabled": true,
          "title": "Summer double points",
          "body": "Body",
          "metadata": {}
        }
      }
    }
  }
}
mutation

campaignDelete#

Deletes a campaign and cancels its waiting scheduled sends, including queued audience batches. Sending tasks check that the campaign is active and not deleted before sending. Messages already in delivery may still arrive.

Input

TokiCampaignDeleteInput!
  • idID!Required

    The campaign's campaignId.

  • isDeleteNotificationsBoolean

    Also delete the wallet notifications this campaign sent, so members no longer see them, and its push notifications not yet delivered. Defaults to false.

Returns

Boolean!

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

mutation CampaignDelete($input: TokiCampaignDeleteInput!) {
  campaignDelete(input: $input)
}
Variables
{
  "input": {
    "id": "f620e0cf-f520-4f3c-a820-e3f5f720e262",
    "isDeleteNotifications": true
  }
}
Response
{
  "data": {
    "campaignDelete": true
  }
}
mutation

campaignTest#

Sends the enabled messages in settings to the members in userIds right away, without creating a campaign. They are real messages, but placeholders stay as typed and nothing counts towards campaignCounts. Toki sends push, then wallet, then email, and stops at the first problem, which it returns in error.

Input

TokiCampaignTestInput!
  • userIds[ID!]!Required

    The members who receive the test, by member ID (TokiUser.id).

  • settingsTokiCampaignSettingsInput!Required

    The messages to send, as in TokiCampaign.settings. Only the enabled push, wallet and email messages are used.

Returns

TokiCampaignTestPayload!

The outcome of a test send.

  • resultString

    The report of the first channel that sent, such as Apple: Successfully sent, Google: Successfully sent for push or Successfully sent; null when error is set.

  • errorString

    Why the test stopped, such as No devices found for selected users when push is enabled but none of the members has your wallet pass; null on success.

mutation CampaignTest($input: TokiCampaignTestInput!) {
  campaignTest(input: $input) {
    result
    error
  }
}
Variables
{
  "input": {
    "userIds": [
      "d92c784e-da2c-49e1-a72c-7528d82c76bb"
    ],
    "settings": {}
  }
}
Response
{
  "data": {
    "campaignTest": {
      "result": "Result",
      "error": "Error"
    }
  }
}

emailTemplates#

Lists the current merchant's email templates, newest first, optionally searching names and descriptions.

Arguments

  • ids[String!]

    Restrict results to these template IDs. An empty list returns none.

  • activeBoolean

    Filter non-deleted templates by activation status. Omit to keep the full editor catalogue.

  • searchString

    Case-insensitive substring to match against template names and descriptions.

Returns

TokiEmailTemplateConnection!

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

A reusable email template owned by a merchant.

  • idString!

    Unique saved template ID.

  • merchantIdString!

    The merchant that owns this template.

  • nameString!

    Template name shown in the merchant portal.

  • descriptionString

    Internal description, or null if none was provided.

  • isActiveBoolean!

    Whether this template is marked active.

  • subjectString!

    Email subject line, which may contain placeholders.

  • bodyHtmlString!

    HTML email body, which may contain placeholders.

  • bodyTextString!

    Plain text body generated from the HTML when the template was saved.

  • createdAtString!

    When the template was created, as an ISO 8601 timestamp.

  • updatedAtString!

    When the template was last saved, as an ISO 8601 timestamp.

query EmailTemplates($first: Int) {
  emailTemplates(first: $first) {
    nodes {
      id
      merchantId
      name
      createdAt
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "emailTemplates": {
      "nodes": [
        {
          "id": "07fe3336-08fe-44c9-a5fe-301006fe31a3",
          "merchantId": "55e986f6-56e9-4889-a3e9-83d054e98563",
          "name": "Gold",
          "createdAt": "2026-10-14T09:30:00.000Z"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Y3Vyc29yOjE5"
      }
    }
  }
}
query

emailTemplate#

Returns one email template belonging to the current merchant, including its HTML and plain text bodies.

Arguments

  • idString!Required

    ID of a saved template belonging to the current merchant.

Returns

TokiEmailTemplate!

A reusable email template owned by a merchant.

  • idString!

    Unique saved template ID.

  • merchantIdString!

    The merchant that owns this template.

  • nameString!

    Template name shown in the merchant portal.

  • descriptionString

    Internal description, or null if none was provided.

  • isActiveBoolean!

    Whether this template is marked active.

  • subjectString!

    Email subject line, which may contain placeholders.

  • bodyHtmlString!

    HTML email body, which may contain placeholders.

  • bodyTextString!

    Plain text body generated from the HTML when the template was saved.

  • createdAtString!

    When the template was created, as an ISO 8601 timestamp.

  • updatedAtString!

    When the template was last saved, as an ISO 8601 timestamp.

query EmailTemplate($id: String!) {
  emailTemplate(id: $id) {
    id
    merchantId
    name
    description
    isActive
    subject
    createdAt
  }
}
Variables
{
  "id": "a5ffc57e-a6ff-4711-a3ff-c258a4ffc3eb"
}
Response
{
  "data": {
    "emailTemplate": {
      "id": "a5ffc57e-a6ff-4711-a3ff-c258a4ffc3eb",
      "merchantId": "8c475ace-8d47-4c61-aa47-57a88b47593b",
      "name": "Gold",
      "description": "Earn double points on every order in July.",
      "isActive": true,
      "subject": "Subject",
      "createdAt": "2026-10-14T09:30:00.000Z"
    }
  }
}
mutation

emailTemplateUpsert#

Creates an email template, or updates an existing template belonging to the current merchant when id is provided. Plain text is generated from the HTML body.

Input

TokiEmailTemplateUpsertInput!

Email template content and activation settings.

  • idString

    Existing template ID to update. Omit to create a new template.

  • nameString!Required

    Non-empty name shown in the merchant portal.

  • descriptionString

    Internal description. Omit or pass null to clear it.

  • isActiveBoolean

    Whether to mark the saved template active. Defaults to false.

  • subjectString!Required

    Non-empty email subject line, with optional placeholders.

  • bodyHtmlString!Required

    Non-empty HTML body. The plain text version is generated automatically.

Returns

TokiEmailTemplate!

A reusable email template owned by a merchant.

  • idString!

    Unique saved template ID.

  • merchantIdString!

    The merchant that owns this template.

  • nameString!

    Template name shown in the merchant portal.

  • descriptionString

    Internal description, or null if none was provided.

  • isActiveBoolean!

    Whether this template is marked active.

  • subjectString!

    Email subject line, which may contain placeholders.

  • bodyHtmlString!

    HTML email body, which may contain placeholders.

  • bodyTextString!

    Plain text body generated from the HTML when the template was saved.

  • createdAtString!

    When the template was created, as an ISO 8601 timestamp.

  • updatedAtString!

    When the template was last saved, as an ISO 8601 timestamp.

mutation EmailTemplateUpsert($input: TokiEmailTemplateUpsertInput!) {
  emailTemplateUpsert(input: $input) {
    id
    merchantId
    name
    description
    isActive
    subject
    createdAt
  }
}
Variables
{
  "input": {
    "name": "Gold",
    "subject": "Subject",
    "bodyHtml": "Body html"
  }
}
Response
{
  "data": {
    "emailTemplateUpsert": {
      "id": "02f3cb5b-01f3-49c8-a4f3-ce8103f3ccee",
      "merchantId": "72373a33-7137-48a0-a437-3d5973373bc6",
      "name": "Gold",
      "description": "Earn double points on every order in July.",
      "isActive": true,
      "subject": "Subject",
      "createdAt": "2026-10-14T09:30:00.000Z"
    }
  }
}
mutation

emailTemplateDelete#

Deletes one email template belonging to the current merchant.

Input

TokiEmailTemplateDeleteInput!

Merchant-owned email template to delete.

  • idString!Required

    ID of a saved template belonging to the current merchant.

Returns

Boolean!

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

mutation EmailTemplateDelete($input: TokiEmailTemplateDeleteInput!) {
  emailTemplateDelete(input: $input)
}
Variables
{
  "input": {
    "id": "b3db7b55-b2db-49c2-a1db-782fb0db769c"
  }
}
Response
{
  "data": {
    "emailTemplateDelete": true
  }
}
mutation

emailTemplatePreviewSend#

Sends an HTML preview to a member of the current merchant with the subject Email Template Preview. Replaces simple placeholders using the provided string variables.

Input

TokiEmailTemplatePreviewSendInput!

Recipient, HTML and substitutions for an email preview.

  • customerIdString!Required

    Member ID (TokiUser.id) in the current merchant. The member must have an email address.

  • bodyHtmlString!Required

    Preview HTML. Simple placeholders such as {{name}} are replaced using variables.

  • variables[TokiEmailTemplatePreviewSendVariablesEntryInput!]

    String substitutions sent as key/value entries. Each key is a placeholder name without braces; value is its replacement text. Unknown placeholders remain unchanged.

Returns

Boolean!

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

mutation EmailTemplatePreviewSend($input: TokiEmailTemplatePreviewSendInput!) {
  emailTemplatePreviewSend(input: $input)
}
Variables
{
  "input": {
    "customerId": "a7ffdfd4-a8ff-4167-a9ff-e2faaaffe48d",
    "bodyHtml": "Body html"
  }
}
Response
{
  "data": {
    "emailTemplatePreviewSend": true
  }
}
mutation

emailTemplateTestSend#

Sends a test email to one member right away, from the sender in your store's email settings. It uses the subject and bodyHtml you pass rather than a saved template, with placeholders filled in from the member's details and variables.

Input

TokiEmailTemplateTestSendInput!
  • templateIdID

    The saved template you're testing, if any. Toki only checks that it exists; the email is built from subject and bodyHtml.

  • customerIdID!Required

    The member who receives the email, by member ID (TokiUser.id). They need an email address.

  • subjectString!Required

    The subject line. Placeholders such as {{customer.name}} are filled in.

  • bodyHtmlString!Required

    The email's HTML body. Placeholders are filled in as in subject.

  • variablesTokiJSON

    Values for placeholders, as a JSON object such as {"amount": 50}. They are merged over the member's own values (customer, userProperties) and win on conflicts.

Returns

Boolean!

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

mutation EmailTemplateTestSend($input: TokiEmailTemplateTestSendInput!) {
  emailTemplateTestSend(input: $input)
}
Variables
{
  "input": {
    "templateId": "303282b4-3132-4447-a232-85da3332876d",
    "customerId": "89a3570e-8aa3-48a1-a7a3-53e888a3557b",
    "subject": "Subject",
    "bodyHtml": "Body html",
    "variables": {}
  }
}
Response
{
  "data": {
    "emailTemplateTestSend": true
  }
}