Skip to main content
The Pay API is the core of Flow Payroll. It covers the full payroll cycle: setting up your organisation and payroll configurations, managing employee records and their tax details, uploading pay data, locking pay runs, retrieving payslips, and submitting RTI (FPS and EPS) to HMRC. Use it when you integrate payroll processing itself — the other services in this reference (pensions, statutory pay, court orders, and so on) build on the data this API manages. The Pay API sits at the /v1 base path, directly under the gateway base URLs listed in the API reference introduction. All endpoint paths on this page are relative to that base path.

Key concepts

  • Payroll configuration — a pay schedule that employees are assigned to. Every pay run belongs to exactly one payroll configuration, and an organisation can run several in parallel.
  • Pay run — the processing of one pay period, identified by payroll configuration, tax year, and period. Locking a run finalises it.
  • Pay element — an organisation-level definition of a pay item type (for example basic pay or overtime) that uploaded pay data refers to.
  • Payroll line — a single pay item uploaded for an employee for a pay date. Payroll lines are the input to a pay run’s gross-to-net calculation.
  • Payslip — the per-employee output of a pay run, retrievable individually, by pay run, or across a date range.
  • Effective-dated records — tax codes, NI categories, working patterns, and SSP qualifying-day policies are stored with effective dates, so a change applies from a given date without losing history.
  • FPS — the Full Payment Submission sent to HMRC for a specific pay run.
  • EPS — the Employer Payment Summary for a tax month, submitted from monthly balances or manually.
  • Year-end finalisation — closes a tax year for a payroll configuration once its final pay run is complete.

API structure

Organisation

Manage organisation information, HMRC settings, opening balances, year-to-date running balances, and PAYE liability, including recording the PAYE payments you make to HMRC. GET /organisation/information and POST /organisation/hmrc/settings are the starting points; organisation-wide working-pattern defaults live under /organisation/working-pattern-defaults. See the organisation setup guide for the product-side view.

Pay elements

Create, read, update, and delete the pay elements available to your organisation under /organisation/pay-element. Payroll lines reference these definitions.

Payroll configurations

Create and manage pay schedules with POST /payrollconfig and its companions. A configuration can carry its own working-pattern defaults that override the organisation default. GET /payrollconfig/{payrollConfigId} returns hasPayRuns, which tells you whether the pay schedule is still editable before you offer the fields — see Pay schedule changes below. The pay run settings guide explains the equivalent product screens.

Employees

Full lifecycle management of employee records: POST /employees to add one (needs employee:write and employee-payroll:write; changing an existing employee needs either, for the fields it covers), GET /employees to list with pagination, plus lookups by National Insurance number and payroll ID. Working patterns, working schedules, and SSP qualifying-day policies are managed per employee as effective-dated records — see working patterns for how a pattern is resolved and what each kind means. See also managing people. To find employees without paging through all of them, POST /employees/search filters on any employee field, sorts, answers only the fields you ask for, and says how many match in all. Dated values such as the tax code and NI category are read as on asAt. GET /employee-fields lists every field you can search, sort, export or import, with the kind of value it holds and its choices. GET /employees/headcounts counts the total, active employees, leavers and future leavers on a date. All three need employee:read, and a field your role cannot read is neither answered nor matched. To see your own change straight after a write, send the employee and the updatedDate your write returned in consistentWith. To export employees as a CSV, POST /employees/exports with the columns (field as GET /employee-fields names it, and an optional header) and the search to export, as POST /employees/search takes it. It answers 202 at once; GET /employees/exports/{exportId} gives the status and, once Completed, a download link that works for 12 hours (ask again for a fresh one; the file is kept for 30 days). GET /employees/exports lists the organisation’s 100 latest exports, each with requestedBy; the Administration API’s GET /organisations/{organisationId}/people names those ids. Each column must be a field your role can read. Everyone who can export sees the organisation’s exports, but the link goes only to whoever started an export or to a role that reads every column in it; anyone else gets downloadUnavailable. These need employee:export. Save column layouts with the CSV mapping routes under the EMPLOYEE_EXPORT type. To update many employees at once, POST /employees/imports with the file’s text as csv: one row per employee, found by the column matchBy names: EmployeeId (the default: the id column, the export’s Employee ID), PayrollId, NiNumber, EmployeeCode or Email, with the export’s columns or any field path. That column is never changed, and a value more than one employee holds is a problem on its row, never the first match. Only cells that differ change, and an empty cell leaves a field as it is. GET /employees/imports/{importId} shows the preview once Ready, and POST /employees/imports/{importId}/apply saves it, each row decided as PATCH /employees/{employeeId} decides it. Sending and applying need employee:write, employee-payroll:write, employee-payroll-id:write, employee-pay-schedule:write or working-pattern:write; each row’s changes are then judged field by field. A change your role cannot make is never sent: the preview lists it in that row’s warnings, and the rest of the row is applied. A change that is applied but worth knowing about first, such as HMRC getting an employee’s start date and starter declaration again on the next FPS, is listed in that row’s notices.

