POST {{authBaseURL}}/oauth2/token
This endpoint obtains or refreshes an API token.
Each Flute endpoint (with the exception of this authentication endpoint) requires an API token, also called an access token). It is an encrypted string generated from a Flute-owned authentication server. The API token is a combination of an authentication of the user and an authorization of the user's permissions.
Each API token has a limited lifespan. This is often 900 seconds, or 15 minutes although the actual value is returned by the authentication call. After the API token expires, it can no longer be used to make calls. The API token must then be obtained anew or refreshed.
There are two ways to get a valid API token: Obtaining a new token or Refreshing an existing token.
The endpoint for obtaining a new API token or to refresh an existing one is the same. Only the request body fields are different. Selecting the appropriate option displays the relevant fields and information.
Obtaining a new token
A new token must be obtained because:
- No token exists. This may be from the user just logging in or the previous API token expired.
- The stored
refresh_tokenexpired, has been revoked, or gets rejected by the server (such as a refresh attempt failed). - A different API key is being used.
To obtain a new API token, see the call below, selecting Obtain a new token. This displays the fields and details needed to make the call.
Refreshing an existing token
An existing API token may be refreshed to create a new, valid API token. That existing API token may be currently valid or has expired recently. The goal is to provide continuous operation. This allows users to remain authenticated without repeating full credential authentication on every renewal.
An API token may be refreshed because:
- The current
access_tokenis about to or has already expired. - A valid
refresh_tokenis currently available and valid from the most recent API token.
To refresh an API token, see the call below, selecting Refresh an existing token. This displays the fields and details needed to make the call.
API token types depend on the type of API keys used to create them. The resulting API token type will be one of following:
- Merchant token if it is created from a merchant API key.
- Partner token if it is created from a partner API key.
The two API keys types are not interchangeable. Most Flute endpoints require a merchant token. The endpoint description specifies the required API key type. Endpoints requiring a partner token will be explicitly marked. Otherwise, a merchant token is required.
Use grant_type=client_credentials to obtain a brand-new API token from your API key.
Specifies client ID from the API key for the account.
Example: 59483870959438697242c
Specifies the client secret from the API key for the account.
Example: 9eb2c6859daa4d8ae5da02a9
Specifies the literal value client_credentials.
Example: client_credentials
- Sandbox environmenthttps://sandbox.api.flute.com/oauth2/token
- Production environmenthttps://api.flute.com/oauth2/token
// Language is not supported.OK. The API token was issued successfully.
Indicates the API token.
Example: 213bf7a8-9b0c-4d1e-2f3a-4b5c6d7e8f14
Indicates the expiration period (in seconds) of the API token.
Example: 900
Indicates the refresh token (only for authorization_code grant).
Example: 324c08b9-0c1d-4e2f-3a4b-5c6d7e8f9a25
{ "access_token": "213bf7a8-9b0c-4d1e-2f3a-4b5c6d7e8f14", "token_type": "Bearer", "expires_in": 900, "refresh_token": "324c08b9-0c1d-4e2f-3a4b-5c6d7e8f9a25", "scope": null }