Meet Toki Operator

Docs/Wallet SDK

Loyalty groups

Shared wallets for clubs and teams: the customer's groups, members, invitations and group points.

A loyalty group is a shared wallet for a club, team or Shopify B2B company, with its own balance in one of your store credits. Admins (ADMIN) send points from the group balance to members and manage who's in the group; members (MEMBER) can donate points to it or, if you allow it, ask it for points. You create groups and choose who can find and join them in the Toki app; every method acts as the signed-in customer, and amounts are whole points of the group's store credit.

Methods7 reads · 16 actions

getLoyaltyGroups#

tokiWallet.getLoyaltyGroups()→ Promise<{ groups: LoyaltyGroup[]; invitations: LoyaltyGroupInvitation[] }>

Lists the customer's loyalty groups and their pending group invitations.

Groups are sorted by name. Invitations are the pending ones sent to the customer's email address, newest first.

Returns

Promise<{ groups: LoyaltyGroup[]; invitations: LoyaltyGroupInvitation[] }>
  • groupsLoyaltyGroup[]
    11 fields per item
    • group_idstring

      Pass it as groupId to the other methods.

    • namestring
    • status"ACTIVE" | "ARCHIVED"

      ARCHIVED once you archive the group: it keeps its balance and history, and no longer takes new members, invitations, transfers, donations or point requests.

    • role"ADMIN" | "MEMBER"

      The customer's role in the group.

    • master_balancestring | null

      The group balance in points, as a string such as "12500.000000000000000000". For admins; null for members.

    • master_balance_displaystring | null

      The group balance formatted for display, such as 12,500 Points or $125. For admins; null for members.

    • current_user_balancestring

      The customer's own balance of the group's store credit, in points, as a string.

    • current_user_balance_displaystring

      current_user_balance formatted for display, such as 1,250 Points.

    • token_idstring

      The store credit the group balance is held in.

    • token_namestring | null

      The store credit's name, such as Points.

    • settingsLoyaltyGroupSettings
      3 fields
      • allowPointRequestsboolean

        Whether members can ask the group for points with requestLoyaltyGroupPoints.

      • visibility"PUBLIC" | "PRIVATE"

        PUBLIC groups show up in findLoyaltyGroups; PRIVATE groups don't.

      • joinPolicy"OPEN" | "APPROVAL_REQUIRED" | "INVITE_ONLY"

        How customers join with joinLoyaltyGroup: right away (OPEN), once an admin approves (APPROVAL_REQUIRED), or only by invitation (INVITE_ONLY).

  • invitationsLoyaltyGroupInvitation[]

    Answer them with acceptLoyaltyGroupInvitation or declineLoyaltyGroupInvitation.

    5 fields per item
    • invitation_idstring
    • group_idstring
    • group_namestring
    • role"ADMIN" | "MEMBER"

      The role the customer gets when they accept.

    • expires_atstring

      When the invitation expires, as an ISO 8601 date-time.

Example
const { groups, invitations } =
  await tokiWallet.getLoyaltyGroups()
const managed = groups.filter(
  (group) => group.role === "ADMIN",
)
Result
{
  "groups": [
    {
      "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
      "name": "Riverside Running Club",
      "status": "ACTIVE",
      "role": "ADMIN",
      "master_balance": "12500.000000000000000000",
      "master_balance_display": "12,500 Points",
      "current_user_balance": "1250.000000000000000000",
      "current_user_balance_display": "1,250 Points",
      "token_id": "9d1e4a7b-2c3f-4e5a-8b6c-7d8e9f0a1b2c",
      "token_name": "Points",
      "settings": {
        "allowPointRequests": true,
        "visibility": "PUBLIC",
        "joinPolicy": "APPROVAL_REQUIRED"
      }
    }
  ],
  "invitations": [
    {
      "invitation_id": "2d8f4b6a-1c3e-4a5f-9b7d-0e2c4a6f8b13",
      "group_id": "a1c3e5f7-2b4d-4f6a-8c0e-9d7b5a3f1e24",
      "group_name": "Northside Swim Team",
      "role": "MEMBER",
      "expires_at": "2026-10-19T08:15:00.000Z"
    }
  ]
}

getLoyaltyGroup#

tokiWallet.getLoyaltyGroup({ groupId })→ Promise<{ group: LoyaltyGroupDetails }>

Returns one of the customer's groups with its balance and the customer's role in it.

Admins also get the group's invitations, which they can resend or revoke while pending. Rejects when the customer isn't in the group.

Options

one object
  • groupIdstringRequired

    The group's group_id.

Returns

