GraphQL API
The Rewards GraphQL API is designed to support and power the Rewards Front End JavaScript Library (SDK), which provides a ready-to-use, continuously evolving Rewards experience. All brands that use Rewards have access to the GraphQL API, ensuring flexibility for different technical needs and integration approaches.
For most use cases, we recommend using the Rewards Front End JavaScript Library (SDK). The SDK is actively maintained by the Rewards engineering team and benefits from ongoing feature development, improvements, and bug fixes. By using the SDK, brands can automatically take advantage of new functionality as it becomes available, without the need to implement or maintain these features themselves.
The GraphQL API can be used as a complement to the SDK or as a standalone solution in cases where custom functionality is required that is not currently supported by the SDK. When considering direct use of the GraphQL API, it is helpful to clearly define the intended use case, as similar or equivalent functionality may already exist or be planned within the SDK.
Choosing the SDK allows brands to focus on their core experience while relying on a dedicated Rewards team to manage the underlying Rewards front-end features. Brands that build a fully custom Rewards front end using the GraphQL API gain greater control and flexibility, but will also be responsible for implementing and maintaining new end-to-end features as they are introduced.
This document provides a complete technical reference for integrating with the Fasttrack Rewards GraphQL API. It covers authentication using JWT tokens, available queries and mutations for accessing and managing rewards, bonuses, challenges, shop items, and user data, as well as real-time subscriptions. Developers can use this guide to understand the schema, build API requests, and implement the rewards features.
๐ Playground:
Playground: https://<brand-name>.ft-crm.com/rewards-graphql-api/
๐ Authentication
To access the API:
- You must pass a JWT token with the following claims:
- iat (Issued At): Unix timestamp
- exp (Expiration): Unix timestamp
- user_id: String or integer
- The JWT must be signed with the JWT-secret provided to Fasttrack.
In the Playground:
- Go to the Headers section.
- Add:
๐ GraphQL Schema Overview
The schema provides root types for:
- Queries
- Mutations
- Subscriptions
๐ Queries
| Query | Return Type | Description |
|---|---|---|
Fetch user bonuses. | ||
Get a user calendar by ID. | ||
Retrieve the menu structure. | ||
Get brand configuration settings. | ||
Fetch user profile information. | ||
List challenges for the user. | ||
Retrieve reward program info. | ||
Get a shop page by ID. |
โ๏ธ Mutations
| Mutation | Description |
|---|---|
Claim a prize from a wheel spin. | |
Spin the reward wheel. | |
Initialize the wheel for spinning. | |
Consume a user bonus. | |
Open a door on a calendar. | |
Purchase an item from the shop. |
๐ Subscriptions
Real-time updates over WebSocket:
| Subscription | Return Type | Description |
|---|---|---|
Receive live status updates. |
๐งน Type Definitions
UserBonusV2
BonusV2
๐ Calendar Types
GetUserCalendarByIDRequest:
GetUserCalendarByIDResponse
UserCalendar
CalendarDoor
๐ Menu
GetMenuResponse
MenuItem
โ๏ธ Configuration
Configuration
๐ก๏ธ Other Important Types
Level:
VirtualCurrency:
Branding:
Reward
๐ค User
User
LoyaltyBalance
UserWallet
WheelToken
๐ Challenges
Challenge
Task
ChallengeAppearence
๐ Shop
GetShopPageByIDResponse
ShopPage
ShopItem
๐ Wheel & Prizes
Wheel
ClaimWheelPrizeInput
SpinWheelResponse
Prize
PrizeOption
Path
PathPrize
InitializeWheelResponse
UnclaimedPrize
๐ Status Update
StatusUpdate
โ Notes
- Always use Bearer tokens correctly in authentication headers.
- Fields and types are strictly typed; incorrect input formats may lead to errors.