Tax codes, NI, and loans

Maintain each employee’s effective-dated tax codes and NI categories, update their NI number or payroll ID, and start or end student and postgraduate loans. GET /employees/{employeeId}/effective-tax-info returns the tax code and NI category in force on a given date.

Starters and leavers

Set starter details with PUT /employees/{employeeId}/starter. alreadySentToHmrcFps says whether HMRC already has the start date and starter declaration: while it is false the next FPS sends them, and it becomes true when HMRC accepts that FPS. You can change it at any time; setting it back to false sends them again on the next FPS. Set or cancel leaver details individually or in bulk via PUT /employees/leaver/bulk. See the onboarding and leavers guides.

Payroll runs and pay data

Upload pay data with POST /payroll/line/{employeeId}, attach supporting documents to lines, and set employee opening balances and payroll-config assignments. Create a run for a specific period, or use POST /payroll/{payrollConfigId}/next to create the next one in sequence, then finalise it with POST /payroll/{payrollConfigId}/{year}/{period}/lock. Listing endpoints return runs by tax year and the employees included in a run.

Calculator

POST /calculator/grosstonet calculates gross-to-net values, including tax and NI, so you can preview figures before locking a run.

Payslips

Retrieve payslips for a whole pay run, for an employee in a period, or for an employee across a date range. You can also set payslip metadata such as notes and a payment-date overwrite, and send payslip notification emails with POST /notification/email/payslip/{payrollConfigId}/{year}/{period}. See the payslips guide.

Reading pension on a payslip

A payslip reports pension in two places, and they describe the same money:
  • forPeriod.pension (and the year-to-date and employment-to-date equivalents) is the member’s total pension movement for the slice: contributions deducted, including additional voluntary contributions, less any opt-out refunds paid back.
  • summaryItems carries one row per pension contribution, each classified by pensionLineType, for organisations using itemised pension contributions.
Read one source or the other, never both. If you sum the deductions in summaryItems and then add forPeriod.pension on top, you will double count every pension contribution.
pensionLineType is the field to branch on. It is null on every non-pension item, so the presence of a contribution row is what tells you which source to use: A refund is money going back to the employee, so it is a payable row with a positive amount, and forPeriod.pension has it netted off already. Keep it out of your contribution total and subtract it separately if you need the member’s net movement for the period.
pensionRefundsByType on the same object breaks the period’s refunds down per scheme type, if you would rather read the totals than the rows. Two more fields ride on those rows and are never additive:
  • pensionEmployerContribution is the employer contribution attributable to that line. It is already inside forPeriod.employerPension, so it is display metadata, not a separate cost.
  • pensionMetadata records the context the row calculated under: the pension group, the contribution basis, the employer share, and a contributionSource saying whether the settings came from the group, a standing per-employee override, or an override for this pay run only.
Branch on pensionLineType, not on anything about the organisation. A payslip calculated before an organisation’s pension setup changed still has to add up, and the rows on the payslip are the only thing that tells you how it was calculated.
Salary sacrifice behaves the same on both engines: sacrificed pay is the employer’s contribution, so it stays out of forPeriod.pension (which is 0 for a purely sacrifice arrangement) and lands in forPeriod.employerPension. The sacrifice itself has always appeared in summaryItems as a Contribution row, because that is how a payslip shows it. What is new for relief-at-source and net-pay-arrangement schemes is that their contributions now appear as rows too, where previously forPeriod.pension was the only place they showed up.

RTI

Trigger an FPS for a pay run with POST /rti/fps/{payrollConfigId}/{taxYear}/{period} and retrieve its details. Submit an EPS from monthly balances or manually, resubmit a manual EPS, and list submissions by tax year. See the HMRC RTI guide.

Year end

Finalise year-end for a payroll configuration with POST /payroll/year-end/{taxYear}/{payrollConfigId}/finalise, and read finalisations per configuration or across the organisation.

Typical workflow

  1. Set your organisation information and HMRC settings with POST /organisation/information and POST /organisation/hmrc/settings.
  2. Create a payroll configuration with POST /payrollconfig and define your pay elements under /organisation/pay-element.
  3. Add employees with POST /employees, then set their starter details, tax codes, and NI categories.
  4. Upload each employee’s pay data for the period with POST /payroll/line/{employeeId}.
  5. Preview the figures with POST /calculator/grosstonet and resolve any validation issues reported on upload.
  6. Lock the run with POST /payroll/{payrollConfigId}/{year}/{period}/lock, then retrieve payslips for the run and email them to employees. The running a pay run guide covers the same flow in the product.
  7. Submit the FPS for the run with POST /rti/fps/{payrollConfigId}/{taxYear}/{period}, and submit the EPS for each tax month from monthly balances.

