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.
Step 1 — Register an Account
Send aPOST 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.
- Request
- Response (201 Created)
- Error (409 Conflict)
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 anaccessToken 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).
- Request
- Response (200 OK)
- Error (400 Bad 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.
- Request
- Response (200 OK)
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, usePOST /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.
- Request
- Response (200 OK)
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.Step 4 — Authenticate Requests
With youraccessToken in hand, add it to every API request using the standard HTTP Authorization header:
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 afterexpiresIn 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.- Request
- Response (200 OK)
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:
- After login, store
accessToken,refreshToken, and a calculatedexpiresAttimestamp (Date.now() + expiresIn * 1000). - Before every API request, check if
expiresAtis within 60 seconds of the current time. - If so, call
POST /api/auth/refresh-tokenfirst, update both stored tokens andexpiresAt, then proceed with the original request. - If a request still returns
401after a refresh (rare, but possible if the refresh token was also invalidated), fall back to prompting for credentials.
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.