# Penfold Payroll API

> This is version `4.0` of this API documentation. Last update on Oct 19, 2026.
> Unified API for onboarding employers and managing employees, contributions,
> pay periods and file uploads.
> 
> 
> ## Authentication
> 
> Penfold provisions your integration as an organisation on this API. There are two
> organisation types, and the type you are given determines the OAuth2 flow you use,
> the scope of your access tokens, and which endpoints you may call — see
> **Organisation types and endpoint availability** below.
> 
> | Organisation type | OAuth2 flow | Token scope |
> |---|---|---|
> | Payroll | Authorization Code with PKCE (Amazon Cognito) | A single employer, who grants consent through the Penfold Workplace Platform |
> | Partner | Client credentials (Azure AD B2C) | Every organisation you manage, and the employers inside them |
> 
> Whichever flow you use, send API requests with `Authorization: Bearer <access_token>`
> over HTTPS, and store access and refresh tokens securely server-side.
> 
> ### Payroll organisations — Authorization Code with PKCE
> 
> An employer admin grants your application access through the Penfold Workplace
> Platform. The resulting access token carries an `employer` claim, so every request is
> scoped to that one employer; repeat the flow once per employer you integrate with.
> 
> The full flow — environment URLs, PKCE code verifier and challenge, worked examples
> and token refresh — is in the
> [integration guide](https://penfold.notion.site/oauth2-integration-guide). Two points
> are worth highlighting:
> 
> - The `redirect_uri` sent to `/oauth2/authorize`, and repeated unchanged when
> exchanging the code for tokens, is always Penfold's consent URL
> (`https://platform.getpenfold.dev/auth/oauth2-consent` on staging) — **not** your
> own callback URL.
> - Your callback URL is carried in the `state` parameter as `redirectUri`, and must be
> pre-registered against your organisation. If it is absent or unregistered, Penfold
> redirects to the first URL registered for your organisation rather than failing.
> 
> ### Partner organisations — client credentials
> 
> Server-to-server only — there is no interactive sign-in and no connection to the
> Penfold Workplace Platform. The token's application (client) ID is mapped to your
> Penfold organisation, which scopes all requests to the organisations you manage and
> the employers inside them.
> 
> When Penfold onboards your organisation, we provide the following via a secure channel:
> 
> - **Application (client) ID** — your Azure AD B2C app registration
> - **Client secret** — used with the client ID to obtain access tokens
> - **Webhook signing secret(s)** — for verifying inbound webhook signatures (see
> Webhooks below)
> 
> Penfold does not issue or deliver access tokens directly. Your servers obtain
> short-lived tokens from Azure AD B2C using the client ID and client secret, with
> `grant_type=client_credentials` and the scopes configured for your application.
> 
> Example token request (substitute `client_id`, `client_secret`, and scope):
> 
> ```
> TOKEN_URL='https://login.microsoftonline.com/36d1ec63-a7dc-48ca-a634-5514be9a63dd/oauth2/v2.0/token'
> curl --location --request POST "$TOKEN_URL" \
> --header 'Content-Type: application/x-www-form-urlencoded' \
> --data-urlencode 'grant_type=client_credentials' \
> --data-urlencode 'client_id=<client_id>' \
> --data-urlencode 'scope=https://penfoldstaging.onmicrosoft.com/<client_id>/.default' \
> --data-urlencode 'client_secret=<client_secret>'
> ```
> 
> ## Organisation types and endpoint availability
> 
> Most endpoints are available to both organisation types. The endpoints below are
> available to Partner organisations only — a Payroll organisation calling one
> receives `405 Method Not Allowed`. Each is also marked in its own description.
> 
> | Method | Path |
> |---|---|
> | `POST` | `/organisations` |
> | `GET` | `/organisations` |
> | `GET` | `/organisations/{organisation_id}` |
> | `PATCH` | `/organisations/{organisation_id}` |
> | `POST` | `/organisations/{organisation_id}/workplace_admins` |
> | `GET` | `/organisations/{organisation_id}/workplace_admins` |
> | `GET` | `/organisations/{organisation_id}/workplace_admins/{workplace_admin_id}` |
> | `DELETE` | `/organisations/{organisation_id}/workplace_admins/{workplace_admin_id}` |
> | `POST` | `/employers` |
> | `PATCH` | `/employers/{employer_id}` |
> | `POST` | `/employers/{employer_id}/agreement-signing-sessions` |
> | `GET` | `/employers/{employer_id}/agreement-signing-sessions/{signing_session_id}` |
> | `POST` | `/employers/{employer_id}/direct-debit-sessions` |
> | `GET` | `/employers/{employer_id}/pay_periods` |
> | `GET` | `/employers/{employer_id}/pay_periods/{pay_period_id}` |
> | `GET` | `/employers/{employer_id}/employees/{employee_id}/portfolio_summary` |
> | `GET` | `/employers/{employer_id}/employees/{employee_id}/pot_value_history` |
> | `GET` | `/employers/{employer_id}/employees/{employee_id}/transactions` |
> | `GET` | `/employers/{employer_id}/employees/{employee_id}/beneficiaries` |
> | `PUT` | `/employers/{employer_id}/employees/{employee_id}/beneficiaries` |
> | `GET` | `/employers/{employer_id}/employees/{employee_id}/fund_allocation` |
> | `PUT` | `/employers/{employer_id}/employees/{employee_id}/fund_allocation` |
> | `GET` | `/fund_allocations` |
> | `GET` | `/fund_allocations/{fund_allocation_id}` |
> 
> Two further differences apply to endpoints that both organisation types may call:
> 
> - **`external_id`** on employee enrolment rows (`POST .../employees`) and contribution
> rows (`POST .../contributions`) is required for Partner organisations that use
> single sign-on with Penfold, and must be omitted by every other organisation,
> including Partner organisations that do not use single sign-on.
> - **`GET /employers`** returns every employer in the organisations you manage for a
> Partner organisation; for a Payroll organisation it returns only the single
> employer your access token is scoped to.
> 
> ## Organisations, employers and workplace admins (Partner organisations)
> 
> Partner organisations set up their customers in Penfold in three steps, in this order:
> 
> 1. **Create an organisation** with `POST /organisations`. A `SingleEmployer`
> organisation holds exactly one employer. A `MultiEmployer` organisation holds
> several, for example a group of companies. You can convert a single-employer
> organisation to multi-employer with `PATCH /organisations/{organisation_id}`, but
> not back again.
> 2. **Create its employers** with `POST /employers`, naming the `organisation_id`.
> 3. **Register its workplace admins** with
> `POST /organisations/{organisation_id}/workplace_admins`. Admins belong to the
> organisation, not to one employer, and see every employer in it. The organisation
> must hold at least one employer first. Penfold emails each admin an invitation to
> set a Penfold password.
> 
> If your organisation uses single sign-on with Penfold, each admin is matched at
> sign-in on the `external_id` you registered for them (the subject id your identity
> provider puts in its sign-in token), never on their email. An admin you have not
> registered, or have removed, cannot sign in through you. Registered admins can also
> sign in with their Penfold email and password once they accept the invitation.
> 
> ### Penfold is the source of truth
> 
> For the organisations you manage, admins can still change most things on the
> Penfold Workplace Platform: payroll files, leavers, payroll connections, company
> details, Direct Debit, opt-outs and reminders. Only adding employers is reserved to
> you. Do not store data that can conflict with Penfold's, or treat Penfold's copy as
> the master. Penfold sends you a webhook for the changes most likely to make your copy
> wrong (see `PayrollUpload`, `Employer`, `PayrollConnection` and
> `EmployerDirectDebitMandate` under Webhooks).
> 
> ## Date fields
> 
> Date-only fields (`format: date`, e.g. `exit_date`, `employment_start_date`,
> `date_of_birth`, pay-period dates) use **UTC calendar dates** in `YYYY-MM-DD`
> form. Values are interpreted and emitted as the UTC calendar day, not the
> server's local timezone. Timestamps (`format: date-time`, e.g. `created_at`)
> remain ISO 8601 UTC instants.
> 
> ## Submission lifecycle (uploads)
> 
> Employee enrolment (`POST /employers/{employer_id}/employees`) and contribution
> (`POST /employers/{employer_id}/contributions`) submissions are **asynchronous**. Each
> returns an `Upload` object representing queued work, not a final result.
> 
> To consume the result:
> 
> 1. Poll `GET /uploads/{upload_id}` until `status` is terminal (`Processed`, `Error`,
> `Timeout`, or `PartiallyProcessed`).
> 2. Fetch created enrolments via `GET /uploads/{upload_id}/enrolments` and contributions
> via `GET /uploads/{upload_id}/contributions`. Member and contribution IDs are **not**
> returned in the submission response.
> 3. Fetch errors via `GET /uploads/{upload_id}/errors`. Errors are scoped at File, AllRows
> or Row level.
> 
> Processing is **idempotent per pay period**: re-submitting the same records (or file) will
> only process records that have not already been processed successfully. This applies to
> both contribution and enrolment submissions, and is the recommended way to recover from
> a `PartiallyProcessed` upload.
> 
> ## Webhooks
> 
> Penfold POSTs a JSON body to your pre-registered webhook URL when a resource reaches
> a notable state. Every webhook shares a common envelope:
> 
> | Field          | Type   | Description |
> |----------------|--------|-------------|
> | `event_id`      | string | Globally unique. Upsert by this value for idempotency. |
> | `resource_type` | string | Which resource changed (e.g. `EmployerSigningRequest`). Determines valid `action` values and `payload` shape. |
> | `action`       | string | What happened (e.g. `Created`, `Completed`, `Changed`). Valid values depend on `resource_type`. |
> | `occurred_at`   | string | ISO 8601 UTC timestamp when Penfold recorded the event. |
> | `payload`      | object | Resource-specific data — see schemas below. |
> 
> ### Resource types
> 
> #### `EmployerSigningRequest`
> 
> Emitted when an agreement signing session is created or reaches a terminal outcome.
> Expect one `Created` event followed by exactly one of `Completed`, `Cancelled`, or `Failed`.
> 
> **Actions:** `Created`, `Completed`, `Cancelled`, `Failed`
> 
> **Payload:**
> 
> | Field                       | Type   | Description |
> |-----------------------------|--------|-------------|
> | `signing_session_id`          | string | Same id returned from create-session. |
> | `employer_id`                | string | Penfold employer id. |
> | `employer_external_reference` | string | The employer's external reference. |
> 
> #### `MemberSchemeStatus`
> 
> Emitted when a worker's scheme membership status changes (e.g. worker-initiated
> opt-out, irregular contributor, employer scheme closed).
> 
> **Actions:** `Changed`
> 
> **Payload:** `employer_id`, `employee_id`, `previous_status`, `status`, `effective_at`
> 
> #### `Employment`
> 
> Emitted when a worker's employment ends, whether initiated by you or by Penfold.
> 
> **Actions:** `Ended`
> 
> **Payload:** `employer_id`, `employee_id`, `exit_date`, `initiated_by` (`Partner` or `Penfold`)
> 
> #### `ContributionChangeRequest`
> 
> Emitted after a successful `POST .../contribution_change_requests`.
> 
> **Actions:** `Created`
> 
> **Payload:** `employer_id`, `employee_id`, `id`, `employee_contributions_percent`,
> `salary_sacrifice_enabled`, `created_at`
> 
> #### `FundAllocation`
> 
> Emitted when a worker's elected fund allocation changes via a successful
> `PUT .../employees/{employee_id}/fund_allocation` (not on idempotent no-ops).
> Optional — you may rely on the PUT `200` response instead if you originated the
> request.
> 
> **Actions:** `Changed`
> 
> **Payload:** `employer_id`, `employee_id`, `previous_fund_allocation_id`,
> `fund_allocation_id`, `effective_at`
> 
> #### `EmployerAmlVerificationStatus`
> 
> Emitted when an employer company's AML verification status changes (not on
> idempotent no-ops). You may also poll the employer endpoints as a fallback.
> 
> **Actions:** `Changed`
> 
> **Payload:** `employer_id`, `previous_status`, `status`
> 
> #### `PayrollUpload`
> 
> Emitted when a payroll file is submitted for an employer you can see, from any
> source: your own API uploads, the Penfold Workplace Platform, Penfold operations,
> or a connected payroll integration such as Xero. Use `source` to ignore your own.
> Without this, you could submit a pay period that was already submitted elsewhere.
> 
> **Actions:** `Submitted`
> 
> **Payload:** `employer_id`, `upload_id`, `source`, `purpose`,
> `pay_period_start_date`, `pay_period_end_date`, `row_count`, `submitted_at`. The
> payload is self-contained: `GET /uploads` only lists your own uploads.
> 
> #### `Employer`
> 
> Emitted when any of these employer settings change, whoever changed them: default
> employee or employer contribution percentage, contribution basis, salary sacrifice,
> pay period cadence, payroll frequencies, or expected first pay period start date.
> Not emitted when none of them changed.
> 
> **Actions:** `Updated`
> 
> **Payload:** `employer_id`, `changes` (each with `field`, `previous_value` and
> `new_value`), `changed_by` (`PartnerApi`, `WorkplacePlatform` or
> `PenfoldOperations`), `changed_at`
> 
> #### `PayrollConnection`
> 
> Emitted when a payroll integration is connected to or disconnected from an
> employer, including when Penfold ends a connection itself because the provider
> refused access. A connection is a second source of contributions for the employer.
> 
> **Actions:** `Connected`, `Disconnected`
> 
> **Payload:** `employer_id`, `connection` (`Xero`, `FreeAgent`, `Staffology` or
> `PayrollApiClient`), `reason` (only on a disconnect Penfold made itself), `changed_at`
> 
> #### `EmployerDirectDebitMandate`
> 
> Emitted when an employer's Direct Debit mandate status changes, including when a
> new or replacement mandate is stored. Without an active mandate Penfold cannot
> collect contributions. No bank details are included.
> 
> **Actions:** `StatusChanged`
> 
> **Payload:** `employer_id`, `previous_status` (`null` for a new mandate), `status`,
> `changed_at`
> 
> Webhooks are sent for changes you made yourself too. A failure to send a webhook
> never blocks or undoes the change that caused it.
> 
> ### Worker opt-out
> 
> There is **no** API to opt a worker out. Workers opt out through Penfold
> worker self-service (for example email). Penfold updates `member_scheme_status` to `OptedOut` and
> emits a `MemberSchemeStatus` webhook with action `Changed`. You may also poll
> `GET .../employees/{employee_id}` as a fallback.
> 
> ### Signature verification (`X-Penfold-Signature`)
> 
> Penfold signs every webhook with HMAC-SHA256 using a shared secret provisioned during
> onboarding.
> 
> 1. Read the `X-Penfold-Signature` header. It contains comma-separated key/value pairs:
> `t` (Unix timestamp in seconds when Penfold sent the request) and `v1` (lowercase
> hex-encoded HMAC-SHA256).
> 2. Construct the signing payload (UTF-8): `{t}.{raw_body}` — the string value of `t`,
> a literal `.`, then the raw JSON body bytes.
> 3. Compute `HMAC-SHA256(secret, signing_payload)`, hex-encode, and compare to `v1` in
> constant time.
> 4. Reject if `|now_unix - t| > 300` (5-minute replay window).
> 5. Upsert by `event_id` for idempotency.
> 
> ### Delivery semantics
> 
> - Return `2xx` within 30 seconds.
> - On non-2xx, timeout, or no response: exponential backoff starting at 60 seconds,
> doubling each attempt, max interval 3600 seconds, up to 10 attempts within 24 hours.
> - After exhausted retries, events are not retried automatically.
> 
> ## Naming conventions
> 
> This API uses one casing scheme for what you send and receive — JSON bodies,
> URL path and query parameters, pagination fields, and signing redirect parameters.
> Penfold's internal code and databases are not affected.
> 
> **Default:** Identifiers use `snake_case` (e.g. `employer_id`, `page_size`,
> `signing_session_id`). Values that describe state or type (statuses, payment methods,
> webhook actions, upload `purpose`, signing redirect `result` values such as `Success`, etc.)
> use `PascalCase`. Values passed to `sort_by` are field names and use `snake_case`
> (e.g. `created_at`).
> 
> New fields should follow these rules unless listed as an exception below.
> 
> ### Exceptions
> 
> | Item | Casing | Reason |
> |------|--------|--------|
> | Azure AD token request (`grant_type`, `client_id`, `client_secret`, `scope`) | OAuth2 protocol names (typically `snake_case`) | Field names are defined by OAuth2, not this API, and are sent to the identity provider's token endpoint rather than to us. |
> | HTTP header names (`Authorization`, `Content-Type`, `X-Penfold-Signature`) | Standard HTTP header casing | Not JSON body fields |
> | Webhook signature header subkeys (`t`, `v1`) | Lowercase | Fixed format documented under Webhooks |
> | `sort_order` query values (`asc`, `desc`) | Lowercase | Accepted case-insensitively |
> | Upload error `code` and `scope` values | `PascalCase` | Fixed error type labels (e.g. `NationalInsuranceNumberInvalid`, `AllRows`), not field names |
> 
> ## Support
> 
> - Published documentation: https://docs.getpenfold.dev
> - Support: api@getpenfold.com

