| API Key | Label | Last Used | |
|---|---|---|---|
The FlowPayroll API uses token-based authentication. Every request must include a valid bearer token in the X-Auth-Token header.
How it works
Tokens are issued via the OAuth 2.0 client credentials grant. The flow is:
- You receive a
client_idandclient_secretfrom FlowPayroll (see Obtaining credentials below). - Your application exchanges those credentials for a short-lived access token at the FlowPayroll token endpoint.
- Your application sends the token in the
X-Auth-Tokenheader on every API request. - When the token nears expiry, repeat step 2 to mint a fresh one — do not call the token endpoint per request.
┌──────────────┐ client_id+secret ┌────────────────┐
│ Your service │ ───────────────────▶│ FlowPayroll │
│ │◀────── token ───────│ token endpoint │
└──────┬───────┘ └────────────────┘
│ X-Auth-Token: <token>
▼
┌──────────────┐
│ FlowPayroll │
└──────────────┘
Obtaining credentials
Client credentials are issued per integration. Contact your FlowPayroll account manager or [email protected] to request a client_id / client_secret pair.
Treatclient_secretlike a password. Never embed it in client-side code, mobile apps, or public repositories. Rotate immediately if exposure is suspected.
Requesting a token
POST your credentials to the FlowPayroll token endpoint using the standard OAuth 2.0 client credentials grant.
| Environment | Token endpoint |
|---|---|
| Sandbox | https://auth.sandbox.flowpayroll.ai/oauth2/token |
| Live | https://auth.flowpayroll.ai/oauth2/token |
POST /oauth2/token HTTP/1.1
Host: auth.sandbox.flowpayroll.ai
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRETResponse:
{
"access_token": "eyJraWQiOiJ...",
"expires_in": 3600,
"token_type": "Bearer"
}Cache the access_token in memory and reuse it until shortly before expires_in elapses.
Calling the API
Pass the token as X-Auth-Token on every request. Optionally include User-Id to attribute the call to a specific human user — this is recorded in audit logs but is not required for the request to succeed.
GET /payrollconfig HTTP/1.1
Host: api.flowpayroll.ai
X-Auth-Token: eyJraWQiOiJ...
User-Id: [email protected]Errors
| Status | Cause | What to do |
|---|---|---|
401 Unauthorized | Missing, malformed, or expired X-Auth-Token | Mint a fresh token and retry. |
403 Forbidden | Token is valid but lacks access to the requested resource | Verify your credentials grant the scope you need. |
429 Too Many Requests | Rate limit hit | Back off and retry; do not loop calling the token endpoint. |
Best practices
- Cache tokens. Hitting the token endpoint per API call will rate-limit you and adds unnecessary latency.
- Refresh proactively. Renew when ~10% of the token's lifetime remains, not after a 401.
- Log the token's
jticlaim, not the token itself, when correlating requests in your own observability. - Set
User-Idwhen a request is initiated by an end user in your product, so the action is traceable in FlowPayroll's audit log.
