Connect an employer's NEST account, link a pension scheme to it, follow every submission and every read from the provider, and keep the provider's data fresh.
Integrations API overview
The Integrations API is how Flow Payroll talks to third-party providers on your behalf. Today that means NEST: you connect an employer's NEST account once, link a pension scheme to it, and the Pensions API can then send enrolments and contribution schedules straight to NEST, approve the payment, and read back what NEST reports. Everything sent or read is recorded as an operation you can follow, retry or cancel.
The service lives at /v1/integrations under the same gateway as every other service: https://api.sandbox.flowpayroll.ai/v1/integrations in sandbox.
Two APIs, one featureThe Integrations API holds the connection and the record of what happened. The submissions themselves are made through the Pensions API, under Provider submissions, which knows what a pay run contains. Read this page for connections, freshness and reliability; read Provider submissions for how to send a pay run.
Key concepts
- Provider — an entry in the catalogue of services Flow Payroll can send to.
GET /providerstells you how each one is signed in to, which sign-in details it needs, what it can do and which kinds of data it can be read for. NEST's slug isnest. - Connection — one employer's account with a provider. It holds the sign-in details (stored encrypted, never returned), the employer reference the provider knows the employer by, and the connection's health. Its
stateisPendingAuthuntil sign-in details are saved,Callableonce a test has succeeded,Invalidif the provider has since rejected them, andDeauthorisedafter a disconnect. - Scheme link (a binding) — the record that a pension scheme sends through a connection. Linking is the opt-in. A scheme that is not linked keeps delivering by export file, and nothing is ever sent for it.
- Operation — one thing sent to a provider or read from it: a batch of enrolments, a contribution schedule, a payment approval, or a read of opt-outs, stopped contributions, refunds, schedules or setup data. Every operation has a status, a count of attempts, and the provider's own reference once it has one.
- Provider data (an import) — data Flow Payroll reads from the provider rather than sends:
pension.setup(groups and payment sources),pension.schedules,pension.opt-outs,pension.stopped-contributionsandpension.refunds. Each kind records when it was last read and the date it is synced through. - Initial import (a sync session) — a one-off read of everything the provider already holds for the employer, so an employer moving to Flow Payroll starts from what the provider already has.
- Message token — every failure carries a stable, provider-agnostic
tokenplus default English text. Branch on the token; show the text.
What happens when something is sent
- A consumer, normally the Pensions API acting on your instruction, asks for a submission. An operation is created with status
Pendingand the request is acknowledged immediately. - The submission is sent to the provider. NEST processes submissions asynchronously: it acknowledges the request, then finishes it minutes or hours later. While that happens the operation is
AwaitingProvider, andexpectedReadyDatesays when the provider expects to be done. - Flow Payroll collects the result as soon as the provider has it. The operation becomes
Succeeded, and for a contribution scheduleproviderReferencecarries the reference the provider assigned, which a later payment approval refers to. - If the provider rejects the submission, or part of it, the operation becomes
NeedsAttentionwith a token saying why, and the provider's detailed response is kept for support to inspect. - The consumer is told the outcome, so the Pensions API's own record of the pay run is updated without you polling this service.
| Status | Meaning |
|---|---|
Pending | Queued, not yet sent, or waiting for its next attempt (nextAttemptDate). Can be cancelled. |
AwaitingProvider | Accepted by the provider, which is still processing it. |
Succeeded | The provider accepted it in full. |
Failed | The last attempt failed and no automatic retry is due. Can be retried. |
NeedsAttention | Stopped for a reason a retry alone will not fix. lastErrorToken says which. Can be retried once the cause is dealt with. |
Cancelled | Cancelled before it reached the provider. |
Reliability
- Nothing is lost. An operation that cannot be completed is parked as
NeedsAttention, never discarded. It stays in the activity list with its reason until it is retried or cancelled. - Temporary failures retry themselves. If the provider cannot be reached or answers with a temporary error, the operation is retried automatically: up to five attempts spread over roughly eight hours, with the gaps growing from about half a minute to six hours. If the provider says how long to wait, that is honoured instead. Only when the last attempt fails does it park.
- Failures a retry cannot fix park at once. A rejected sign-in (
provider_authentication_failed), a locked account (provider_account_locked) or rejected content (provider_validation_failed) are not retried, because repeating them cannot help and repeated sign-in failures can lock the account on the provider's side. - Partial acceptance is never reported as success. If the provider accepts some members and rejects others, the operation is
NeedsAttentionwithprovider_partial_failure. - Repeated failures pause the connection, briefly. After five failures in a row on one connection, sending through it pauses for ten minutes (
connection_circuit_open) and resumes on its own. If the provider is failing for everyone, sending pauses for all connections to it until it recovers (provider_circuit_open). - A provider that goes quiet is flagged. If the provider acknowledged a submission but has not returned a result within two days, the operation parks as
provider_result_overdue, for you to check with the provider and then retry or cancel. - Sending twice is safe. Every submission carries an idempotency key. Sending the same request again returns the original operation rather than creating a second one. The Pensions API derives its key from the pay run and the content it sends, so an unchanged run is not re-sent and a corrected one is.
- Calls are paced. Requests to a provider stay within a conservative budget per connection (for NEST, 30 a minute and 2,000 a day, published on the provider entry). If the provider asks Flow Payroll to slow down (
provider_rate_limited), the operation waits and continues automatically. - We are alerted too. A parked operation, a paused connection and a provider that stops answering all raise alerts on our side.
Keeping provider data fresh
A member who opts out or stops contributions tells NEST, not Flow Payroll. Flow Payroll therefore reads that data from the provider and applies it, on three triggers:
- Ahead of a pay run. The Pensions API asks for opt-outs and stopped contributions to be no older than six hours when a pay run is opened, and reads them again at the moment the run is locked.
- On a schedule. Opt-outs and stopped contributions are read at least daily. Setup data, schedules and refunds are read at least weekly, and again after every successful submission.
- On demand.
POST /connections/{connectionId}/importsasks for one or more kinds to be no older thanmaxStalenessMinutes(0reads now). Per kind, the response says whether the data was alreadyFresh, a read was alreadyInFlight, a new read wasRequested, or the kind isUnavailable.
GET /connections/{connectionId}/imports shows the state per kind. Each read starts from a few days before the last successful one, so a change reported between two reads is never missed, and the synced-through date only moves forward when a read succeeds.
Message tokens
| Token | Default text |
|---|---|
provider_rate_limited | The provider asked us to slow down. Sending carries on automatically in a few minutes. |
provider_authentication_failed | The provider rejected the sign-in details. Re-enter them on the connection, then try again. |
provider_validation_failed | The provider rejected the submission because some of the details did not pass its checks. |
provider_unavailable | The provider could not be reached. It is retried automatically. |
provider_account_locked | The provider has locked this account. Sign in to the provider directly to unlock it, then test the connection. |
provider_partial_failure | The provider accepted some of the workers and rejected the rest. |
provider_capability_unsupported | The connected provider does not support this kind of submission. |
provider_circuit_open | The provider is not responding for anyone right now. Sending is paused and starts again automatically once it recovers. |
provider_result_overdue | The provider accepted this but has not returned a result in two days. Check it with the provider, then retry or cancel. |
provider_call_failed | The provider did not complete the request. |
connection_circuit_open | Sending is paused after repeated failures from the provider, and starts again automatically in about ten minutes. |
connection_not_callable | This connection is not ready to use. Finish connecting it, then test it, before sending. |
connection_has_bindings | The connection is still linked to a scheme. Unlink it before disconnecting or removing it. |
binding_not_found | The record is not linked to any connection. |
operation_not_retryable | The operation is still running or has already finished. |
operation_not_cancellable | The operation has already reached the provider. |
Treat an unrecognised token as a generic failure; the list grows.
Typical workflow
- Read the catalogue with
GET /providers. For NEST the required sign-in fields areusername,passwordandemployerReference. POST /connectionswithproviderSlug: "nest", thenPUT /connections/{connectionId}/credentialswith the employer's NEST sign-in (their own or a delegate's) and their employer reference, theEMPnumber.POST /connections/{connectionId}/test. On success the connection isCallableand NEST's groups and payment sources are read;GET /connections/{connectionId}/pension/setupreturns them oncestatusisready. Set the scheme's payment source to one of the names returned.- Link the scheme:
PUT /bindings/pension/pension-scheme/{schemeId}with theconnectionId. - If the employer already uses NEST,
POST /connections/{connectionId}/sync-sessionsreads what NEST holds;GET /connections/{connectionId}/sync-sessions/latestshows progress. - Complete a pay run, then send it through the Pensions API's Provider submissions. Follow the resulting operations with
GET /operations?connectionId=..., and retry or cancel from here if needed.
Notes and best practices
- Nothing sends on its own. Completing a pay run produces the export files and stops. A submission only happens when the Pensions API is asked for one, and payment approval is a separate, explicit call.
- The export files never go away. A linked scheme still produces its provider files on every pay run.
- Sign-in details are write-only. No endpoint returns them. Test after every change.
- Pause rather than disconnect for a temporary stop:
PUT /connections/{connectionId}withenabled: falsekeeps the sign-in and the history. Disconnect and delete both refuse while a scheme is still linked (connection_has_bindings). - Follow the pagination token on
GET /operationswhilenextPaginationTokenis non-null, even when a page comes back empty.
Authentication
All Integrations API requests use the standard Flow Payroll authentication; see Getting started and Authentication.