Promise<{ group: LoyaltyGroupDetails }>
  • groupLoyaltyGroupDetails
    12 fields
    • group_idstring
    • namestring
    • status"ACTIVE" | "ARCHIVED"

      ARCHIVED once you archive the group: it keeps its balance and history, and no longer takes new members, invitations, transfers, donations or point requests.

    • role"ADMIN" | "MEMBER"

      The customer's role in the group.

    • master_balancestring

      The group balance in points, as a string such as "12500.000000000000000000".

    • master_balance_displaystring

      The group balance formatted for display, such as 12,500 Points or $125.

    • current_user_balancestring

      The customer's own balance of the group's store credit, in points, as a string.

    • current_user_balance_displaystring

      current_user_balance formatted for display.

    • token_idstring

      The store credit the group balance is held in.

    • token_namestring | null

      The store credit's name, such as Points.

    • settingsLoyaltyGroupSettings
      3 fields
      • allowPointRequestsboolean

        Whether members can ask the group for points with requestLoyaltyGroupPoints.

      • visibility"PUBLIC" | "PRIVATE"

        PUBLIC groups show up in findLoyaltyGroups; PRIVATE groups don't.

      • joinPolicy"OPEN" | "APPROVAL_REQUIRED" | "INVITE_ONLY"

        How customers join with joinLoyaltyGroup: right away (OPEN), once an admin approves (APPROVAL_REQUIRED), or only by invitation (INVITE_ONLY).

    • invitationsLoyaltyGroupInvitation[]Optional

      Admins only. Every invitation to the group, newest first.

      6 fields per item
      • invitation_idstring
      • group_idstring
      • emailstring

        The invited email address.

      • role"ADMIN" | "MEMBER"

        The role the customer gets when they accept.

      • status"PENDING" | "ACCEPTED" | "DECLINED" | "REVOKED" | "EXPIRED"

        PENDING until the customer accepts or declines, or the invitation expires or is revoked.

      • expires_atstring

        When the invitation expires, as an ISO 8601 date-time: 7 days after it was last sent.

Example
const { group } = await tokiWallet.getLoyaltyGroup({
  groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
})
const pending = (group.invitations ?? []).filter(
  (invitation) => invitation.status === "PENDING",
)
Result
{
  "group": {
    "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    "name": "Riverside Running Club",
    "status": "ACTIVE",
    "role": "ADMIN",
    "master_balance": "12500.000000000000000000",
    "master_balance_display": "12,500 Points",
    "current_user_balance": "1250.000000000000000000",
    "current_user_balance_display": "1,250 Points",
    "token_id": "9d1e4a7b-2c3f-4e5a-8b6c-7d8e9f0a1b2c",
    "token_name": "Points",
    "settings": {
      "allowPointRequests": true,
      "visibility": "PUBLIC",
      "joinPolicy": "APPROVAL_REQUIRED"
    },
    "invitations": [
      {
        "invitation_id": "6c8e0a2d-4f6b-4d8e-a0c2-1e3f5a7b9d35",
        "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
        "email": "leo@example.com",
        "role": "MEMBER",
        "status": "PENDING",
        "expires_at": "2026-10-23T11:00:00.000Z"
      }
    ]
  }
}

findLoyaltyGroups#

tokiWallet.findLoyaltyGroups({ query? })→ Promise<{ groups: AvailableLoyaltyGroup[] }>

Searches the public groups the customer isn't in yet.

Returns up to 50 active groups with visibility PUBLIC, sorted by name. Use join_policy to offer the right action: join, ask to join, or wait for an invitation.

Options

one object
  • querystring

    Text to look for in group names, up to 100 characters.

Returns

Promise<{ groups: AvailableLoyaltyGroup[] }>
  • groupsAvailableLoyaltyGroup[]
    4 fields per item
    • group_idstring

      Pass it as groupId to joinLoyaltyGroup.

    • namestring
    • join_policy"OPEN" | "APPROVAL_REQUIRED" | "INVITE_ONLY"

      How the customer can join: right away (OPEN), by asking an admin (APPROVAL_REQUIRED), or by invitation (INVITE_ONLY).

    • request_status"PENDING" | null

      PENDING while the customer's request to join waits for an admin; otherwise null.

Example
const { groups } = await tokiWallet.findLoyaltyGroups({
  query: "running",
})
const joinable = groups.filter(
  (group) => group.join_policy !== "INVITE_ONLY",
)
Result
{
  "groups": [
    {
      "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
      "name": "Riverside Running Club",
      "join_policy": "APPROVAL_REQUIRED",
      "request_status": null
    }
  ]
}

joinLoyaltyGroup#

tokiWallet.joinLoyaltyGroup({ groupId })→ Promise<{ status: "JOINED" | "PENDING" }>

Joins a group, or asks to join one that needs an admin's approval.

With the OPEN join policy, the customer joins right away as a MEMBER and status is JOINED. With APPROVAL_REQUIRED, the request goes to the group's admins and status is PENDING; each admin gets a Toki Loyalty Group Join Requested event in your connected email and SMS tools. INVITE_ONLY groups reject the call, since customers join them by accepting an invitation.

Calling it again resolves with the same status.

Options

one object
  • groupIdstringRequired

    The group's group_id, from findLoyaltyGroups.

Returns

Promise<{ status: "JOINED" | "PENDING" }>
  • status"JOINED" | "PENDING"

    JOINED when the customer is in the group; PENDING while their request waits for an admin.

Example
const { status } = await tokiWallet.joinLoyaltyGroup({
  groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
})
joinButton.textContent =
  status === "PENDING" ? "Requested" : "Joined"
Result
{
  "status": "PENDING"
}

getLoyaltyGroupJoinRequests#

tokiWallet.getLoyaltyGroupJoinRequests({ groupId })→ Promise<{ requests: LoyaltyGroupJoinRequest[] }>

