What are webhooks?

Receive real-time notifications from Factorial the moment an event happens, instead of polling the API.

Webhooks let your application receive real-time notifications when events occur in Factorial. Instead of repeatedly polling the API to check for changes, Factorial sends an HTTP POST request to a URL you control whenever a relevant event takes place.

πŸ“˜

In one sentence

"Knock on a door outside Factorial the moment something happens inside Factorial."

This is the recommended approach for keeping external systems in sync with Factorial data β€” for example, triggering an onboarding workflow when a new employee is created, or updating a payroll system when contract details change.

Watch the walkthrough

A six-minute tour of everything in this section β€” the delivery loop, managing subscriptions, payloads, retries and troubleshooting.

πŸ“˜

For the exact structure of each payload, follow Payloads & Event Types and the callback payload documented on each webhook in the API Reference β€” those are the source of truth.

Why webhooks instead of polling

PollingWebhooks
How it worksYour system calls the API on a schedule and looks for changesFactorial calls your system when the change happens
LatencyAs long as your polling intervalNear real time
Request volumeHigh β€” most calls return nothing newOne request per actual event
Missed changesPossible between intervalsDelivered as they occur, with retries

Webhooks let you build integrations that sync data between platforms, trigger downstream processes, update an external directory, or drive any workflow that should start the instant something changes in Factorial.

🚧

Technical prerequisites

Webhooks can be consumed directly by your own service, or through an intermediary automation platform (for example an iPaaS or workflow tool). Consuming them directly requires a publicly reachable HTTPS endpoint and the ability to handle incoming HTTP requests.

How the delivery loop works

  1. You register a webhook subscription with Factorial, providing a target_url that your server exposes publicly.
  2. When a subscribed event occurs in Factorial, a POST request is sent to your endpoint with a JSON payload describing the event.
  3. Your server processes the payload and responds with an HTTP 2xx status code to acknowledge receipt.
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚            β”‚  1. POST /your-endpoint           β”‚             β”‚
  β”‚ Factorial  β”‚ ────────────────────────────────▢ β”‚ Your server β”‚
  β”‚            β”‚     JSON body: the resource       β”‚             β”‚
  β”‚            β”‚                                   β”‚             β”‚
  β”‚            β”‚  2. HTTP 200 OK                   β”‚             β”‚
  β”‚            β”‚ ◀──────────────────────────────── β”‚             β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β”‚ 3. No 2xx or timeout β†’ retry (see Webhooks Policies)
        β–Ό
❗️

Your endpoint must be publicly accessible over HTTPS

Factorial cannot deliver to localhost, private network addresses, or endpoints behind authentication that rejects our request. Plain HTTP is not supported.

Choosing your endpoint URLs

You can use the same target_url for every subscription, or a dedicated URL per event type.

Using a single URL for all events keeps your infrastructure simple, but your handler must inspect the payload to tell events apart. Using one URL per subscription type makes routing explicit and is usually easier to maintain.

Request headers

Every delivery includes standard HTTP headers plus the following Factorial-specific headers.

HeaderAlways sentDescription
x-factorial-wh-challengeOnly if a challenge was set on the subscriptionEchoes the challenge value you defined when creating the subscription, so you can verify the request originates from your subscription. See Webhooks Subscriptions.
x-factorial-author-idNoID of the employee or company that triggered the event.
x-factorial-author-typeNoEither employee or company.

The author headers are sent only when the author can be safely exposed to the subscriber. If the author is not visible to the subscriber, the headers are omitted. They are metadata only and do not change the payload body.

What's in this section

PageWhat it covers
Webhooks SubscriptionsCreating, listing, enabling, disabling and deleting subscriptions
Payloads & Event TypesPayload structure and the events you can subscribe to
Webhooks PoliciesRetries, failure notifications and permissions
Best Practices & TroubleshootingBuilding a reliable handler and diagnosing problems
Practical Example: Clock In a ShiftAn end-to-end worked example
πŸ“˜

Full list of available webhooks

Every subscription type Factorial supports is listed in the Webhooks section of the API Reference, together with the callback payload for each one.


Did this page help you?