# External HR Time Off Synchronization

POST https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync
Content-Type: application/json

Synchronize time off requests from an external HRIS to Deel. Only Global Payroll contracts are allowed for this operation. This endpoint can perform 2 different operations with the provided time off list: i) upsert - time off requests identified by an external ID will be either inserted or updated at Deel. ii) delete - existing time off requests identified by an external ID with the parameter 'deleted: true' will be deleted. Deel will identify the impacts of each operation on each payroll cycle.
 **Token scopes**: `time-off:write`

Reference: https://developer.deel.com/api/reference/endpoints/time-off/external-hr-time-off-synchronization

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Deel HRIS SCIM API
  version: 1.0.0
paths:
  /time_offs/global-payroll/sync:
    post:
      operationId: external-hr-time-off-synchronization
      summary: External HR Time Off Synchronization
      description: >-
        Synchronize time off requests from an external HRIS to Deel. Only Global
        Payroll contracts are allowed for this operation. This endpoint can
        perform 2 different operations with the provided time off list: i)
        upsert - time off requests identified by an external ID will be either
        inserted or updated at Deel. ii) delete - existing time off requests
        identified by an external ID with the parameter 'deleted: true' will be
        deleted. Deel will identify the impacts of each operation on each
        payroll cycle.
         **Token scopes**: `time-off:write`
      tags:
        - subpackage_timeOff
      parameters:
        - name: Authorization
          in: header
          description: >
            ## Authentication

            The Deel API uses bearer tokens to authenticate requests. All API
            calls must be made over HTTPS — calls over plain HTTP or without
            authentication will fail.


            ```curl

            curl -X GET 'https://api.letsdeel.com/rest/v2/contracts' \
              -H 'Authorization: Bearer YOUR-TOKEN-HERE'
            ```


            [Learn more about authentication](/api/authentication)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation time offs returned
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Time
                  Off_externalHrTimeOffSynchronization_Response_200
        '400':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ExternalHrTimeOffSynchronizationRequestBadRequestError
        '401':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '403':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '404':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '500':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: >-
                    #/components/schemas/TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaData
servers:
  - url: https://api.letsdeel.com/rest/v2
  - url: https://api-staging.letsdeel.com/rest/v2
