# Deel

Deel is a global payroll, HR, and compliance platform that helps companies hire and pay workers anywhere in the world. The Sling Deel connector extracts data from the Deel REST API v2, supporting people, contracts, invoices, payments, time off, timesheets, and organizational data.

{% hint style="success" %}
**CLI Pro Required**: APIs require a [CLI Pro token](https://docs.slingdata.io/sling-cli/cli-pro) or [Platform Plan](https://docs.slingdata.io/sling-platform/platform).
{% endhint %}

## Setup

The following credentials and inputs are accepted:

**Secrets:**

* `api_token` **(required)** -> Your Deel API token
* `base_url` (optional) -> API base URL (default: `https://api-sandbox.demo.deel.com/rest/v2` for sandbox, use `https://api.letsdeel.com/rest/v2` for production)

**Inputs:**

* `anchor_date` (optional) -> Starting date for historical data extraction (default: 1 year ago). Format: `YYYY-MM-DD`

### Getting Your API Token

1. Log in to your [Deel Dashboard](https://app.deel.com/)
2. Go to **Organization Settings** > **Integrations** > **Developer Center**
3. Navigate to the **Tokens** tab
4. Click **Create Token** and select **Organization** level access
5. Select the required scopes (at minimum: `contracts:read`, `people:read`, `organizations:read`, `invoices:read`, `time-off:read`, `timesheets:read`, `tasks:read`, `groups:read`, `legal-entity:read`, `adjustments:read`)
6. Copy the generated token

{% hint style="warning" %}
**Sandbox vs Production:** Deel provides a sandbox environment for testing. Create a sandbox from the Developer Center. For production data, change the `base_url` secret to `https://api.letsdeel.com/rest/v2`.
{% endhint %}

### Using `sling conns`

{% code overflow="wrap" %}

```bash
sling conns set DEEL type=api spec=deel secrets='{ api_token: your_token_here }'
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/sling-cli/environment#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export DEEL='{ type: api, spec: deel, secrets: { api_token: "your_token_here" } }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/sling-cli/environment#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  DEEL:
    type: api
    spec: deel
    secrets:
      api_token: "your_token_here"
```

**With production URL and anchor date:**

```yaml
connections:
  DEEL:
    type: api
    spec: deel
    secrets:
      api_token: "your_token_here"
      base_url: "https://api.letsdeel.com/rest/v2"
    inputs:
      anchor_date: "2024-01-01"
```

## Replication

Here's an example replication configuration to sync Deel data to a PostgreSQL database:

```yaml
source: DEEL
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: public.deel_{stream_name}

streams:
  # sync all endpoints
  '*':

  # contract_tasks iterates over all contracts (can be slow)
  contract_tasks:
    disabled: true
```

## Endpoints

| Endpoint                | Description                                                              | Incremental |
| ----------------------- | ------------------------------------------------------------------------ | ----------- |
| `people`                | Workers/employees with personal details, manager info, and hiring status | Yes         |
| `contracts`             | All contracts (EOR, IC, GP) with compensation and worker details         | No          |
| `invoices`              | Worker invoices with payment status, amounts, and dates                  | Yes         |
| `invoices_deel`         | Deel platform fee invoices                                               | Yes         |
| `payments`              | Payment receipts for workforce payments                                  | Yes         |
| `timesheets`            | Timesheet entries across all contracts                                   | Yes         |
| `time_offs`             | Time-off requests across the organization                                | Yes         |
| `organizations`         | Organization details                                                     | No          |
| `teams`                 | Teams within the organization                                            | Yes         |
| `departments`           | Departments within the organization                                      | No          |
| `legal_entities`        | Legal entities associated with the organization                          | No          |
| `groups`                | Groups (teams/cost centers) in the organization                          | Yes         |
| `contract_tasks`        | Tasks assigned to each contract (iterates all contracts)                 | No          |
| `adjustment_categories` | Adjustment categories for payroll adjustments                            | No          |
| `lookup_countries`      | Countries supported by Deel                                              | No          |
| `lookup_currencies`     | Currencies used by Deel                                                  | No          |
| `lookup_job_titles`     | Pre-defined job titles                                                   | No          |
| `lookup_seniorities`    | Seniority levels                                                         | No          |

## Incremental Sync

Endpoints with incremental support track the latest `update_key` value and only fetch new or updated records on subsequent runs. The `anchor_date` input controls how far back the first sync reaches (default: 1 year).

## Rate Limiting

The Deel API allows 5 requests per second per organization (shared across all tokens). The connector automatically handles rate limiting with exponential backoff retries.

***

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).
