---
updatedAt: 2026-10-05T10:08:23.000Z
agentTools:
  projectIndex: https://apidoc.factorialhr.com/llms.txt
---

# Outbound: Factorial → External Software

How a partner handles an outbound sync run: handle the run notification, fetch the data, write in the external software and report each row.

## 💡 Context

Outbound is the synchronization or import process that fetches data **from Factorial** and i**ntroduces it into the external software**. [Inbound](https://apidoc.factorialhr.com/docs/inbound-integrations) goes in the opposite direction, data is fetched from the external sofware and pushed into Factorial.

In **outbound**, Factorial knows what needs to be synced. Records (i.e., employees, compensations or expenses) have an associated [SyncableState](https://apidoc.factorialhr.com/reference/integrations-syncablestate) that reports if the record was synced / exported successfully, had an error in the last sync attempt, or has been marked as outdated. In any case, record data must be fetched though the relevant public api endpoints.

## ✨ Introduction

&#x20;A **summary** of the outbound flow is:

1. Client **defines** all the data (compensations, expenses) in Factorial
2. Client **clicks** on ‘Sync to \[*external\_software\_name]*
3. Partner receives a **webhook** notification
4. Partner fetches **data to sync** from Factorial
5. Partner syncs it to the external software
6. Partner reports the **sync result** back to Factorial so the client can have **visibility of the result** of the sync

<Callout icon="❗️" theme="error">
  **Important**

  Please note that steps 3,4,5 and 6 are mandatory for the partner to be implemented. See [Async Integration Flow ](https://apidoc.factorialhr.com/docs/integrations-framework#-async-integration-flow)for more details.
</Callout>

## :wrench: Setup

Before triggering the Outbound Sync Flow, the integration must be setup in Factorial, and installed for this client. Please refer to [Integrations Framework](https://apidoc.factorialhr.com/docs/integrations-framework) on how to achieve these steps.

## 🔄 Outbound Sync Flow

<Callout icon="❗️" theme="error">
  **Important**

  Please note all described steps are mandatory for the partner to be implemented.
</Callout>

### 1. Receive Webhook Notification

When a sync is triggered by the user in Factorial, Partners’ webhook will receive a `POST` request with the following payload:

```json
{
  "sync_run_id": integer,
  "integration_uuid": string,  // your integration identifier
  "company_id": integer
}
```

<Callout icon="❗️" theme="error">
  **Important**

  * Partners’ endpoint must respond with HTTP `200 OK` to confirm receipt.
  * The partner should process the sync **asynchronously**.
  * Partner **should not** return errors in this response — errors must be handled and reported separately in Step 4.
  * If a webhook notification fails, Factorial will send an email to the partner and **retry the notification up to 5 times within 15 minutes**. If all retries fail, the user will be notified that the sync was unsuccessful.
</Callout>

### 2. Fetch Sync Data

To retrieve the data items to sync, there is a 3 steps process:

#### 2.1 [Reads all Syncable sync runs](https://apidoc.factorialhr.com/reference/get_api-2026-10-01-resources-integrations-syncable-sync-runs)

`GET {baseUrl}/api/{version}/resources/integrations/syncable_sync_runs?sync_run_id={n}`

using the `sync_run_id` value received in the webhook payload.

Syncable Sync Runs links a sync run (user clicked in sync button) with the next steps, [Syncable states](https://apidoc.factorialhr.com/reference/get_api-2026-10-01-resources-integrations-syncable-states)

The response will contain **a paginated list of all the&#x20;**[Syncable sync runs](https://apidoc.factorialhr.com/reference/get_api-2026-10-01-resources-integrations-syncable-sync-runs). You must use [Pagination](https://apidoc.factorialhr.com/docs/pagination) to get the full set of items.

```json
{ 
  "data": [
    {
      "id": "1",
      "status": "running",
      "error_messages": [],
      "sync_run_id": "11",
      "syncable_state_id": "34",
      "company_id: "7"
    },
    {
      "id": "2",
      "status": "running",
      "error_messages": [],
      "sync_run_id": "11",
      "syncable_state_id": "35",
      "company_id: "7"
    },
    {...}
  ],
  "meta": {
     "has_next_page": true,
      "hasprevious_page": false,
      "start_cursor": "MQ==",
      "end_cursor": "MTAw",
      "total": 869,
      "limit": 100
  }
}
```

#### 2.2 [Reads all Syncable states](https://apidoc.factorialhr.com/reference/get_api-2026-10-01-resources-integrations-syncable-states)

`GET {baseUrl}/api/{version}/resources/integrations/syncable_states?ids[]=34&ids[]=35`

Use the syncable\_state\_id values from the previous call's payload.

Syncable states show the current status of each syncable (for example an employee, a compensation or an expense).

Each syncable state has two things:

* What is being synced, in sync\_type. For example, employee\_updates/new\_hire or employee\_updates/leave\_created. Use this field to decide how to process the record. Several sync types can point to the same resource. For example, a new hire, a termination and a personal
  data change all point to employees/employee, so only sync\_type tells them apart.
* Where to get the data, in syncable\_id and resource\_syncable\_type. Together they identify the Factorial record, and they give you the final list of endpoints to call. For example, resource\_syncable\_type: "employees/employee" with syncable\_id: "1042" means you call GET {baseUrl}/api/{version}/resources/employees/employees/1042.

```json
   {
     "data": [
       {
         "id": "1",
         "syncable_id": "1042",
         "sync_type": "employee_updates/new_hire",
         "resource_syncable_type": "employees/employee",
         "integration_uuid": "12207342-52c5-4888-9349-3270780e1234",
         "status": "syncing",
         "error_messages": [],
         "external_identifier": "external-software-234"
       },
       {
         "id": "2",
         "syncable_id": "1043",
         "sync_type": "employee_updates/new_hire",
         "resource_syncable_type": "employees/employee",
         "integration_uuid": "12207342-52c5-4888-9349-3270780e1234",
         "status": "syncing",
         "error_messages": [],
         "external_identifier": "external-software-235"
       },
       {...}
     ],
     "meta": {
       "has_next_page": true,
       "has_previous_page": false,
       "start_cursor": "MQ==",
       "end_cursor": "MTAw",
       "total": 869,
       "limit": 100
     }
   }
```

#### 2.3 Read each resource

From `resource_syncable_type` we infer the endpoint to call. Just map it to the url

`GET {baseUrl}/api/{version}/resources/{resource_syncable_type}?ids[]=71&ids[]=72`

&#x20;For instance:

* `expensables/expenses`. is mapped to [Reads all Expensables](https://apidoc.factorialhr.com/reference/get_api-2026-10-01-resources-expenses-expensables)

<Callout icon="📘" theme="info">
  ### Call extra endpoints as needed

  Besides the root resource, determined by `resource_syncable_type` fields, you might need to call other extra endpoints.<br />Please refer to [Payroll integrations,](https://apidoc.factorialhr.com/docs/payroll-integrations) [Finance integrations](https://apidoc.factorialhr.com/docs/finance-integrations) and [Time tracking integrations](https://apidoc.factorialhr.com/docs/time-tracking-integrations) for indications on these endpoints
</Callout>

### 3. Process Sync Data

When processing the data, the partner is responsible for:

* **Performing the delta**:
  * The client may trigger the sync multiple times for the same period and company, potentially with different filters. These are **not concurrent**, but your system must ensure **idempotency** or manage updates accordingly.
* **Pushing data to the external system**:
  * Create or update items (compensations, expenses) in the external payroll provider based on the sync data.

<Callout icon="❗️" theme="error">
  Please clarify with Factorial how updates should be managed:

  _Should we overwrite previous values defined directly in the external system, or should a merge be done? (This depends on which system is the source of truth.)_
</Callout>

***

### 4. Report Sync Status

Once sync items are processed, the Partner needs to report the final status of each `syncable_sync_run` received in the step 2.1 back to Factorial by calling:

[Updates a Syncable sync run](https://apidoc.factorialhr.com/reference/put_api-2026-10-01-resources-integrations-syncable-sync-runs-id)

```
PUT {baseUrl}/api/{version}/resources/integrations/syncable_sync_runs/{id}

{
  "status": "success"| "failed" | "invalid",
  "error_messages": {
    "sycn_api_error": string,
    "sync_validation_error": string
      ...
    }
}
```

* Use `success` when the item was synced correctly to the external software.
* Use `failed` if something went wrong and the item was not synced.
* Use `invalid` if the data is structurally incorrect or missing required fields.
  * Example: Factorial sends you a compensation with a `payroll_concept_id` that you don’t have mapped with any code of the payroll software

<Callout icon="❗️" theme="error">
  One hour after the user starts the sync process, any items without a reported status will be marked as `failed`, and the `sync_run` will be updated to its corresponding final state.
</Callout>