# Connect data sources

Use the built-in HRIS and Timesheet adapters, add HTTP, Google Sheets or internal sources, and connect them to a payroll policy.

Source: https://support.rework.com/article/payroll-data-sources

Payroll doesn't store salaries, attendance or commissions itself. It reads them from **data sources**: your other Rework apps, or an external system such as an ERP or a Google Sheet. This article shows you which sources are built in, how to add your own, and how to connect them to a policy. 🔌

## Before you start

- Managing sources needs a payroll admin (or a system owner).
  
- Sources only **read** data. Payroll never writes anything back to them.
  
- Data reaches your formulas only through **variables**: each field a source provides has a code you can use in a formula column.
  

## The Sources page

All your sources are managed in one place, the **Sources** page. It isn't in the sidebar, so open it directly at `/sources` in the Payroll app (for example, _payroll.rework.com/sources_).

![The Sources page with the New source button, the HRIS built-in adapter card and one of its variables marked](https://storage.googleapis.com/reworkv3-public/success/260930/xuqSbkln7075tskJIMRXFoSuUVUKJR1oUG9Cdev9qdSm7ssYXeh97FUr2WRRNdnK/img.5t8U0PV7tIR7DKDd3xFThDXuApNyv4oCgKpr5RAsbhI0qKFVct0YWA7bANQfKalX.png)

- **External sources**: the HTTP, internal service, import and Google Sheet connections you create. Click **New source** **(1)** to add one. You set each one up once and reuse it in any policy.
  
- **Built-in adapters** **(2)**: ready-made sources from other Rework apps. Each card shows how many policies use it and lists its variables **(3)**.
  

| Built-in adapter | What it provides |
| --- | --- |
| **HRIS** | Employee profile, contract, salary and career history, dependants, tax and insurance details, bank details. |
| **Timesheets** | Working days, day and shift points, working hours. |
| **Schedule** | Planned shifts, scheduled hours and shift type. |
| **Checkins** | Late arrivals, early departures and check-in adjustments. |
| **Timeoffs** | Leave taken in the period, by leave type. |
| **Insurance (VSS)** | Statutory social insurance costs and rates. |

Variables marked _no data source yet_ are listed but not fed by any app in your workspace for now, so they'll read as 0 or empty.

## Add an external source

1. On the Sources page, click **New source**.
   
   ![The New Data Source dialog with the Name field, the Type list, the Endpoint mode buttons and the Structure URL and Data URL fields marked](https://storage.googleapis.com/reworkv3-public/success/260930/7jq9z2E8CQ0HrGw2dnowhcN5sOutzjszWHwoDXok25t0e4zRTFReBeOZON6H2Zt1/img.yVYIqU52JPXymPq0qWUktaGlcSeHSchh7wi2WpdA0FmKewKdvOwQGtkl0j1THz0g.png)
2. Give it a **Name** **(1)**, such as _KPI service_.
   
3. Choose the **Type** **(2)**. The rest of the form changes to match (see the table below).
   
4. For an HTTP endpoint, pick the **Endpoint mode** **(3)** and fill in the two URLs **(4)**: the **Structure URL (GET)** returns the list of fields, and the **Data URL (POST getData)** returns the values for the employees and period.
   
5. Under **Authentication**, choose an **Auth scheme**: None, Access token (static), OAuth2 client credentials, HMAC-SHA256 or JWT bearer. Secrets are encrypted when you save and are always shown as dots afterwards.
   
6. Under **Schema & mapping**, click **Discover schema** **(1)** to read the fields, then say which field holds the employee **(2)**: the **Key field**, and whether to **Match by** Platform user\_id or email.
   
   ![The lower part of the New Data Source dialog with Discover schema, Key field and Match by, the Add variable button and the Dry-run section marked](https://storage.googleapis.com/reworkv3-public/success/260930/yx6APHDeivMYnqZvigWf9vQS43lF6sKTiNGyte7mJnJAsKgCvWS8mrHbbaazaPte/img.4q8NJQmzo87iDW0EFF9ldiebR8dWvAPiuY8jBFuX82Xvpq6CktQpC3b5Mirwa2nn.png)
7. Under **Variables**, click **Add** **(3)** for each value you want to use in formulas, and give it a code. Codes can't reuse the name of a built-in system variable.
   
8. Use **Dry-run** **(4)** to test: pick a period, enter a few employee IDs and click **Run dry-run**. It calls the source for real but doesn't write to any payroll.
   
9. Click **Create source**.
   

| Type | What you fill in |
| --- | --- |
| **HTTP endpoint (external URL)** | Endpoint mode, Structure URL, Data URL, authentication, response path, shape, key field, match by and dedup rule. **External (HTTPS)** mode only accepts secure public addresses. |
| **Internal service (B2B)** | Just the **Adapter**: `hrm`, `timesheet`, `overtime` or `schedule`. No URL or password needed. |
| **Import (payroll columns)** | An advanced mapping from imported payroll columns to variables. It only works within a payroll that has imported data. |
| **Google Sheets** | Spreadsheet ID, Sheet name, Key column, Key match and Cache TTL, plus **Column → Variable mappings**. Share the sheet with Rework's service account so it can be read. |

When several rows belong to the same employee, the **Dedup rule** decides what to keep: first, last, sum, max or min.

## Connect sources to a policy

1. Open the policy's settings and go to the **Sources & data** tab.
   
   \[IMAGE: people-ops/payroll/images/payroll-data-sources-04.png | The Sources and data tab of a policy with the connected built-in sources, a bound external source with its priority and on or off switch, and the Add source button marked\]
   
2. Click **Add source** and pick a built-in adapter or one of your external sources. It saves straight away.
   
3. For external sources, set the **priority** and switch it on or off. When two sources provide the same variable, the higher priority wins.
   

> Heads-up: a policy with no sources connected reads from all the built-in apps automatically. As soon as you connect a custom source, only the sources you've listed are used. If you add a custom source, add the built-in ones you still need too, or HR and attendance data will stop flowing. The tab warns you when this happens.

## Good to know

- Payroll pulls source data when a payroll runs. To pick up changes later, use **Refresh Data** on the payroll.
  
- A source that fails doesn't stop the payroll: its variables read as 0 and the payroll shows a warning.
  
- Large responses are capped (10,000 rows and 5 MB by default) so a runaway feed can't slip in wrong numbers unnoticed.
  

## Related articles

- [Troubleshoot data sources](https://support.rework.com/article/payroll-data-sources-troubleshooting)
  
- [Columns, variables and formulas](https://support.rework.com/article/payroll-columns-formulas)
  
- [Payroll policies and templates](https://support.rework.com/article/payroll-policies-templates)
