POST to your server whenever something happens in Flow Payroll, so you react straight away instead of polling. A payslip is finalised, and your HR system has it seconds later. A P60 is issued, and your employee portal shows it. A pay run completes, and your accounting sync starts.
The Webhooks API lives at /v1/webhooks relative to the gateway base URLs on the API reference introduction, for example https://api.sandbox.flowpayroll.ai/v1/webhooks in sandbox. It authenticates like every other service: see Authentication.
How it works
1
Register an endpoint
POST /endpoints with your HTTPS URL and the event types you want. The response carries the endpoint’s public key, for checking its deliveries, and its signing secret, shown only this once.2
Something happens in Flow Payroll
A payslip is finalised, an employee’s tax code changes, an email bounces. Flow Payroll records the event and works out which endpoints are subscribed to it.
3
Flow Payroll delivers it
Your endpoint receives a signed JSON
POST. Answer with any 2xx within 15 seconds and the delivery is done.4
Anything that fails is retried
Any other answer, or no answer, is retried on a fixed schedule for just over 75 hours (about three days). Every attempt is in the delivery log, and anything can be sent again. See Delivery and retries.
Quickstart
1
Create an endpoint
publicKey from the response in your receiver’s configuration: checking deliveries with it is the recommended way to verify. It is not a secret, and you can read it again at any time. The response also carries signingSecret, which you need only if you check v1 signatures instead: store it somewhere safe, such as your secrets manager. You cannot read it again; if you lose it, rotate.2
Verify each delivery
Check the
webhook-signature header against the raw body before you trust anything in it. Verify signatures has copy-paste code.3
Send a test event
POST /endpoints/{endpointId}/test-deliveries sends a signed webhook.test event straight away and tells you what your server answered. See Testing webhooks.What a delivery looks like
Headers
The body
Key terms
- Webhook: an HTTP request Flow Payroll sends to you when something happens, instead of you asking repeatedly whether anything has.
- Receiver: the code on your server that accepts those requests.
- Endpoint: Flow Payroll’s record of your receiver: its HTTPS URL, which events it wants, and the secret its deliveries are signed with. See Manage endpoints.
- Public key: what you check each delivery with, so you can prove a request is genuine. Flow Payroll signs every delivery with a private key only it holds, and gives you the matching public key, which can check a signature but never make one. See Verify signatures.
- Signing secret: the other way to check a delivery. A random key only you and Flow Payroll know, which every delivery is also signed with.
- At least once: an event can occasionally arrive more than once (for example, when your answer was lost on the way back), but it is never silently lost. Use
webhook-idto spot repeats. - Event type: a named thing that can happen, such as
payslip.finalised. Subscribe to an exact type, a family (payslip.*) or everything (*). - Delivery: one event sent to one endpoint. It has attempts, a status (
Pending,Succeeded,FailedorSkipped) and a place in the delivery log. - Payload style:
Fullsends the whole record indata.Minimalsends only its type, its id and the employee’s id (when it is about one), for receivers that prefer to fetch the latest version from the API. - Scope: an endpoint belongs to one organisation, or, created with
?scope=customer, to your whole account, which is how a bureau receives every client’s events at one URL. See Account-wide endpoints.
Limits
Where to go next
Quickstart
A working, verified receiver in about fifteen minutes.
Manage endpoints
Every setting, and how to pause, change and delete.
Verify signatures
Code for Node.js, Python and C#, and how rotation works.
Event types
Every event you can subscribe to, with its payload.
Delivery and retries
The retry schedule, ordering, and what disables an endpoint.
Best practices
Duplicates, fast answers, and processing in the background.