Overview

Ready to set up the Fluz API on your app? We recommend reviewing the topics listed below before you dive in. This overview will provide you with all the basic information and links you need to beginning setting up the Fluz API.

What is the Fluz API?

The Fluz API allows you to integrate some of Fluz's most powerful features on your own platform. Using the Fluz API, you now will be able to automate many of your account actions such as:

  • Purchasing gift cards
  • Adding bank accounts
  • Finding our best offers

Read more here

What is GraphQL?

Before getting started, please note that the Fluz API uses GraphQL. You will need to familiarize yourself with the basics of GraphQL to set up your Fluz API.

GraphQL is a query language for APIs that enables users to request precisely the data they need. GraphQL provides a single endpoint where users can specify their data requirements through structured queries. This is different from traditional REST APIs that rely on multiple endpoints with fixed data structures. At its core, GraphQL operates on a well-defined type system known as a schema, which defines the available data, types, and relationships within the API.

Read more here

How to get started with Fluz API?

To get started, you will first need to create a Fluz account. To create an account, visit fluz.app.

If you already have a Fluz account, visit apps-and-integration or navigate to the Fluz app main menu and click the Apps and integration menu.

Once you are on the Apps and integration page, you will need to create a developer account and create your first app.

Read more here

How to authenticate your app

Once you create an app in Fluz, we will provide you with an API key for that app. You can view and copy your API key on the app details widget. Each app you create on Fluz will have its own app details widget. To view an app details widget, go to your app list and click on an app. You will need to use your API key to create an access token to access the Fluz API system.

App details widget

To generate a User Access Token, use the generateAccessToken mutation. This mutation authenticates a user and returns a token that can be used in subsequent API calls that require user-level authorization. This mutation requires a userId, an accountId, and a scopes list as required inputs. SeatId is an optional input.
Put in your API key as the Basic token in the header of the request. You will receive the access token in the generateAccessToken response.

    "Authorization": "Basic <TOKEN>"

Your request may look like this:

mutation generateUserAccessToken(
  $userId: UUID!,
  $accountId: UUID!,
  $scopes: [ScopeType!]!,
  $seatId: UUID
) {
  generateUserAccessToken(
    userId: $userId,
    accountId: $accountId,
    scopes: $scopes,
    seatId: $seatId
  ) {
    token
    scopes
  }
}

Your response may look like this:

{
  "data": {
    "generateUserAccessToken": {
      "scopes": [
        "LIST_OFFERS",
        "LIST_PURCHASES",
        "LIST_PAYMENT"
      ],
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNTdlN2JkMTEtN2M2Ni00YTVmLWE3ZjAtMDVkMjNjYmIzN2M0IiwiYWNjb3VudF9pZCI6ImZhMjdhNGE5LWU3ZGItNGIxNS04ZjM2LWFmMDRhNzQ1ODc5MyIsInNjb3BlcyI6WyJMSVNUX09GRkVSUyIsIkxJU1RfUFVSQ0hBU0VTIiwiTElTVF9QQVlNRU5UIl0sImFwcF9pZCI6Ijc4ODE1YzA0LTFjODgtNGYyNy1hNzc5LTc0NjU4NTYwYzg5YyIsInNlYXRfaWQiOiIwOWQzODIyNC0zZjI1LTRiNzgtOGU2Yi00ZTg5NjAyMzE0ODkiLCJhY2NvdW50X3R5cGUiOiJCVVNJTkVTUyIsImlhdCI6MTczOTMxMDk4MywiZXhwIjoxNzM5MzExMjgzLCJzdWIiOiJ0cmFuc2FjdGlvbmFsLWdyYXBoLXNlcnZpY2UifQ.SuwzN_6yPaFuTP4-yAc8npU9A7iJkjImrfxBQy7gkgw"
    }
  }
}

Read more here

Understand the staging playground explorer

Fluz provides a staging GraphQL explorer for you to test your operations on before deploying. It is important to test your changes on staging first. This will ensure you understand how the changes will work and help you achieve the result you are looking for before deploying the change to your live environment.

To get to the staging environment, go to the Apps and integration page on fluz.app, and click on the "For developers" tab. Then, click on the "Open staging" button.

Note: Any upcoming changes announced in advance will be available on staging first for you to understand how the new changes work. Please be mindful of what environment you are on in the fluz.app portal. Please do not add any real personal or financial information on your staging environment.

Read more here

Viewing the Schema documentation

There are several places where you will be able to view the schema documentation. For the live environment, visit the api-reference page. You do not need to be signed into your Fluz account to view this document.

On your staging environment, you will also be able to view the schema on your API explorer page.

Making your first gift card purchase

Here's the quickest way to start purchasing a gift card.
You are able to customize your query with the data points that you need from the UserPurchase object. See UserPurchase for the full object.

mutation MyMutation {
  purchaseGiftCard(
    input: 
    {
      idempotencyKey: "ef7612a2-5737-4426-8853-fe2b04893e8a",
      amount: 10,
      bankAccountId: "4682a815-1a91-4a1b-a78c-65eb73dd13db",
      merchantSlug: "amazon"
    }
  ) {
    purchaseDisplayId
    purchaseId
    giftCard {
      giftCardId
    }
  }
}

Read more here