Skip to main content

Obtain your API credentials

Once your application is created in the Developer Console, select it to find its API Key, User ID, and Account ID.
Where to find them: the Developers page, inside the application you created. These credentials power API key authorization — primarily administrative calls and generating user access tokens.
Obtain API credentials Every Fluz API request uses a user access token in the Authorization header. You mint the token by calling the generateUserAccessToken mutation with your API Key in the Authorization: Basic <API_KEY> header, passing the User ID and Account ID from the console as arguments.

Generate an access token

The response contains the access token, a refresh token, and the scopes the token carries:
Select refreshToken explicitly. If you request only token and scopes, you never receive one, and your only option when the access token expires is to mint a new one from scratch. See Refresh an expired access token.

Identifying the user

scopes is the only always-required argument. Identify the user in one of two ways:
UUID
For applications operating on your own account. Both values are shown on your application in the Developer Console.
String
For OAuth applications operating on a customer’s account — your own identifier for that user, the same value passed as external_id during the OAuth authorization flow. When you provide it, userId and accountId are optional. See Client-facing OAuth grant flow.
UUID
Optional. Selects which seat transacts. Defaults to the most recently created seat.

Use the token

Attach the token to every GraphQL request against the transactional graph:
Never ship your API key to a browser or mobile client. Mint access tokens server-side and forward only the token to the client if you must.

If the token request returns 401

A rejected API key returns the same message whether it is unknown, malformed, or from the wrong environment:
The one exception is a real key on an application that has been disabled — that returns a 403 naming the status instead: Application <app_id> is not in a valid status: <STATUS>. Work through these in order.
This is the most common cause. Staging and live have separate applications and separate credentials — a key created in one is unknown to the other, and the error looks identical either way.Check where you created the application:A live key sent to the staging endpoint fails here, and the reverse is also true. If you only have a live application, register a second one in staging.
Your API key is a base64-encoded app_id:app_secret pair. Copy it whole from the console rather than reassembling it, and do not base64-encode it again — it is already encoded. Send it verbatim:
If the key was regenerated in the console, older copies stop working immediately.
Applications only authenticate while active. A deleted application is indistinguishable from a bad key — the same 401 comes back. A disabled application is the one case that looks different: the response is a 403 with Application <app_id> is not in a valid status: <STATUS>. Confirm the application still exists in the console for the environment you are calling and has not been disabled.
userId and accountId must be the values shown on the same application as the API key. Mixing IDs from one application with the key from another fails.
Confirm the endpoint host matches the console you created the credentials in. Environment mismatch accounts for most first-run 401s.

Mint a new token before expiry

Access tokens are short-lived. Mint a new one before the current one expires — don’t wait for a 401. See Refresh an expired access token for the exact call, and Authentication for the full flow, including OAuth grants for customer-scoped tokens.

Next steps

Quickstart: your first gift card purchase

Run the full happy path end to end — deposit funds, buy a gift card, and reveal it in the sandbox.

Replace an expired token

Mint a fresh access token when the current one expires.