Lists the requests to join a group that are waiting for an admin, oldest first.

Only the group's admins can call it.

Options

one object
  • groupIdstringRequired

    The group's group_id.

Returns

Promise<{ requests: LoyaltyGroupJoinRequest[] }>
  • requestsLoyaltyGroupJoinRequest[]
    5 fields per item
    • request_idstring

      Pass it as requestId to approve or decline the request.

    • user_idstring

      The customer who asked to join.

    • namestring | null

      The customer's name, when Toki has one.

    • emailstring | null
    • created_atstring

      When they asked, as an ISO 8601 date-time.

Example
const { requests } =
  await tokiWallet.getLoyaltyGroupJoinRequests({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
  })
Result
{
  "requests": [
    {
      "request_id": "7a5c3e1f-9d2b-4f6a-8c4e-2b0d9f7a5c31",
      "user_id": "f2b4d6a8-3c5e-4f7a-9b1d-6e8c0a2f4b57",
      "name": "Sam Patel",
      "email": "sam@example.com",
      "created_at": "2026-10-15T10:05:00.000Z"
    }
  ]
}

approveLoyaltyGroupJoinRequest#

tokiWallet.approveLoyaltyGroupJoinRequest({ groupId, requestId })→ Promise<{ request: { request_id: string; status: "APPROVED" }; membership: LoyaltyGroupMembership }>

Approves a request to join a group, adding the customer who asked as a member.

Only the group's admins can call it. The customer who asked joins with the MEMBER role.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • requestIdstringRequired

    The request's request_id, from getLoyaltyGroupJoinRequests.

Returns

Promise<{ request: { request_id: string; status: "APPROVED" }; membership: LoyaltyGroupMembership }>
  • requestobject
    2 fields
    • request_idstring
    • status"APPROVED"
  • membershipLoyaltyGroupMembership

    The new member's membership.

    5 fields
    • membership_idstring
    • user_idstring

      The member's customer ID.

    • role"ADMIN" | "MEMBER"
    • status"ACTIVE" | "REMOVED"
    • joined_atstring

      When the customer joined, as an ISO 8601 date-time.

Example
const groupId = "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21"
const { requests } =
  await tokiWallet.getLoyaltyGroupJoinRequests({
    groupId,
  })
await tokiWallet.approveLoyaltyGroupJoinRequest({
  groupId,
  requestId: requests[0].request_id,
})
Result
{
  "request": {
    "request_id": "7a5c3e1f-9d2b-4f6a-8c4e-2b0d9f7a5c31",
    "status": "APPROVED"
  },
  "membership": {
    "membership_id": "d8f0b2e4-6a8c-4e1a-b3d5-7f9a1c3e5b80",
    "user_id": "f2b4d6a8-3c5e-4f7a-9b1d-6e8c0a2f4b57",
    "role": "MEMBER",
    "status": "ACTIVE",
    "joined_at": "2026-10-15T12:30:00.000Z"
  }
}

declineLoyaltyGroupJoinRequest#

tokiWallet.declineLoyaltyGroupJoinRequest({ groupId, requestId })→ Promise<{ request: { request_id: string; status: "DECLINED" } }>

Declines a request to join a group.

Only the group's admins can call it. The customer who asked can send a new request later.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • requestIdstringRequired

    The request's request_id, from getLoyaltyGroupJoinRequests.

Returns

Promise<{ request: { request_id: string; status: "DECLINED" } }>
  • requestobject
    2 fields
    • request_idstring
    • status"DECLINED"
Example
await tokiWallet.declineLoyaltyGroupJoinRequest({
  groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
  requestId: "7a5c3e1f-9d2b-4f6a-8c4e-2b0d9f7a5c31",
})
Result
{
  "request": {
    "request_id": "7a5c3e1f-9d2b-4f6a-8c4e-2b0d9f7a5c31",
    "status": "DECLINED"
  }
}

getLoyaltyGroupMembers#

tokiWallet.getLoyaltyGroupMembers({ groupId, offset?, limit?, query? })→ Promise<LoyaltyGroupMembersPage>

Lists a group's members, admins first, then in the order they joined.

Everyone in the group sees names and roles. Admins also get each member's user_id, email address and balance, to send points or remove members, and their query matches email addresses as well as names.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • offsetnumberdefault 0

    How many to skip.

  • limitnumberdefault 50

    How many to return, from 1 to 100.

  • querystring

    Text to search for, up to 100 characters.

Returns

Promise<LoyaltyGroupMembersPage>
  • membersLoyaltyGroupMember[]
    8 fields per item
    • membership_idstring
    • namestring | null

      The member's name, when Toki has one.

    • role"ADMIN" | "MEMBER"
    • user_idstringOptional

      Admins only. Pass it as recipientUserId to send points, or as userId to removeLoyaltyGroupMember.

    • emailstring | nullOptional

      Admins only.

    • balancestringOptional

      Admins only. The member's own balance of the group's store credit, in points, as a string.

    • balance_displaystringOptional

      Admins only. balance formatted for display, such as 640 Points.

    • joined_atstringOptional

      Admins only. When they joined, as an ISO 8601 date-time.

  • pageInfoPageInfo
    3 fields
    • hasNextPageboolean

      Whether more come after this page. Get them with offset set to offset + limit.

    • offsetnumber

      The offset this page starts at.

    • limitnumber

      The limit used for this page.

