accessToken expires, rather than asking you to log in again, you can exchange your refreshToken for a brand-new accessToken and refreshToken pair. This endpoint supports seamless token rotation — both tokens are replaced on every call, so you should always store and use the latest values returned.
Endpoint
Request Body
string
required
The refresh token most recently issued to your account — either from a previous login, email verification, or a prior call to this endpoint. This value is a signed JWT and must be submitted exactly as received. It is invalidated as soon as this request is processed successfully.
Example Request
- Request
- Request Body
- Response
Response Fields
string
A new short-lived JWT for authenticating API requests. Replace your previously stored
accessToken with this value immediately. Pass it as a Bearer token in the Authorization header of all subsequent Flowmatic API calls.string
A new long-lived refresh token that replaces the one you submitted in the request body. Store this securely and discard the old value — the previous refresh token is now permanently invalidated and cannot be reused.
Using the New Access Token
After a successful token refresh, use your newaccessToken in the Authorization header just as you did before:
If your
refreshToken itself has expired (refresh tokens are long-lived but not indefinite), you will need to re-authenticate using POST /api/auth/login to obtain a new token pair.Token Rotation Best Practices
- Always persist the latest tokens. After every call to this endpoint, overwrite both your stored
accessTokenandrefreshTokenwith the freshly issued values. - Refresh proactively. Rather than waiting for a request to fail with a
401 Unauthorizederror, check theexpclaim in youraccessTokenJWT and refresh before it expires to avoid interruptions to your workflows. - Never share tokens. Treat both tokens as secrets equivalent to a password. Store them in environment variables, a secrets manager, or an encrypted store — never in source code or logs.