[Documentation](https://docs.getpenfold.dev/dev.md)

OpenAPI file: https://docs.getpenfold.dev/dev.yaml

## MCP server

Connect AI agents to this documentation with the Penfold Payroll API v4 MCP server (Model Context Protocol, no authentication, Streamable HTTP transport):

- URL: `https://docs.getpenfold.dev/mcp`

## [Servers](https://docs.getpenfold.dev/dev/servers.md)
- https://payroll-api.getpenfold.dev/v4: https://payroll-api.getpenfold.dev/v4


## Topics

### [Authentication](https://docs.getpenfold.dev/dev/authentication.md)


## Endpoints

### [Health](https://docs.getpenfold.dev/dev/group/endpoint-health.md)

- [Health check](https://docs.getpenfold.dev/dev/operation/operation-gethealth.md)


### [Organisations](https://docs.getpenfold.dev/dev/group/endpoint-organisations.md)

- [List organisations](https://docs.getpenfold.dev/dev/operation/operation-listorganisations.md)

- [Create an organisation](https://docs.getpenfold.dev/dev/operation/operation-createorganisation.md)

- [Retrieve an organisation](https://docs.getpenfold.dev/dev/operation/operation-getorganisation.md)

- [Convert an organisation to multi-employer](https://docs.getpenfold.dev/dev/operation/operation-updateorganisation.md)


### [Workplace Admins](https://docs.getpenfold.dev/dev/group/endpoint-workplace-admins.md)

- [List workplace admins](https://docs.getpenfold.dev/dev/operation/operation-listworkplaceadmins.md)

- [Register a workplace admin](https://docs.getpenfold.dev/dev/operation/operation-createworkplaceadmin.md)

- [Retrieve a workplace admin](https://docs.getpenfold.dev/dev/operation/operation-getworkplaceadmin.md)

- [Remove a workplace admin](https://docs.getpenfold.dev/dev/operation/operation-deleteworkplaceadmin.md)


### [Employers](https://docs.getpenfold.dev/dev/group/endpoint-employers.md)

- [Retrieve an employer](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter.md)

- [Update an employer](https://docs.getpenfold.dev/dev/operation/operation-patch-employers-parameter.md)

- [Retrieve a list of employers](https://docs.getpenfold.dev/dev/operation/operation-get-employers.md)

- [Create employer](https://docs.getpenfold.dev/dev/operation/operation-post-employers.md)


### [Employees](https://docs.getpenfold.dev/dev/group/endpoint-employees.md)

- [List employees](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees.md)

- [Enrol employees](https://docs.getpenfold.dev/dev/operation/operation-post-employers-parameter-employees.md)

- [Retrieve an employee](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter.md)

- [Update an employee](https://docs.getpenfold.dev/dev/operation/operation-patch-employers-parameter-employees-parameter.md)

- [List an employee's contributions](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter-contributions.md)

- [Request a contribution change](https://docs.getpenfold.dev/dev/operation/operation-post-employers-parameter-employees-parameter-contribution_change_requests.md)

- [Retrieve an employee's portfolio summary](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter-portfolio_summary.md)

- [Retrieve an employee's pot value history](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter-pot_value_history.md)

- [List an employee's transactions](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter-transactions.md)

- [List an employee's beneficiaries](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter-beneficiaries.md)

- [Replace an employee's beneficiaries](https://docs.getpenfold.dev/dev/operation/operation-put-employers-parameter-employees-parameter-beneficiaries.md)

- [Retrieve an employee's fund allocation](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-employees-parameter-fund_allocation.md)

- [Set an employee's fund allocation](https://docs.getpenfold.dev/dev/operation/operation-put-employers-parameter-employees-parameter-fund_allocation.md)


### [Leavers](https://docs.getpenfold.dev/dev/group/endpoint-leavers.md)

- [Mark employees as leavers](https://docs.getpenfold.dev/dev/operation/operation-post-employers-parameter-leavers.md)


### [Contributions](https://docs.getpenfold.dev/dev/group/endpoint-contributions.md)

- [List contributions for an employer](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-contributions.md)

- [Submit contributions](https://docs.getpenfold.dev/dev/operation/operation-post-employers-parameter-contributions.md)


### [Pay Periods](https://docs.getpenfold.dev/dev/group/endpoint-pay-periods.md)

- [List pay periods for an employer](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-pay_periods.md)

- [Get a pay period for an employer](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-pay_periods-parameter.md)


### [Agreement Signing](https://docs.getpenfold.dev/dev/group/endpoint-agreement-signing.md)

- [Create an agreement signing session](https://docs.getpenfold.dev/dev/operation/operation-post-employers-parameter-agreement-signing-sessions.md)

- [Retrieve an agreement signing session](https://docs.getpenfold.dev/dev/operation/operation-get-employers-parameter-agreement-signing-sessions-parameter.md)


### [Direct Debit](https://docs.getpenfold.dev/dev/group/endpoint-direct-debit.md)

- [Create a Direct Debit session](https://docs.getpenfold.dev/dev/operation/operation-post-employers-parameter-direct-debit-sessions.md)


### [File Upload](https://docs.getpenfold.dev/dev/group/endpoint-file-upload.md)

- [Retrieve all uploads](https://docs.getpenfold.dev/dev/operation/operation-get-uploads.md)

- [Initiate an upload](https://docs.getpenfold.dev/dev/operation/operation-post-uploads.md)

- [Retrieve an upload](https://docs.getpenfold.dev/dev/operation/operation-get-uploads-parameter.md)

- [Retrieve errors for an upload](https://docs.getpenfold.dev/dev/operation/operation-get-uploads-parameter-errors.md)

- [Retrieve contributions for an upload](https://docs.getpenfold.dev/dev/operation/operation-get-uploads-parameter-contributions.md)

- [Retrieve enrolments for an upload](https://docs.getpenfold.dev/dev/operation/operation-get-uploads-parameter-enrolments.md)


### [Fund Allocations](https://docs.getpenfold.dev/dev/group/endpoint-fund-allocations.md)

- [List fund allocations](https://docs.getpenfold.dev/dev/operation/operation-get-fund_allocations.md)

- [Retrieve a fund allocation](https://docs.getpenfold.dev/dev/operation/operation-get-fund_allocations-parameter.md)




## Changelog

- [Changelog](https://docs.getpenfold.dev/dev/changes.md)
- [Changelog index (llms.txt)](https://docs.getpenfold.dev/dev/changes/llms.txt)

## Other versions (branches)

- [main (llms.txt)](https://docs.getpenfold.dev/llms.txt)
- [main changelog index (llms.txt)](https://docs.getpenfold.dev/changes/llms.txt)

[Powered by Bump.sh](https://bump.sh)