Example
const { members, pageInfo } =
  await tokiWallet.getLoyaltyGroupMembers({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    limit: 20,
    query: "ben",
  })
Result
{
  "members": [
    {
      "membership_id": "1f3d5b7a-9c2e-4d6f-8a0b-3c5e7a9d1f62",
      "name": "Ben Carter",
      "role": "MEMBER",
      "user_id": "6e2f8a1c-9b3d-4e7f-a5c4-8d1b0e3f2a96",
      "email": "ben@example.com",
      "balance": "640.000000000000000000",
      "balance_display": "640 Points",
      "joined_at": "2026-09-03T16:20:00.000Z"
    }
  ],
  "pageInfo": {
    "hasNextPage": false,
    "offset": 0,
    "limit": 20
  }
}

removeLoyaltyGroupMember#

tokiWallet.removeLoyaltyGroupMember({ groupId, userId })→ Promise<{ membership: LoyaltyGroupMembership }>

Removes a member from a group.

Only the group's admins can call it, for members with the MEMBER role; you manage admins in the Toki app. Points the member already received stay in their balance.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • userIdstringRequired

    The member's user_id, from getLoyaltyGroupMembers.

Returns

Promise<{ membership: LoyaltyGroupMembership }>
  • membershipLoyaltyGroupMembership

    The membership, now REMOVED.

    6 fields
    • membership_idstring
    • user_idstring

      The member's customer ID.

    • role"ADMIN" | "MEMBER"
    • status"ACTIVE" | "REMOVED"
    • joined_atstring

      When the customer joined, as an ISO 8601 date-time.

    • removed_atstring

      When the member was removed, as an ISO 8601 date-time.

Example
const groupId = "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21"
const { members } =
  await tokiWallet.getLoyaltyGroupMembers({
    groupId,
    query: "ben@example.com",
  })
await tokiWallet.removeLoyaltyGroupMember({
  groupId,
  userId: members[0].user_id,
})
Result
{
  "membership": {
    "membership_id": "1f3d5b7a-9c2e-4d6f-8a0b-3c5e7a9d1f62",
    "user_id": "6e2f8a1c-9b3d-4e7f-a5c4-8d1b0e3f2a96",
    "role": "MEMBER",
    "status": "REMOVED",
    "joined_at": "2026-09-03T16:20:00.000Z",
    "removed_at": "2026-10-21T08:45:00.000Z"
  }
}

acceptLoyaltyGroupInvitation#

tokiWallet.acceptLoyaltyGroupInvitation({ invitationId })→ Promise<{ invitation: LoyaltyGroupInvitation }>

Accepts an invitation, adding the customer to the group with the invited role.

The invitation must be pending and sent to the customer's email address. Toki sends a Toki Loyalty Group Invitation Accepted event to your connected email and SMS tools.

Options

one object
  • invitationIdstringRequired

    The invitation's invitation_id, from getLoyaltyGroups.

Returns

Promise<{ invitation: LoyaltyGroupInvitation }>
  • invitationLoyaltyGroupInvitation

    The invitation, now ACCEPTED.

    6 fields
    • invitation_idstring
    • group_idstring
    • emailstring

      The invited email address.

    • role"ADMIN" | "MEMBER"

      The role the customer gets when they accept.

    • status"PENDING" | "ACCEPTED" | "DECLINED" | "REVOKED" | "EXPIRED"

      PENDING until the customer accepts or declines, or the invitation expires or is revoked.

    • expires_atstring

      When the invitation expires, as an ISO 8601 date-time: 7 days after it was last sent.

Example
const { invitations } =
  await tokiWallet.getLoyaltyGroups()
const { invitation } =
  await tokiWallet.acceptLoyaltyGroupInvitation({
    invitationId: invitations[0].invitation_id,
  })
Result
{
  "invitation": {
    "invitation_id": "2d8f4b6a-1c3e-4a5f-9b7d-0e2c4a6f8b13",
    "group_id": "a1c3e5f7-2b4d-4f6a-8c0e-9d7b5a3f1e24",
    "email": "anna@example.com",
    "role": "MEMBER",
    "status": "ACCEPTED",
    "expires_at": "2026-10-19T08:15:00.000Z"
  }
}

declineLoyaltyGroupInvitation#

tokiWallet.declineLoyaltyGroupInvitation({ invitationId })→ Promise<{ invitation: LoyaltyGroupInvitation }>

Declines an invitation to a group.

The invitation must be pending and sent to the customer's email address.

Options

one object
  • invitationIdstringRequired

    The invitation's invitation_id, from getLoyaltyGroups.

Returns

Promise<{ invitation: LoyaltyGroupInvitation }>
  • invitationLoyaltyGroupInvitation

    The invitation, now DECLINED.

    6 fields
    • invitation_idstring
    • group_idstring
    • emailstring

      The invited email address.

    • role"ADMIN" | "MEMBER"

      The role the customer gets when they accept.

    • status"PENDING" | "ACCEPTED" | "DECLINED" | "REVOKED" | "EXPIRED"

      PENDING until the customer accepts or declines, or the invitation expires or is revoked.

    • expires_atstring

      When the invitation expires, as an ISO 8601 date-time: 7 days after it was last sent.

