Skip to main content
Every Flowmatic API request — except the registration, verification, and login endpoints themselves — requires a valid JSON Web Token (JWT) passed in the Authorization header. This guide covers the complete authentication lifecycle: creating your account, verifying your email, obtaining tokens, using them in requests, and refreshing them before they expire. Follow these steps once to bootstrap your integration, then automate token refresh so your application never has to ask users to log in again.
Never hard-code your accessToken or refreshToken in source code, client-side JavaScript, or public repositories. Store tokens in environment variables, a secrets manager, or a secure server-side session store. Treat them with the same care as passwords.

Step 1 — Register an Account

Send a POST request to /api/auth/register to create a new Flowmatic account. On success, Flowmatic sends an OTP (one-time passcode) to the email address you provide. You will need this OTP to verify your email in the next step.
string
required
The email address for your new account. Must be a valid, deliverable address — this is where OTPs and workflow notifications are sent.
string
required
Your chosen password. Minimum 8 characters. Flowmatic stores your password securely and never exposes it after account creation.
string
required
Your full name. Displayed in the dashboard and included in account-level emails.
If you already have an account and just need a new OTP, skip to Resend OTP below. Do not register again — duplicate registration attempts return a 409 error.

Step 2 — Verify Your Email Address

After registration, Flowmatic locks the account until the email address is confirmed. Submit the OTP from your inbox to unlock it. On success, Flowmatic immediately returns an accessToken and a refreshToken — you can start making authenticated requests without a separate login call. OTPs are single-use and expire after 10 minutes.
string
required
The email address you registered with.
string
required
The six-digit code delivered to your inbox after registration (or after a resend request).
string
A signed JWT used to authenticate API requests. Include it in the Authorization: Bearer header. Use POST /api/auth/login to check the expiresIn value, or refresh proactively before it expires.
string
A long-lived token used to request new access tokens via POST /api/auth/refresh-token without re-entering credentials.

Resend OTP

If your OTP expired or never arrived, request a fresh one. Flowmatic invalidates any previously issued OTP before sending the new one, so only the latest code is valid.
string
required
The email address associated with the unverified account.
Resend requests are rate-limited. If you trigger this endpoint too frequently, you will receive a 429 Too Many Requests response. Wait at least 60 seconds between resend attempts.

Step 3 — Log In

For any session after your initial verification, use POST /api/auth/login to exchange your credentials for a fresh JWT accessToken and a refreshToken. Both are required for a complete integration — the accessToken authenticates your API calls, and the refreshToken lets you obtain a new accessToken without asking the user to re-enter their password.
string
required
Your verified email address.
string
required
Your account password.
string
A signed JWT used to authenticate API requests. Include it in the Authorization: Bearer header. Expires after expiresIn seconds.
string
A long-lived token used to request new access tokens. Does not expire on a fixed schedule but is invalidated when you call the logout endpoint or refresh it (single-use).
integer
The number of seconds until the accessToken expires. Typically 3600 (one hour).
string
Always "Bearer". This is the authentication scheme you must use in the Authorization header.
The refreshToken is single-use. Once you exchange it for a new accessToken, the old refreshToken is invalidated and a fresh one is issued. Always persist the latest refreshToken returned by /api/auth/refresh-token.

Step 4 — Authenticate Requests

With your accessToken in hand, add it to every API request using the standard HTTP Authorization header:
Here is an example of an authenticated request to list your workflows:
If you omit the header or supply an expired token, Flowmatic returns 401 Unauthorized:
The Authorization header is case-insensitive for the header name but the scheme must be exactly Bearer (capital B). Most HTTP clients handle this automatically.

Step 5 — Refresh Your Access Token

Access tokens expire after expiresIn seconds (typically one hour). Rather than asking users to log in again, exchange your refreshToken for a new pair of tokens using POST /api/auth/refresh-token.
string
required
The refreshToken received from your most recent login or token-refresh call. This token is invalidated once used.
string
Your new access token. Replace the previous value in your token store immediately.
string
A new refresh token. Persist this and discard the old one — the old token is now invalid.

Token Expiry and Refresh Strategy

Understanding when and how to refresh keeps your integration running smoothly without unnecessary re-authentication prompts. Recommended approach for server-side integrations:
  1. After login, store accessToken, refreshToken, and a calculated expiresAt timestamp (Date.now() + expiresIn * 1000).
  2. Before every API request, check if expiresAt is within 60 seconds of the current time.
  3. If so, call POST /api/auth/refresh-token first, update both stored tokens and expiresAt, then proceed with the original request.
  4. If a request still returns 401 after a refresh (rare, but possible if the refresh token was also invalidated), fall back to prompting for credentials.
If your refreshToken is compromised, an attacker can silently obtain new accessTokens indefinitely. Immediately log out all sessions from the Flowmatic dashboard under Account → Security → Revoke All Sessions to invalidate all outstanding refresh tokens.

Authentication Endpoint Summary

All other Flowmatic endpoints require Authorization: Bearer <accessToken>.
Looking for a complete walkthrough that ties authentication into a real workflow? See the Quickstart guide — it covers every step from registration through to monitoring a live run.