Notes and best practices

  • Pagination — GET /employees accepts pageSize (1–100) and paginationToken; pass the returned token to fetch the next page.
  • Payroll line uploads — each request accepts up to 100 lines. Lines that fail validation are reported back, and every accepted line’s response includes a payrollDate: the date you supplied, or the next unlocked pay date if that date’s run is already locked.
  • Locking — locking creates the pay run record in a locked state for that configuration, tax year, and period. Upload and correct pay data before you lock.
  • Unlocking — POST /payroll/{payrollConfigId}/{year}/{period}/unlock (permission pay-run:unlock) reopens a locked, completed run of a configuration, for every employee (scope: "Full") or for some (scope: "Employees" with employeeIds), with a reason, and every later locked run of that configuration with it (the answer lists them as alsoUnlocked; lock them again in period order). Each reopened payslip keeps its issued figures as a version and reads status: "Reopened" with the next lockCycle until you lock the run again; it recalculates and accepts pay data exactly as a preview does. GET .../history lists one entry per lock cycle (who locked and unlocked it, every FPS attempt of that cycle with its outcome and 15-minute links to its preview and submitted XML, and how far the unlock has got reopening its payslips: reopenExpected and reopenDone; GET /rti/fps/... answers the current cycle only), and GET /payslip/data/{employeeId}/{year}/{period}/versions returns the earlier versions; GET .../file?lockCycle=n returns the PDF that lock issued, kept when the run was unlocked. Locking again (pay-run:lock) answers 409 with the token lock_payroll_run_unlock_in_progress while the unlock is still reopening payslips (X-Unlock-Override: true locks anyway and is recorded on the cycle); pass lateReportingReason on the lock when the corrected FPS goes after the payment date, and the FPS you then send carries only the corrected payslips (HMRC’s late reason defaults to H). An EPS already sent for that tax month is flagged figuresChangedSinceSubmission rather than resent. A leaver whose P45 has gone is reopened like anyone else: the correction reaches HMRC on the FPS, never as a second P45, and the cycle’s history names them under leaversWithIssuedP45 so you can tell them in writing. Unlocking is refused (409) for a run that is not locked and completed, once the tax year is finalised, for the last period of a tax year that has ended, and in environments where it is switched off.
  • Payslip pensionDetails — the pension scheme snapshot under employeeDetails.pensionDetails is deprecated as output and stops being returned on 14 January 2027; read pensionLineType and pensionMetadata on the pension items under summaryItems instead. See Deprecations.
  • FPS request body — POST /rti/fps/{payrollConfigId}/{taxYear}/{period} takes { "finalSubmissionDetails": { ... }, "lateReason": "..." }, both optional. lateReason is HMRC’s late reporting reason for an FPS sent after the payment date (codes A, B, C, D, F, G, H; the withdrawn code E is rejected) and is reported on every payment. Sending the final submission details object as the body itself is deprecated as input and stops being accepted on 15 January 2027; wrap it in finalSubmissionDetails. See Deprecations.
  • EPS corrections — a manual EPS can be resubmitted with POST /rti/eps/{taxYear}/manual/{submissionId}/resubmit if HMRC rejects it or the figures change.
  • Opening balances — the flat NI totals on openingBalanceDirector and the aggregate pension on openingBalance are deprecated as input and stop being accepted on 7 November 2026; send niBandResult and pensionContributionsByType instead. Both keep being returned on responses, so only what you send changes. See Deprecations.
  • Salary — salary is deprecated as input on PUT and PATCH /employees/{employeeId}, and stops being accepted on those two operations on 20 December 2026; record changes with PUT /employees/{employeeId}/salary, which keeps an effective-dated history. POST /employees still accepts it as the starting salary, and it keeps being returned on every response as the amount in force today, so only what you send changes. See Deprecations.
  • Pay schedule changes — payFrequency and paymentPeriodConfig can only be changed on a payroll configuration that has no pay runs. Once a run exists, of any status, PUT /payrollconfig/{payrollConfigId} refuses a change to either with a 409 and the token payroll_config_has_pay_runs. Everything else on the configuration stays editable, and re-sending the two fields unchanged is always accepted, so a full-body PUT that only renames the schedule still works. GET /payrollconfig/{payrollConfigId} returns hasPayRuns so you can show the fields as locked instead of waiting for the refusal; it is read-only and ignored if you send it back.
  • Payslip PDFs — GET /payslip/data/{employeeId}/{year}/{period}/file returns the payslip as application/pdf (send Accept: application/pdf), with the file name in Content-Disposition. It is not password-protected; only the copy emailed to the employee is.
  • Pension totals: take pension from the summaryItems rows or from forPeriod.pension, never from both. See reading pension on a payslip.

Authentication

Every request needs a bearer token in the X-Auth-Token header, and credentials with access to more than one organisation should also send X-Org-Id — see Authentication. All responses use the shared envelope described in Response format.