Example
await tokiWallet.declineLoyaltyGroupInvitation({
  invitationId: "2d8f4b6a-1c3e-4a5f-9b7d-0e2c4a6f8b13",
})
Result
{
  "invitation": {
    "invitation_id": "2d8f4b6a-1c3e-4a5f-9b7d-0e2c4a6f8b13",
    "group_id": "a1c3e5f7-2b4d-4f6a-8c0e-9d7b5a3f1e24",
    "email": "anna@example.com",
    "role": "MEMBER",
    "status": "DECLINED",
    "expires_at": "2026-10-19T08:15:00.000Z"
  }
}

inviteLoyaltyGroupMember#

tokiWallet.inviteLoyaltyGroupMember({ groupId, email })→ Promise<{ invitation: LoyaltyGroupInvitation }>

Invites an email address to join a group as a member.

Only the group's admins can call it. The invitation is valid for 7 days; inviting an email again renews its pending invitation. If the email isn't in your program yet, Toki creates a member for it, so the invitation is waiting when they sign in.

Toki sends a Toki Loyalty Group Invitation Sent event to your connected email and SMS tools, such as Klaviyo, so you can email the invitation from there. Rejects for an email that's already in the group.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • emailstringRequired

    The email address to invite.

Returns

Promise<{ invitation: LoyaltyGroupInvitation }>
  • invitationLoyaltyGroupInvitation

    The pending invitation.

    6 fields
    • invitation_idstring
    • group_idstring
    • emailstring

      The invited email address.

    • role"ADMIN" | "MEMBER"

      The role the customer gets when they accept.

    • status"PENDING" | "ACCEPTED" | "DECLINED" | "REVOKED" | "EXPIRED"

      PENDING until the customer accepts or declines, or the invitation expires or is revoked.

    • expires_atstring

      When the invitation expires, as an ISO 8601 date-time: 7 days after it was last sent.

Example
const { invitation } =
  await tokiWallet.inviteLoyaltyGroupMember({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    email: "leo@example.com",
  })
Result
{
  "invitation": {
    "invitation_id": "6c8e0a2d-4f6b-4d8e-a0c2-1e3f5a7b9d35",
    "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    "email": "leo@example.com",
    "role": "MEMBER",
    "status": "PENDING",
    "expires_at": "2026-10-23T11:00:00.000Z"
  }
}

resendLoyaltyGroupInvitation#

tokiWallet.resendLoyaltyGroupInvitation({ groupId, invitationId })→ Promise<{ invitation: LoyaltyGroupInvitation }>

Sends a pending invitation again, valid for another 7 days.

Only the group's admins can call it. Toki sends the Toki Loyalty Group Invitation Sent event again. To invite someone whose invitation is no longer pending, use inviteLoyaltyGroupMember.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • invitationIdstringRequired

    The invitation's invitation_id, from getLoyaltyGroup.

Returns

Promise<{ invitation: LoyaltyGroupInvitation }>
  • invitationLoyaltyGroupInvitation

    The invitation, with its new expires_at.

    6 fields
    • invitation_idstring
    • group_idstring
    • emailstring

      The invited email address.

    • role"ADMIN" | "MEMBER"

      The role the customer gets when they accept.

    • status"PENDING" | "ACCEPTED" | "DECLINED" | "REVOKED" | "EXPIRED"

      PENDING until the customer accepts or declines, or the invitation expires or is revoked.

    • expires_atstring

      When the invitation expires, as an ISO 8601 date-time: 7 days after it was last sent.

Example
const groupId = "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21"
const { group } = await tokiWallet.getLoyaltyGroup({
  groupId,
})
const pending = group.invitations.filter(
  (invitation) => invitation.status === "PENDING",
)
await tokiWallet.resendLoyaltyGroupInvitation({
  groupId,
  invitationId: pending[0].invitation_id,
})
Result
{
  "invitation": {
    "invitation_id": "6c8e0a2d-4f6b-4d8e-a0c2-1e3f5a7b9d35",
    "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    "email": "leo@example.com",
    "role": "MEMBER",
    "status": "PENDING",
    "expires_at": "2026-10-27T09:30:00.000Z"
  }
}

revokeLoyaltyGroupInvitation#

tokiWallet.revokeLoyaltyGroupInvitation({ groupId, invitationId })→ Promise<{ invitation: LoyaltyGroupInvitation }>

Cancels a pending invitation, so it can no longer be accepted.

Only the group's admins can call it.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • invitationIdstringRequired

    The invitation's invitation_id, from getLoyaltyGroup.

Returns

Promise<{ invitation: LoyaltyGroupInvitation }>
  • invitationLoyaltyGroupInvitation

    The invitation, now REVOKED.

    6 fields
    • invitation_idstring
    • group_idstring
    • emailstring

      The invited email address.

    • role"ADMIN" | "MEMBER"

      The role the customer gets when they accept.

    • status"PENDING" | "ACCEPTED" | "DECLINED" | "REVOKED" | "EXPIRED"

      PENDING until the customer accepts or declines, or the invitation expires or is revoked.

    • expires_atstring

      When the invitation expires, as an ISO 8601 date-time: 7 days after it was last sent.