components:
  schemas:
    TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItemsOneOf0PolicyType:
      type: string
      enum:
        - Adoption leave
        - Advanced vacation
        - Bereavement leave
        - Blood donation leave
        - Breastfeeding leave
        - Childbirth leave
        - Childcare leave
        - Civic/public duty leave
        - Disability leave
        - Doctor's appointment leave
        - Family & domestic violence leave
        - Floating Holiday Allowance
        - Hajj leave
        - Marriage/wedding leave
        - Maternity leave
        - Military leave
        - Moving leave
        - Other leave
        - Paid leave
        - Parental leave
        - Paternity leave
        - Personal leave
        - Pregnancy leave
        - Regional holiday
        - RTT
        - Sick leave
        - Study leave
        - Supplementary Leave
        - Unpaid leave
        - Vacation
        - Volunteer leave
        - Work accident leave
      description: The Deel policy type of the policy the time off is being requested for.
      title: >-
        TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItemsOneOf0PolicyType
    TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItemsOneOf0EntitlementUnit:
      type: string
      enum:
        - HOUR
        - BUSINESS_DAY
        - CALENDAR_DAY
        - WEEK
        - MONTH
        - YEAR
      description: >-
        The time unit for this time off. *Mandatory when amount parameter is
        informed*. If no amount and no entitlement_unit are informed, it will be
        calculated using Deel's internal country templates for compliant time
        off policies.
      title: >-
        TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItemsOneOf0EntitlementUnit
    TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems0:
      type: object
      properties:
        amount:
          type: number
          format: double
          description: >-
            The amount in time units for this time off. When no amount is
            informed, it will be calculated using work schedules and public
            holidays defined at Deel.
        is_paid:
          type: boolean
          default: true
          description: >-
            Allows the consumer to specify whether the time off is considered as
            paid (at statutory) or unpaid based on the configuration of the
            policy in the external HRIS.
        end_date:
          type: string
          format: date
          description: The end date of the time off.
        start_date:
          type: string
          format: date
          description: The start date of the time off.
        approved_at:
          type: string
          format: date
          default: time off start date
          description: >-
            The approval date of the time off. If no approval date is informed,
            the start date of this request will be used as the approval date.
            Note: use this field in order to support retrospective leaves so
            Deel can identify requests made after the payroll cycle.
        description:
          type:
            - string
            - 'null'
          description: The description of the time off.
        external_id:
          type: string
          description: >-
            External ID to link a Deel time off object with an external time off
            object. It will be used to determine which operation should be done:
            INSERT, UPDATE or DELETE.
        policy_name:
          type: string
          description: >-
            The policy name the time off is being requested for. If not
            informed, a default name will be generated using the policy type and
            contract's country (eg: Vacation - US).
        policy_type:
          oneOf:
            - $ref: >-
                #/components/schemas/TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItemsOneOf0PolicyType
            - type: 'null'
          description: >-
            The Deel policy type of the policy the time off is being requested
            for.
        contract_oid:
          type: string
          description: The contract id that has requested the time off.
        requested_at:
          type: string
          format: date
          description: The request date of the time off.
        entitlement_unit:
          $ref: >-
            #/components/schemas/TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItemsOneOf0EntitlementUnit
          description: >-
            The time unit for this time off. *Mandatory when amount parameter is
            informed*. If no amount and no entitlement_unit are informed, it
            will be calculated using Deel's internal country templates for
            compliant time off policies.
      required:
        - end_date
        - start_date
        - external_id
        - policy_type
        - contract_oid
      title: >-
        TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems0
    TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems1:
      type: object
      properties:
        deleted:
          type: boolean
          description: Indicates this time off request must be deleted
        external_id:
          type: string
          description: >-
            External ID to link a Deel time off object with an external time off
            object. It will be used to determine which operation should be done:
            INSERT, UPDATE or DELETE.
        contract_oid:
          type: string
          description: The contract id that has requested the time off.
      required:
        - deleted
        - external_id
        - contract_oid
      title: >-
        TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems1
    TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems:
      oneOf:
        - $ref: >-
            #/components/schemas/TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems0
        - $ref: >-
            #/components/schemas/TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems1
      title: >-
        TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems
    TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaData:
      type: object
      properties:
        time_offs:
          type: array
          items:
            $ref: >-
              #/components/schemas/TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaDataTimeOffsItems
      required:
        - time_offs
      title: TimeOffsGlobalPayrollSyncPostRequestBodyContentApplicationJsonSchemaData
    TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        deleted:
          type: number
          format: double
          description: Number of time off requests that were deleted
        updated:
          type: number
          format: double
          description: Number of time off requests that were updated
        inserted:
          type: number
          format: double
          description: Number of time off requests that were inserted
      title: TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaData
    Time Off_externalHrTimeOffSynchronization_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaData
      description: List of time offs persisted at Deel
      title: Time Off_externalHrTimeOffSynchronization_Response_200
    TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaErrorsItems:
      type: object
      properties:
        path:
          type: string
          description: The JSON path where input validation failed
        message:
          type: string
          description: A description of the returned error
      title: >-
        TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaErrorsItems
    TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaRequest:
      type: object
      properties:
        url:
          type: string
          description: The relative URL of the failed request
        code:
          type: number
          format: double
          description: The code of the source handler which produced the returned error
        docs:
          type: string
          description: >-
            A link to the official documentation for the requested endpoint
            resource
        method:
          type: string
          description: The HTTP method of the failed request
        source:
          type: string
          description: The source handler which produced the returned error
        status:
          type: number
          format: double
          description: The status code of the response
        api_req_id:
          type: string
          description: The request ID of the failed request
      title: >-
        TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaRequest
    ExternalHrTimeOffSynchronizationRequestBadRequestError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaErrorsItems
        request:
          $ref: >-
            #/components/schemas/TimeOffsGlobalPayrollSyncPostResponsesContentApplicationJsonSchemaRequest
      title: ExternalHrTimeOffSynchronizationRequestBadRequestError
    ApiErrorRequest:
      type: object
      properties:
        method:
          type: string
          description: The HTTP method of the failed request
        url:
          type: string
          description: The relative URL of the failed request
        status:
          type: number
          format: double
          description: The status code of the response
        api_req_id:
          type: string
          description: The request ID of the failed request
        docs:
          type: string
          description: >-
            A link to the official documentation for the requested endpoint
            resource
        source:
          type: string
          description: The source handler which produced the returned error
        code:
          type: number
          format: double
          description: The code of the source handler which produced the returned error
      title: ApiErrorRequest
    ApiError:
      type: object
      properties:
        message:
          type: string
          description: A description of the returned error
        path:
          type: string
          description: The JSON path where input validation failed
      title: ApiError
    ApiErrorContainer:
      type: object
      properties:
        request:
          $ref: '#/components/schemas/ApiErrorRequest'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiError'
      title: ApiErrorContainer
  securitySchemes:
    deelToken:
      type: http
      scheme: bearer
      description: >
        ## Authentication

        The Deel API uses bearer tokens to authenticate requests. All API calls
        must be made over HTTPS — calls over plain HTTP or without
        authentication will fail.


        ```curl

        curl -X GET 'https://api.letsdeel.com/rest/v2/contracts' \
          -H 'Authorization: Bearer YOUR-TOKEN-HERE'
        ```


        [Learn more about authentication](/api/authentication)
    oauth2:
      type: http
      scheme: bearer
      description: >-
        Standard OAuth2 security scheme based on
        https://swagger.io/docs/specification/authentication/

