Prerequisites
- A Fluz account — you’ll create staging API credentials and mint an access token in Steps 1–2 below.
- Requests go to the sandbox GraphQL endpoint. Nothing here charges a real card — see Staging vs. Live Environment.
- Every mutation needs a unique
idempotencyKey(a client-generated UUID) so a request is only ever processed once — see Idempotency.
Before you begin
Every call is aPOST request to a single GraphQL endpoint. Minting your token (Step 2) authenticates with your API Key; every other call authenticates with your bearer token:
The full flow
Five calls, each one setting up the next. The token carries the scopes; the balance funds the purchase; the merchant slug picks the offer; the purchase returns the gift card ID you reveal.Sign up and register an app
Create a Fluz account at fluz.app, then open the Developer Console and create a new Staging application. When the credentials appear, copy your API Key, User ID, and Account ID.Full walkthrough: Prepare your accounts.
Exchange credentials for an access token
Mint a short-lived, scoped user access token with your API Key. This call goes to the same GraphQL endpoint, authorized with Store the returned
Authorization: Basic <YOUR_API_KEY>; every later call uses the returned token as a Bearer credential.token and send it as Authorization: Bearer <token> on every request below. Tokens are short-lived — mint them server-side and mint a new one with the same mutation when one expires (see Refresh an expired access token). Full details: API credentials.Deposit funds to your Fluz balance
Pre-loading a Fluz balance generally makes gift card purchases faster and can bypass certain velocity checks. You can deposit two ways:
- Manually, via the sandbox Fluz website.
- Programmatically, via the
depositCashBalancemutation (shown below).
First, retrieve a payment method ID (getWallet)
First, retrieve a payment method ID (getWallet)
To deposit via API you need the ID of a funding source (e.g. a Grab the
bankCardId). Run getWallet and save the ID you want to use.bankCardId or bankAccountId from the response. Managing funding sources via the API requires the MANAGE_PAYMENT scope. More detail: View Funding Sources.Make the deposit
Use thedepositCashBalance mutation. It takes a DepositCashBalanceInput object.Input fields
string
required
A unique client-generated UUID that guarantees the deposit is processed only once.
Float
required
The amount to deposit.
CashBalanceDepositType
Destination balance. One of
CASH_BALANCE, GIFT_CARD_BALANCE, or RESERVE_BALANCE.UUID
Where the money comes from — provide one of
bankAccountId, bankCardId, or paypalVaultId.Int
Only for
GIFT_CARD_BALANCE. A four-digit MCC classifying the business. Use getMccList to retrieve valid values.UUID
When
CASH_BALANCE is selected, the specific spend account to deposit into.Sample response
Sample response
Deposits may settle instantly or within 2–5 business days depending on the funding source and settlement type. The
balances object in the response reflects your current available balance. See Check Account Balance to re-query it at any time.Browse merchants and pick an offer
With a balance ready, fetch the catalog of available merchants and their cashback offers using
getMerchants.Useful arguments
String
Filter merchants by name.
OffsetInput
{ limit, offset }. Default and max limit is 20.OfferTypesInput
Boolean flags for which offer types to return, e.g.
{ giftCardOffer: true, cardLinkedOffer: false }.FilterByInput
Filter offers within each merchant, e.g. by
deliveryFormat (URL, CODES, PIN_AS_CODE, PIN_WITH_URL).Pagination: the response may return fewer results than your
limit. To pull the full catalog, keep incrementing offset by your limit and stop when the API returns an empty array ([]). The unfiltered catalog is large — fetch it at most once per day, and use name or offerTypes for targeted lookups.Optional: get the single best offer for a merchant (getOfferQuote)
Optional: get the single best offer for a merchant (getOfferQuote)
If you already know the merchant and amount,
getOfferQuote returns the top available offer directly — including live stock info.merchantSlug and denomination are required. paymentMethod defaults to FLUZPAY (your Fluz balance) and also accepts BANK_CARD, BANK_ACCOUNT, PAYPAL, APPLE_PAY, and GOOGLE_PAY.Purchase a gift card
Use the
purchaseGiftCard mutation. You can identify what to buy in two ways:- Option A — Merchant slug (recommended)
- Option B — Specific offer ID
Pass a
merchantSlug and Fluz automatically applies the best available offer for that merchant.Input fields
string
required
A unique client-generated UUID so the purchase is processed only once.
UUID / String
required
Provide one.
merchantSlug auto-selects the best rate; offerId targets a specific offer.Float
required
The gift card amount to purchase.
UUID / Float
How to pay. Use
balanceAmount (Fluz balance), bankAccountId, bankCardId, or paypalVaultId. You may combine your Fluz balance with another source.Boolean
default:"true"
Falls back to your Fluz balance if another payment method fails. Set to
false to disable that fallback.Float
Minimum reward rate to accept when purchasing via
merchantSlug.UUID
Forces a specific exclusive rate. Found in
getMerchants for offers of type EXCLUSIVE_RATE_OFFER.UUID
The spend account (cash balance) to charge.
String / String / UUID
Optional expense metadata.
memo max 255 chars; categories are created on first use. See Add Expense Details.Sample response
Sample response
Hold on to the
giftCardId from the response — you’ll use it to reveal the card in the next step. If a purchase fails, check Gift Card Error Codes.Reveal the gift card details
Finally, retrieve the redeemable details (code, PIN, and/or URL).
Don't have the giftCardId? List your cards first (getGiftCards)
Don't have the giftCardId? List your cards first (getGiftCards)
Skip this if you just captured a You can filter with
giftCardId in Step 3. Otherwise, list your gift cards:status and userCashBalanceId, and page with paginate.Reveal redemption details
CallrevealGiftCardByGiftCardId with the giftCardId.Sample response
Sample response
Redemption fields vary by merchant. Some cards return an alphanumeric
code with no pin; others return only a url. Always render based on the deliveryFormat returned by getGiftCards (not getMerchants) — a merchant’s active offer can change after purchase, and getGiftCards reflects the format the card was actually bought under.You’re done 🎉
You’ve run a complete transaction — funded a balance, browsed offers, purchased a gift card, and revealed it. From here, explore the rest of the API:Virtual Cards
Issue and manage network-accepted virtual cards.
Wallets & Transfers
Open spend accounts and move funds between them.
Transaction Activity
Pull, filter, and annotate transaction history.
Embedded Widgets
Drop Fluz flows straight into your own UI.
Want to learn more? Contact us at support@fluz.app to speak with our experts or request a demo.