Example
await tokiWallet.revokeLoyaltyGroupInvitation({
  groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
  invitationId: "6c8e0a2d-4f6b-4d8e-a0c2-1e3f5a7b9d35",
})
Result
{
  "invitation": {
    "invitation_id": "6c8e0a2d-4f6b-4d8e-a0c2-1e3f5a7b9d35",
    "group_id": "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    "email": "leo@example.com",
    "role": "MEMBER",
    "status": "REVOKED",
    "expires_at": "2026-10-23T11:00:00.000Z"
  }
}

sendLoyaltyGroupPoints#

tokiWallet.sendLoyaltyGroupPoints({ groupId, recipientUserId, amount, idempotencyKey? })→ Promise<{ transfer: LoyaltyGroupTransfer }>

Sends points from the group balance to a member.

Only the group's admins can call it. The points move right away to the member's own balance, and Toki sends a Toki Loyalty Group Points Granted event to your connected email and SMS tools. Rejects when the group balance is too low.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • recipientUserIdstringRequired

    The member's user_id, from getLoyaltyGroupMembers.

  • amountnumberRequired

    Points to send: a whole number above 0.

  • idempotencyKeystringdefault crypto.randomUUID()

    A UUID that identifies this transfer. Pass the same key when you retry, and the points are sent once.

Returns

Promise<{ transfer: LoyaltyGroupTransfer }>
  • transferLoyaltyGroupTransfer
    4 fields
    • group_transfer_idstring
    • recipient_user_idstring

      The member who received the points.

    • amountstring

      The points sent, as a string such as "500".

    • created_atstring

      When the points moved, as an ISO 8601 date-time.

Example
const { transfer } =
  await tokiWallet.sendLoyaltyGroupPoints({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    recipientUserId:
      "6e2f8a1c-9b3d-4e7f-a5c4-8d1b0e3f2a96",
    amount: 500,
  })
Result
{
  "transfer": {
    "group_transfer_id": "5b3d1f9e-7c5a-4b3d-8e1f-6a4c2e0b8d42",
    "recipient_user_id": "6e2f8a1c-9b3d-4e7f-a5c4-8d1b0e3f2a96",
    "amount": "500",
    "created_at": "2026-10-14T17:42:10.000Z"
  }
}

sendLoyaltyGroupPointsBatch#

tokiWallet.sendLoyaltyGroupPointsBatch({ groupId, recipientUserIds, amount, idempotencyKey? })→ Promise<{ transfers: LoyaltyGroupTransfer[] }>

Sends the same number of points from the group balance to up to 100 members at once.

Only the group's admins can call it. Each recipient gets amount points, and the transfers go through together or not at all, so the group balance must cover amount times the number of recipients. Toki sends a Toki Loyalty Group Points Granted event for each recipient.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • recipientUserIdsstring[]Required

    From 1 to 100 members' user_ids, each listed once.

  • amountnumberRequired

    Points each recipient gets: a whole number above 0.

  • idempotencyKeystringdefault crypto.randomUUID()

    A UUID that identifies this batch. Pass the same key when you retry, and each member gets the points once.

Returns

Promise<{ transfers: LoyaltyGroupTransfer[] }>
  • transfersLoyaltyGroupTransfer[]

    One transfer per recipient, in the order of recipientUserIds.

    4 fields per item
    • group_transfer_idstring
    • recipient_user_idstring

      The member who received the points.

    • amountstring

      The points sent, as a string such as "500".

    • created_atstring

      When the points moved, as an ISO 8601 date-time.

Example
const { transfers } =
  await tokiWallet.sendLoyaltyGroupPointsBatch({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    recipientUserIds: [
      "6e2f8a1c-9b3d-4e7f-a5c4-8d1b0e3f2a96",
      "c3a9d5e1-7f2b-4c8a-9e6d-1b4f0a2c8e57",
    ],
    amount: 250,
  })
Result
{
  "transfers": [
    {
      "group_transfer_id": "9f1b3d5e-7a9c-4e1b-8d3f-5a7c9e1b3d64",
      "recipient_user_id": "6e2f8a1c-9b3d-4e7f-a5c4-8d1b0e3f2a96",
      "amount": "250",
      "created_at": "2026-10-18T09:00:00.000Z"
    }
  ]
}

donateLoyaltyGroupPoints#

tokiWallet.donateLoyaltyGroupPoints({ groupId, amount, idempotencyKey? })→ Promise<{ donation: LoyaltyGroupDonation }>

Moves points from the customer's own balance to the group balance.

Anyone in the group can donate, admins included. Rejects when the customer doesn't have enough points.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • amountnumberRequired

    Points to donate: a whole number above 0.

  • idempotencyKeystringdefault crypto.randomUUID()

    A UUID that identifies this donation. Pass the same key when you retry, and the points move once.

Returns