```

## SDK Code Examples

```python
import requests

url = "https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync"

payload = { "body": { "data": { "time_offs": [
                {
                    "external_id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef",
                    "contract_oid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
                    "start_date": "2024-07-01",
                    "end_date": "2024-07-05",
                    "policy_type": "Vacation",
                    "amount": 4,
                    "is_paid": True,
                    "approved_at": "2024-06-20",
                    "description": "Family summer vacation",
                    "policy_name": "Annual leave",
                    "requested_at": "2024-06-15",
                    "entitlement_unit": "BUSINESS_DAY"
                },
                {
                    "external_id": "b2c3d4e5-f678-9012-abcd-2345678901fa",
                    "contract_oid": "d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f",
                    "start_date": "2024-08-15",
                    "end_date": "2024-08-15",
                    "policy_type": "Sick leave",
                    "amount": 1,
                    "is_paid": True,
                    "approved_at": "2024-08-14",
                    "description": "Flu recovery day",
                    "policy_name": "Sick leave",
                    "requested_at": "2024-08-13",
                    "entitlement_unit": "BUSINESS_DAY"
                },
                {
                    "external_id": "c3d4e5f6-7890-1234-abcd-3456789012fb",
                    "contract_oid": "a1234567-89ab-cdef-0123-456789abcdef",
                    "deleted": True
                }
            ] } } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"body":{"data":{"time_offs":[{"external_id":"a1b2c3d4-e5f6-7890-abcd-1234567890ef","contract_oid":"f47ac10b-58cc-4372-a567-0e02b2c3d479","start_date":"2024-07-01","end_date":"2024-07-05","policy_type":"Vacation","amount":4,"is_paid":true,"approved_at":"2024-06-20","description":"Family summer vacation","policy_name":"Annual leave","requested_at":"2024-06-15","entitlement_unit":"BUSINESS_DAY"},{"external_id":"b2c3d4e5-f678-9012-abcd-2345678901fa","contract_oid":"d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f","start_date":"2024-08-15","end_date":"2024-08-15","policy_type":"Sick leave","amount":1,"is_paid":true,"approved_at":"2024-08-14","description":"Flu recovery day","policy_name":"Sick leave","requested_at":"2024-08-13","entitlement_unit":"BUSINESS_DAY"},{"external_id":"c3d4e5f6-7890-1234-abcd-3456789012fb","contract_oid":"a1234567-89ab-cdef-0123-456789abcdef","deleted":true}]}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync"

	payload := strings.NewReader("{\n  \"body\": {\n    \"data\": {\n      \"time_offs\": [\n        {\n          \"external_id\": \"a1b2c3d4-e5f6-7890-abcd-1234567890ef\",\n          \"contract_oid\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n          \"start_date\": \"2024-07-01\",\n          \"end_date\": \"2024-07-05\",\n          \"policy_type\": \"Vacation\",\n          \"amount\": 4,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-06-20\",\n          \"description\": \"Family summer vacation\",\n          \"policy_name\": \"Annual leave\",\n          \"requested_at\": \"2024-06-15\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"b2c3d4e5-f678-9012-abcd-2345678901fa\",\n          \"contract_oid\": \"d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f\",\n          \"start_date\": \"2024-08-15\",\n          \"end_date\": \"2024-08-15\",\n          \"policy_type\": \"Sick leave\",\n          \"amount\": 1,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-08-14\",\n          \"description\": \"Flu recovery day\",\n          \"policy_name\": \"Sick leave\",\n          \"requested_at\": \"2024-08-13\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"c3d4e5f6-7890-1234-abcd-3456789012fb\",\n          \"contract_oid\": \"a1234567-89ab-cdef-0123-456789abcdef\",\n          \"deleted\": true\n        }\n      ]\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"body\": {\n    \"data\": {\n      \"time_offs\": [\n        {\n          \"external_id\": \"a1b2c3d4-e5f6-7890-abcd-1234567890ef\",\n          \"contract_oid\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n          \"start_date\": \"2024-07-01\",\n          \"end_date\": \"2024-07-05\",\n          \"policy_type\": \"Vacation\",\n          \"amount\": 4,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-06-20\",\n          \"description\": \"Family summer vacation\",\n          \"policy_name\": \"Annual leave\",\n          \"requested_at\": \"2024-06-15\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"b2c3d4e5-f678-9012-abcd-2345678901fa\",\n          \"contract_oid\": \"d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f\",\n          \"start_date\": \"2024-08-15\",\n          \"end_date\": \"2024-08-15\",\n          \"policy_type\": \"Sick leave\",\n          \"amount\": 1,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-08-14\",\n          \"description\": \"Flu recovery day\",\n          \"policy_name\": \"Sick leave\",\n          \"requested_at\": \"2024-08-13\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"c3d4e5f6-7890-1234-abcd-3456789012fb\",\n          \"contract_oid\": \"a1234567-89ab-cdef-0123-456789abcdef\",\n          \"deleted\": true\n        }\n      ]\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"body\": {\n    \"data\": {\n      \"time_offs\": [\n        {\n          \"external_id\": \"a1b2c3d4-e5f6-7890-abcd-1234567890ef\",\n          \"contract_oid\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n          \"start_date\": \"2024-07-01\",\n          \"end_date\": \"2024-07-05\",\n          \"policy_type\": \"Vacation\",\n          \"amount\": 4,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-06-20\",\n          \"description\": \"Family summer vacation\",\n          \"policy_name\": \"Annual leave\",\n          \"requested_at\": \"2024-06-15\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"b2c3d4e5-f678-9012-abcd-2345678901fa\",\n          \"contract_oid\": \"d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f\",\n          \"start_date\": \"2024-08-15\",\n          \"end_date\": \"2024-08-15\",\n          \"policy_type\": \"Sick leave\",\n          \"amount\": 1,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-08-14\",\n          \"description\": \"Flu recovery day\",\n          \"policy_name\": \"Sick leave\",\n          \"requested_at\": \"2024-08-13\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"c3d4e5f6-7890-1234-abcd-3456789012fb\",\n          \"contract_oid\": \"a1234567-89ab-cdef-0123-456789abcdef\",\n          \"deleted\": true\n        }\n      ]\n    }\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync', [
  'body' => '{
  "body": {
    "data": {
      "time_offs": [
        {
          "external_id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef",
          "contract_oid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
          "start_date": "2024-07-01",
          "end_date": "2024-07-05",
          "policy_type": "Vacation",
          "amount": 4,
          "is_paid": true,
          "approved_at": "2024-06-20",
          "description": "Family summer vacation",
          "policy_name": "Annual leave",
          "requested_at": "2024-06-15",
          "entitlement_unit": "BUSINESS_DAY"
        },
        {
          "external_id": "b2c3d4e5-f678-9012-abcd-2345678901fa",
          "contract_oid": "d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f",
          "start_date": "2024-08-15",
          "end_date": "2024-08-15",
          "policy_type": "Sick leave",
          "amount": 1,
          "is_paid": true,
          "approved_at": "2024-08-14",
          "description": "Flu recovery day",
          "policy_name": "Sick leave",
          "requested_at": "2024-08-13",
          "entitlement_unit": "BUSINESS_DAY"
        },
        {
          "external_id": "c3d4e5f6-7890-1234-abcd-3456789012fb",
          "contract_oid": "a1234567-89ab-cdef-0123-456789abcdef",
          "deleted": true
        }
      ]
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"body\": {\n    \"data\": {\n      \"time_offs\": [\n        {\n          \"external_id\": \"a1b2c3d4-e5f6-7890-abcd-1234567890ef\",\n          \"contract_oid\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n          \"start_date\": \"2024-07-01\",\n          \"end_date\": \"2024-07-05\",\n          \"policy_type\": \"Vacation\",\n          \"amount\": 4,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-06-20\",\n          \"description\": \"Family summer vacation\",\n          \"policy_name\": \"Annual leave\",\n          \"requested_at\": \"2024-06-15\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"b2c3d4e5-f678-9012-abcd-2345678901fa\",\n          \"contract_oid\": \"d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f\",\n          \"start_date\": \"2024-08-15\",\n          \"end_date\": \"2024-08-15\",\n          \"policy_type\": \"Sick leave\",\n          \"amount\": 1,\n          \"is_paid\": true,\n          \"approved_at\": \"2024-08-14\",\n          \"description\": \"Flu recovery day\",\n          \"policy_name\": \"Sick leave\",\n          \"requested_at\": \"2024-08-13\",\n          \"entitlement_unit\": \"BUSINESS_DAY\"\n        },\n        {\n          \"external_id\": \"c3d4e5f6-7890-1234-abcd-3456789012fb\",\n          \"contract_oid\": \"a1234567-89ab-cdef-0123-456789abcdef\",\n          \"deleted\": true\n        }\n      ]\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["body": ["data": ["time_offs": [
        [
          "external_id": "a1b2c3d4-e5f6-7890-abcd-1234567890ef",
          "contract_oid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
          "start_date": "2024-07-01",
          "end_date": "2024-07-05",
          "policy_type": "Vacation",
          "amount": 4,
          "is_paid": true,
          "approved_at": "2024-06-20",
          "description": "Family summer vacation",
          "policy_name": "Annual leave",
          "requested_at": "2024-06-15",
          "entitlement_unit": "BUSINESS_DAY"
        ],
        [
          "external_id": "b2c3d4e5-f678-9012-abcd-2345678901fa",
          "contract_oid": "d94f3f01-2c1b-4a7a-9f3e-1a2b3c4d5e6f",
          "start_date": "2024-08-15",
          "end_date": "2024-08-15",
          "policy_type": "Sick leave",
          "amount": 1,
          "is_paid": true,
          "approved_at": "2024-08-14",
          "description": "Flu recovery day",
          "policy_name": "Sick leave",
          "requested_at": "2024-08-13",
          "entitlement_unit": "BUSINESS_DAY"
        ],
        [
          "external_id": "c3d4e5f6-7890-1234-abcd-3456789012fb",
          "contract_oid": "a1234567-89ab-cdef-0123-456789abcdef",
          "deleted": true
        ]
      ]]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.letsdeel.com/rest/v2/time_offs/global-payroll/sync")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```