Integrations API overview

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 feature

The 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 /providers tells 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 is nest.
  • 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 state is PendingAuth until sign-in details are saved, Callable once a test has succeeded, Invalid if the provider has since rejected them, and Deauthorised after 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-contributions and pension.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 token plus default English text. Branch on the token; show the text.

What happens when something is sent

  1. A consumer, normally the Pensions API acting on your instruction, asks for a submission. An operation is created with status Pending and the request is acknowledged immediately.
  2. 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, and expectedReadyDate says when the provider expects to be done.
  3. Flow Payroll collects the result as soon as the provider has it. The operation becomes Succeeded, and for a contribution schedule providerReference carries the reference the provider assigned, which a later payment approval refers to.
  4. If the provider rejects the submission, or part of it, the operation becomes NeedsAttention with a token saying why, and the provider's detailed response is kept for support to inspect.
  5. The consumer is told the outcome, so the Pensions API's own record of the pay run is updated without you polling this service.
StatusMeaning
PendingQueued, not yet sent, or waiting for its next attempt (nextAttemptDate). Can be cancelled.
AwaitingProviderAccepted by the provider, which is still processing it.
SucceededThe provider accepted it in full.
FailedThe last attempt failed and no automatic retry is due. Can be retried.
NeedsAttentionStopped for a reason a retry alone will not fix. lastErrorToken says which. Can be retried once the cause is dealt with.
CancelledCancelled 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 NeedsAttention with provider_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}/imports asks for one or more kinds to be no older than maxStalenessMinutes (0 reads now). Per kind, the response says whether the data was already Fresh, a read was already InFlight, a new read was Requested, or the kind is Unavailable.

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

TokenDefault text
provider_rate_limitedThe provider asked us to slow down. Sending carries on automatically in a few minutes.
provider_authentication_failedThe provider rejected the sign-in details. Re-enter them on the connection, then try again.
provider_validation_failedThe provider rejected the submission because some of the details did not pass its checks.
provider_unavailableThe provider could not be reached. It is retried automatically.
provider_account_lockedThe provider has locked this account. Sign in to the provider directly to unlock it, then test the connection.
provider_partial_failureThe provider accepted some of the workers and rejected the rest.
provider_capability_unsupportedThe connected provider does not support this kind of submission.
provider_circuit_openThe provider is not responding for anyone right now. Sending is paused and starts again automatically once it recovers.
provider_result_overdueThe provider accepted this but has not returned a result in two days. Check it with the provider, then retry or cancel.
provider_call_failedThe provider did not complete the request.
connection_circuit_openSending is paused after repeated failures from the provider, and starts again automatically in about ten minutes.
connection_not_callableThis connection is not ready to use. Finish connecting it, then test it, before sending.
connection_has_bindingsThe connection is still linked to a scheme. Unlink it before disconnecting or removing it.
binding_not_foundThe record is not linked to any connection.
operation_not_retryableThe operation is still running or has already finished.
operation_not_cancellableThe operation has already reached the provider.

Treat an unrecognised token as a generic failure; the list grows.

Typical workflow

  1. Read the catalogue with GET /providers. For NEST the required sign-in fields are username, password and employerReference.
  2. POST /connections with providerSlug: "nest", then PUT /connections/{connectionId}/credentials with the employer's NEST sign-in (their own or a delegate's) and their employer reference, the EMP number.
  3. POST /connections/{connectionId}/test. On success the connection is Callable and NEST's groups and payment sources are read; GET /connections/{connectionId}/pension/setup returns them once status is ready. Set the scheme's payment source to one of the names returned.
  4. Link the scheme: PUT /bindings/pension/pension-scheme/{schemeId} with the connectionId.
  5. If the employer already uses NEST, POST /connections/{connectionId}/sync-sessions reads what NEST holds; GET /connections/{connectionId}/sync-sessions/latest shows progress.
  6. 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} with enabled: false keeps 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 /operations while nextPaginationToken is 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.