Promise<{ donation: LoyaltyGroupDonation }>
  • donationLoyaltyGroupDonation
    3 fields
    • group_transfer_idstring
    • amountstring

      The points donated, as a string such as "200".

    • created_atstring

      When the points moved, as an ISO 8601 date-time.

Example
const { donation } =
  await tokiWallet.donateLoyaltyGroupPoints({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    amount: 200,
  })
Result
{
  "donation": {
    "group_transfer_id": "3c5e7a9b-1d3f-4b5c-8e7a-2f4d6b8c0e91",
    "amount": "200",
    "created_at": "2026-10-17T14:10:00.000Z"
  }
}

requestLoyaltyGroupPoints#

tokiWallet.requestLoyaltyGroupPoints({ groupId, amount, description?, idempotencyKey? })→ Promise<{ request: LoyaltyGroupPointRequest }>

Asks a group's admins for points from the group balance.

Members with the MEMBER role can ask in groups where you allow point requests (settings.allowPointRequests). The request waits until an admin approves or declines it, or the customer cancels it; each admin gets a Toki Loyalty Group Points Requested event in your connected email and SMS tools. A customer has one pending point request at a time.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • amountnumberRequired

    Points to ask for: a whole number above 0.

  • descriptionstring

    A note for the admins, up to 500 characters.

  • idempotencyKeystringdefault crypto.randomUUID()

    A UUID that identifies this request. Pass the same key when you retry, and one request is created.

Returns

Promise<{ request: LoyaltyGroupPointRequest }>
  • requestLoyaltyGroupPointRequest
    4 fields
    • group_transfer_idstring

      Pass it as groupTransferId to cancelLoyaltyGroupBalanceRequest.

    • amountstring

      The points asked for, as a string such as "300".

    • descriptionstring | null

      The customer's note, if they added one.

    • created_atstring

      When the customer asked, as an ISO 8601 date-time.

Example
const { request } =
  await tokiWallet.requestLoyaltyGroupPoints({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    amount: 300,
    description: "Entry fee for the Riverside 10K",
  })
Result
{
  "request": {
    "group_transfer_id": "8e0a2c4f-6b8d-4f1a-9c3e-5d7b9f1a3c62",
    "amount": "300",
    "description": "Entry fee for the Riverside 10K",
    "created_at": "2026-10-19T07:55:00.000Z"
  }
}

getLoyaltyGroupBalanceRequests#

tokiWallet.getLoyaltyGroupBalanceRequests({ groupId, offset?, limit? })→ Promise<LoyaltyGroupPointRequestsPage>

Lists pending point requests: the whole group's for admins, the customer's own for members.

Newest first. Approved requests appear in getLoyaltyGroupTransfers.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • offsetnumberdefault 0

    How many to skip.

  • limitnumberdefault 50

    How many to return, from 1 to 100.

Returns

Promise<LoyaltyGroupPointRequestsPage>
  • requestsLoyaltyGroupPointRequest[]
    8 fields per item
    • group_transfer_idstring

      Pass it as groupTransferId to approve, decline or cancel the request.

    • recipient_namestring | null

      The name of the member who asked.

    • amountstring

      The points asked for, as a string such as "300".

    • amount_displaystring

      amount formatted for display, such as 300 Points.

    • descriptionstring | null

      The member's note, if they added one.

    • created_atstring

      When the member asked, as an ISO 8601 date-time.

    • recipient_user_idstringOptional

      Admins only. The member who asked.

    • recipient_emailstring | nullOptional

      Admins only.

  • pageInfoPageInfo
    3 fields
    • hasNextPageboolean

      Whether more come after this page. Get them with offset set to offset + limit.

    • offsetnumber

      The offset this page starts at.

    • limitnumber

      The limit used for this page.

Example
const { requests, pageInfo } =
  await tokiWallet.getLoyaltyGroupBalanceRequests({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    limit: 20,
  })
Result
{
  "requests": [
    {
      "group_transfer_id": "8e0a2c4f-6b8d-4f1a-9c3e-5d7b9f1a3c62",
      "recipient_name": "Mia Lopez",
      "amount": "300",
      "amount_display": "300 Points",
      "description": "Entry fee for the Riverside 10K",
      "created_at": "2026-10-19T07:55:00.000Z",
      "recipient_user_id": "c3a9d5e1-7f2b-4c8a-9e6d-1b4f0a2c8e57",
      "recipient_email": "mia@example.com"
    }
  ],
  "pageInfo": {
    "hasNextPage": false,
    "offset": 0,
    "limit": 20
  }
}

approveLoyaltyGroupBalanceRequest#

tokiWallet.approveLoyaltyGroupBalanceRequest({ groupId, groupTransferId })→ Promise<{ request: { group_transfer_id: string; status: "APPROVED" } }>

Approves a point request, sending the points from the group balance.

Only the group's admins can call it. The points move right away to the member's balance, and Toki sends a Toki Loyalty Group Points Granted event to your connected email and SMS tools. Rejects when the group balance is too low.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • groupTransferIdstringRequired

    The request's group_transfer_id, from getLoyaltyGroupBalanceRequests.

Returns

Promise<{ request: { group_transfer_id: string; status: "APPROVED" } }>
  • requestobject
    2 fields
    • group_transfer_idstring
    • status"APPROVED"
Example
const groupId = "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21"
const { requests } =
  await tokiWallet.getLoyaltyGroupBalanceRequests({
    groupId,
  })
await tokiWallet.approveLoyaltyGroupBalanceRequest({
  groupId,
  groupTransferId: requests[0].group_transfer_id,
})
Result
{
  "request": {
    "group_transfer_id": "8e0a2c4f-6b8d-4f1a-9c3e-5d7b9f1a3c62",
    "status": "APPROVED"
  }
}

declineLoyaltyGroupBalanceRequest#

tokiWallet.declineLoyaltyGroupBalanceRequest({ groupId, groupTransferId })→ Promise<{ request: { group_transfer_id: string; status: "DECLINED" } }>

Declines a point request.

Only the group's admins can call it. No points move.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • groupTransferIdstringRequired

    The request's group_transfer_id, from getLoyaltyGroupBalanceRequests.

Returns

Promise<{ request: { group_transfer_id: string; status: "DECLINED" } }>
  • requestobject
    2 fields
    • group_transfer_idstring
    • status"DECLINED"
Example
await tokiWallet.declineLoyaltyGroupBalanceRequest({
  groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
  groupTransferId: "8e0a2c4f-6b8d-4f1a-9c3e-5d7b9f1a3c62",
})
Result
{
  "request": {
    "group_transfer_id": "8e0a2c4f-6b8d-4f1a-9c3e-5d7b9f1a3c62",
    "status": "DECLINED"
  }
}

cancelLoyaltyGroupBalanceRequest#

tokiWallet.cancelLoyaltyGroupBalanceRequest({ groupId, groupTransferId })→ Promise<{ request: { group_transfer_id: string } }>

Cancels the customer's own pending point request.

Only the member who asked can cancel it. They can then send a new request.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • groupTransferIdstringRequired

    The request's group_transfer_id, from requestLoyaltyGroupPoints or getLoyaltyGroupBalanceRequests.

Returns

Promise<{ request: { group_transfer_id: string } }>
  • requestobject
    1 field
    • group_transfer_idstring
Example
const groupId = "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21"
const { requests } =
  await tokiWallet.getLoyaltyGroupBalanceRequests({
    groupId,
  })
await tokiWallet.cancelLoyaltyGroupBalanceRequest({
  groupId,
  groupTransferId: requests[0].group_transfer_id,
})
Result
{
  "request": {
    "group_transfer_id": "8e0a2c4f-6b8d-4f1a-9c3e-5d7b9f1a3c62"
  }
}

getLoyaltyGroupTransfers#

tokiWallet.getLoyaltyGroupTransfers({ groupId, offset?, limit? })→ Promise<LoyaltyGroupTransfersPage>

Lists the points that moved in and out of a group's balance, newest first.

Includes points admins sent and approved point requests (TO_MEMBER), and donations to the group (TO_GROUP). Everyone in the group sees its history; admins also get member IDs, email addresses and request notes.

Options

one object
  • groupIdstringRequired

    The group's group_id.

  • offsetnumberdefault 0

    How many to skip.

  • limitnumberdefault 50

    How many to return, from 1 to 100.

Returns

Promise<LoyaltyGroupTransfersPage>
  • transfersLoyaltyGroupTransfer[]
    12 fields per item
    • group_transfer_idstring
    • direction"TO_MEMBER" | "TO_GROUP"

      TO_MEMBER: the group sent points to a member. TO_GROUP: a member donated points.

    • actor_namestring | null

      Who moved the points: the admin who sent them or approved the request, or the member who donated.

    • recipient_namestring | null

      The member who received the points, for TO_MEMBER transfers.

    • amountstring

      The points moved, as a string such as "500".

    • amount_displaystring

      amount formatted for display, such as 500 Points.

    • created_atstring

      When the points moved, as an ISO 8601 date-time; for a point request, when it was approved.

    • actor_user_idstringOptional

      Admins only. The customer behind actor_name.

    • actor_emailstring | nullOptional

      Admins only.

    • recipient_user_idstringOptional

      Admins only. The member behind recipient_name.

    • recipient_emailstring | nullOptional

      Admins only.

    • descriptionstring | nullOptional

      Admins only. The member's note on an approved point request.

  • pageInfoPageInfo
    3 fields
    • hasNextPageboolean

      Whether more come after this page. Get them with offset set to offset + limit.

    • offsetnumber

      The offset this page starts at.

    • limitnumber

      The limit used for this page.

Example
const { transfers, pageInfo } =
  await tokiWallet.getLoyaltyGroupTransfers({
    groupId: "4f6c2b1e-8a3d-4c7e-9b52-1d0e7a6f3c21",
    limit: 10,
  })
Result
{
  "transfers": [
    {
      "group_transfer_id": "5b3d1f9e-7c5a-4b3d-8e1f-6a4c2e0b8d42",
      "direction": "TO_MEMBER",
      "actor_name": "Anna Novak",
      "recipient_name": "Ben Carter",
      "amount": "500",
      "amount_display": "500 Points",
      "created_at": "2026-10-14T17:42:10.000Z"
    }
  ],
  "pageInfo": {
    "hasNextPage": true,
    "offset": 0,
    "limit": 10
  }
}