> This page is for API, version 2026-01-01 (Stable) (default).
> For other versions, use one of these documentation indexes:
> - 2026-01-01 (Stable) (default): https://developer.deel.com/api/stable/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.deel.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.deel.com/_mcp/server.

# Create time-off request

POST https://api.letsdeel.com/rest/time_offs
Content-Type: application/json

Creates a new time-off request for a worker.

 **Token scopes**: `time-off:write`, `worker:write`

Reference: https://developer.deel.com/api/reference/endpoints/time-off/create-time-off-request

## Authentication

- `Authorization` header (bearer token, required) — ## 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)
- `Authorization` header (bearer token, required) — Standard OAuth2 security scheme based on https://swagger.io/docs/specification/authentication/

## Servers

- `https://api.letsdeel.com/rest` (Production, default)
- `https://api-staging.letsdeel.com/rest` (Demo)

## Request

### Body (application/json)

This endpoint expects an object.

- `data` (TimeOffsPostRequestBodyContentApplicationJsonSchemaData, optional) — The time off request data

## Response

### 201

Time off creation data

- `time_offs` (list of TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItems, required) — The list of created time offs. Depending on the selected dates, a time off can be split into more than one request.

## Errors

### 400 Bad Request Error

Bad Request

- `errors` (list of TimeOffsPostResponsesContentApplicationJsonSchemaErrorsItems, optional) — List of errors describing what went wrong
- `request` (TimeOffsPostResponsesContentApplicationJsonSchemaRequest, optional) — Request metadata

### 401 Unauthorized Error

Operation failed.

- `request` (ApiErrorRequest, optional)
- `errors` (list of ApiError, optional)

### 403 Forbidden Error

Forbidden

- `errors` (list of TimeOffsPostResponsesContentApplicationJsonSchemaErrorsItems, optional) — List of errors describing what went wrong
- `request` (TimeOffsPostResponsesContentApplicationJsonSchemaRequest, optional) — Request metadata

### 404 Not Found Error

Not Found

- `errors` (list of TimeOffsPostResponsesContentApplicationJsonSchemaErrorsItems, optional) — List of errors describing what went wrong
- `request` (TimeOffsPostResponsesContentApplicationJsonSchemaRequest, optional) — Request metadata

### 500 Internal Server Error

Operation failed.

- `request` (ApiErrorRequest, optional)
- `errors` (list of ApiError, optional)

## Types

### TimeOffsPostRequestBodyContentApplicationJsonSchemaData

The time off request data

- `end_date` (TimeOffsPostRequestBodyContentApplicationJsonSchemaDataEndDate, required) — End date of the time off request. This is the date when the time off ends. For example, if you take 2 days off, this will be the end date of the second day.
- `start_date` (TimeOffsPostRequestBodyContentApplicationJsonSchemaDataStartDate, required) — Start date of the time off request. This is the date when the time off starts. For example, if you take 2 days off, this will be the start date of the first day.
- `recipient_profile_id` (string, required) — The hris profile id of the recipient
- `dates` (list of TimeOffsPostRequestBodyContentApplicationJsonSchemaDataDatesItems, optional) — The dates breakdown for the time off request.
- `reason` (string, optional, nullable) — Reason for taking time off. This is complementary information for the time-off description. Useful to provide sub categories for the same policy.
- `status` (enum, optional, default: APPROVED) — Status for the time off request. When set to REQUESTED, the time off should be reviewed later through POST /time_offs/review.
  - Allowed values: `REQUESTED`, `APPROVED`
- `is_paid` (boolean, optional) — Whether the time off is paid or unpaid. By default it follows the policy configuration.
- `policy_id` (string, optional) — The time off policy id. Can be used in place of time_off_type_id
- `description` (string, optional, nullable) — Description of the time off request. Some policies require that a description is provided.
- `contract_oid` (string, optional, nullable) — Contract id. This is the id of the contract associated with the time off request.
- `event_details` (TimeOffsPostRequestBodyContentApplicationJsonSchemaDataEventDetails, optional) — Details of the event associated with the time off request. Required for event based policies such as parental leave.
- `deduction_amount` (float, optional, nullable) — Deduction amount. Available for independent contractor's policies
- `time_off_type_id` (string, optional) — The time off type id. Required when policy_id is not provided
- `time_off_event_id` (string, optional) — The time off event id. This is used to link the time off request to an event.
- `time_off_percentage` (double, optional, nullable) — This is the percentage of time off taken. This is used when the time off request is a percentage.
- `other_type_description` (string, optional, nullable) — Description of the time off type. This is used when the policy is OTHER.
- `use_deel_approval_flow` (boolean, optional, default: false) — Whether to use Deel's approval flow for this time off request. If set to true, the time off request will go through Deel's approval flow instead of being handled through the public-api review time-off endpoint.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItems

Created time off request

- `is_paid` (boolean, required) — Whether the time off is paid or unpaid.
- `end_date` (string, required) — End date of the time off request. This is the date when the time off ends. For example, if you take 2 days off, this will be the end date of the second day.
- `created_at` (string, required) — This is the date when the time off request was created in the database.
- `start_date` (string, required) — Start date of the time off request. This is the date when the time off starts. For example, if you take 2 days off, this will be the start date of the first day.
- `updated_at` (string, required) — This is the date when the time off request was last updated in the database.
- `requested_at` (string, required) — This is the date when the time off request was made.
- `half_end_date` (boolean, required) — Whether the end date is a half day or not.
- `half_start_date` (boolean, required) — Whether the start date is a half day or not.
- `entitlement_unit` (enum, required) — The unit in which the time off usage and entitlement are calculated.
  - Allowed values: `HOUR`, `BUSINESS_DAY`, `CALENDAR_DAY`, `WEEK`, `MONTH`, `YEAR`
- `time_off_type_id` (string, required) — Time off type id. This is the id of the time off type associated with the time off request.
- `amount` (float, optional) — Amount of time off taken. This is the total amount of time off taken. For example, if you take 2 days off, this will be 2. If you take 1 day off, this will be 1.
- `reason` (string, optional) — Reason for taking time off. This is complementary information for the time-off description. Useful to provide sub categories for the same policy.
- `status` (enum, optional) — Status of the time off request. Can be REQUESTED, APPROVED, REJECTED, USED or CANCELED.
  - Allowed values: `REQUESTED`, `APPROVED`, `REJECTED`, `USED`, `CANCELED`, `DELETED`
- `deleted_at` (string, optional, nullable) — Time off deletion date. Present only when the time-off is soft-deleted and include_deleted_time_offs was requested.
- `approved_at` (string, optional, nullable) — This is the date when the time off request was approved. This will be null if the time off request is not approved yet.
- `attachments` (list of TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsAttachmentsItems, optional) — List of attachments associated with the time off request.
- `canceled_at` (string, optional, nullable) — Time off cancellation date
- `description` (string, optional) — Description of the time off request. Some policies require that a description is provided.
- `contract_oid` (string, optional, nullable) — Contract id. This is the id of the contract associated with the time off request.
- `time_off_type` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffType, optional) — The type of time off taken.
- `time_off_event` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffEvent, optional)
- `deduction_amount` (float, optional, nullable) — Deduction amount. Available for independent contractor's policies
- `time_off_dailies` (list of TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffDailiesItems, optional)
- `recipient_profile` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsRecipientProfile, optional) — The time off profile of the recipient of the time off request. Must be a worker profile.
- `requester_profile` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsRequesterProfile, optional) — The time off profile of the requester of the time off request. Can be either a client or worker profile.
- `time_off_percentage` (float, optional, nullable) — This is the percentage of time off taken.
- `is_end_date_estimated` (boolean, optional) — Whether the end date is estimated or not. This is used on event based policies such as Parental leave.
- `other_type_description` (string, optional, nullable) — Description of the time off type. This is used when the policy is OTHER.

### TimeOffsPostResponsesContentApplicationJsonSchemaErrorsItems

- `code` (string, optional) — A machine-readable error code
- `message` (string, optional) — A description of the returned error

### TimeOffsPostResponsesContentApplicationJsonSchemaRequest

Request metadata

- `url` (string, optional) — Request URL path
- `docs` (string, optional) — Documentation reference
- `method` (string, optional) — HTTP method
- `source` (string, optional) — Request source
- `status` (integer, optional) — HTTP status code
- `api_req_id` (string, optional) — Unique API request identifier

### ApiErrorRequest

- `method` (string, optional) — The HTTP method of the failed request
- `url` (string, optional) — The relative URL of the failed request
- `status` (double, optional) — The status code of the response
- `api_req_id` (string, optional) — The request ID of the failed request
- `docs` (string, optional) — A link to the official documentation for the requested endpoint resource
- `source` (string, optional) — The source handler which produced the returned error
- `code` (double, optional) — The code of the source handler which produced the returned error

### ApiError

- `message` (string, optional) — A description of the returned error
- `path` (string, optional) — The JSON path where input validation failed

### TimeOffsPostRequestBodyContentApplicationJsonSchemaDataEndDate

End date of the time off request. This is the date when the time off ends. For example, if you take 2 days off, this will be the end date of the second day.

### TimeOffsPostRequestBodyContentApplicationJsonSchemaDataStartDate

Start date of the time off request. This is the date when the time off starts. For example, if you take 2 days off, this will be the start date of the first day.

### TimeOffsPostRequestBodyContentApplicationJsonSchemaDataDatesItems

The dates breakdown for the time off request.

- `date` (TimeOffsPostRequestBodyContentApplicationJsonSchemaDataDatesItemsDate, required) — An specific date in the time-off request
- `hours` (float, optional) — The amount taken in hours during this specific date. It can not exceed the maximum allowed hours for the date.
- `amount` (float, optional) — The amount of time off requested for the date. It must be in the same time unit as in the total amount for the time off request.
- `day_type` (enum, optional) — The type of day for the time off request. All dates must follow the same type.
  - Allowed values: `HALF_DAY`, `FULL_DAY`, `PERCENTAGE`, `HOURLY`

### TimeOffsPostRequestBodyContentApplicationJsonSchemaDataEventDetails

Details of the event associated with the time off request. Required for event based policies such as parental leave.

- `birth_date` (string, required) — The birth date of the child. This is used for parental leave requests.
- `was_premature_birth` (boolean, required) — Whether the birth was premature or not. This is used for parental leave requests.
- `had_multiple_children` (boolean, required) — Whether the birth was multiple or not. This is used for parental leave requests.
- `adoption_date` (string, optional) — The date of adoption. This is used for parental leave requests.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsAttachmentsItems

An attachment associated with the time off request.

- `id` (string, required) — Attachment id
- `filename` (string, required) — Filename of the attachment
- `created_at` (string, required) — This is the date when the attachment was created in the database.
- `updated_at` (string, required) — This is the date when the attachment was last updated in the database.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffType

The type of time off taken.

- `id` (string, required) — Time off type id.
- `name` (string, required) — Time off type name. Basically the reason or category of time-off taken. For SICK leave, it can be doctor appointment, surgery etc.
- `policy` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffTypePolicy, optional) — The policy associated with the time off type.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffEvent

- `id` (string, optional) — The time off event id. This is used to link the time off request to an event.
- `type` (enum, optional) — The type of the time off event.
  - Allowed values: `PARENTAL_LEAVE`
- `policy_id` (string, optional) — The policy id associated with the time off event. Same as the policy_id in the time off type.
- `created_at` (string, optional) — The date when the time off event was created in the database.
- `updated_at` (string, optional) — The date when the time off event was last updated in the database.
- `event_details` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffEventEventDetails, optional) — Details of the event associated with the time off request. Required for event based policies such as parental leave.
- `hris_profile_id` (string, optional) — The HRIS profile id of the worker associated with the time off event. Same as the hris_profile_id in the recipient_profile.
- `time_off_type_id` (string, optional) — The time off type id associated with the time off event. Same as the time_off_type_id in the time off request.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffDailiesItems

- `id` (string, required) — Time off daily id
- `date` (string, required) — Date of the time off daily. This is the date when the time off was taken.
- `type` (enum, required) — Type of the time off daily. Can be WORKING_DAY, NON_WORKING_DAY, HOLIDAY or FORFAIT_HOUR_DAY.
  - Allowed values: `WORKING_DAY`, `NON_WORKING_DAY`, `HOLIDAY`, `FORFAIT_HOUR_DAY`
- `amount` (float, required) — Amount of time off taken in this specific date.
- `created_at` (string, required) — This is the date when the time off daily was created in the database.
- `updated_at` (string, required) — This is the date when the time off daily was last updated in the database.
- `time_off_id` (string, required) — Time off id. This is the id of the time off request associated with the time off daily.
- `description` (string, optional, nullable) — Description of the time off daily. When it is a HOLIDAY this is the holiday name.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsRecipientProfile

The time off profile of the recipient of the time off request. Must be a worker profile.

- `hris_profile_id` (string, required) — The worker HRIS profile id in the given organization.
- `organization_id` (string, required) — Id of the organization the profile belongs to.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsRequesterProfile

The time off profile of the requester of the time off request. Can be either a client or worker profile.

- `organization_id` (string, required) — Id of the organization the profile belongs to.
- `hris_profile_id` (string, optional) — The worker HRIS profile id in the given organization. Available when the requester is a worker.
- `client_profile_id` (string, optional) — Id of the client profile. Available when the requester is a client.

### TimeOffsPostRequestBodyContentApplicationJsonSchemaDataDatesItemsDate

An specific date in the time-off request

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffTypePolicy

The policy associated with the time off type.

- `id` (string, required) — Policy id
- `name` (string, required) — The custom name given to policy during policy creation.
- `policy_type` (TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffTypePolicyPolicyType, required)

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffEventEventDetails

Details of the event associated with the time off request. Required for event based policies such as parental leave.

- `was_premature_birth` (boolean, required) — Whether the birth was premature or not. This is used for parental leave requests.
- `had_multiple_children` (boolean, required) — Whether the birth was multiple or not. This is used for parental leave requests.
- `birth_date` (string, optional) — The birth date of the child. This is used for parental leave requests.
- `adoption_date` (string, optional) — The date of adoption. This is used for parental leave requests.
- `estimated_birth_date` (string, optional) — The estimated birth date of the child. Birth is estimated when the birth date has not been confirmed yet.
- `estimated_adoption_date` (string, optional) — The estimated adoption date of the child. Birth is estimated when the adoption date has not been confirmed yet.

### TimeOffsPostResponsesContentApplicationJsonSchemaTimeOffsItemsTimeOffTypePolicyPolicyType

- `id` (string, required) — Policy type id
- `name` (string, required) — Depicts the type of policy, like VACATION, SICK etc

## Examples

**Request**

```json
{
  "data": {
    "end_date": "2021-04-30",
    "start_date": "2021-04-01",
    "recipient_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "reason": "Vacation",
    "is_paid": true,
    "time_off_type_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "amount": 30
  }
}
```

**Response**

```json
{
  "time_offs": [
    {
      "is_paid": false,
      "end_date": "2021-08-01",
      "created_at": "2021-07-01T00:00:00Z",
      "start_date": "2021-07-01",
      "updated_at": "2021-07-01T00:00:00Z",
      "requested_at": "2021-07-01",
      "half_end_date": false,
      "half_start_date": false,
      "entitlement_unit": "CALENDAR_DAY",
      "time_off_type_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
      "amount": 1,
      "reason": "Vacation",
      "status": "REQUESTED",
      "approved_at": "2021-07-01T00:00:00Z",
      "attachments": [
        {
          "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
          "filename": "vacation-request.pdf",
          "created_at": "2021-07-01T11:22:33Z",
          "updated_at": "2021-07-01T33:44:33Z"
        }
      ],
      "description": "Vacation",
      "contract_oid": "d290f1ee-6c54-4b01-90e6-d701748f0851",
      "deduction_amount": 1,
      "time_off_dailies": [
        {
          "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
          "date": "2021-07-01",
          "type": "WORKING_DAY",
          "amount": 1,
          "created_at": "2021-07-01T00:00:00Z",
          "updated_at": "2021-07-01T00:00:00Z",
          "time_off_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
          "description": "Vacation"
        }
      ],
      "recipient_profile": {
        "hris_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "organization_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "client_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
      },
      "requester_profile": {
        "organization_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "hris_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "client_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
      },
      "time_off_percentage": 1,
      "is_end_date_estimated": false,
      "other_type_description": "Vacation",
      "id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.letsdeel.com/rest/time_offs"

payload = { "data": {
        "end_date": "2021-04-30",
        "start_date": "2021-04-01",
        "recipient_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "reason": "Vacation",
        "is_paid": True,
        "time_off_type_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "amount": 30
    } }
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/time_offs';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"data":{"end_date":"2021-04-30","start_date":"2021-04-01","recipient_profile_id":"d290f1ee-6c54-4b01-90e6-d701748f0851","reason":"Vacation","is_paid":true,"time_off_type_id":"d290f1ee-6c54-4b01-90e6-d701748f0851","amount":30}}'
};

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/time_offs"

	payload := strings.NewReader("{\n  \"data\": {\n    \"end_date\": \"2021-04-30\",\n    \"start_date\": \"2021-04-01\",\n    \"recipient_profile_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"reason\": \"Vacation\",\n    \"is_paid\": true,\n    \"time_off_type_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"amount\": 30\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/time_offs")

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  \"data\": {\n    \"end_date\": \"2021-04-30\",\n    \"start_date\": \"2021-04-01\",\n    \"recipient_profile_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"reason\": \"Vacation\",\n    \"is_paid\": true,\n    \"time_off_type_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"amount\": 30\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/time_offs")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"data\": {\n    \"end_date\": \"2021-04-30\",\n    \"start_date\": \"2021-04-01\",\n    \"recipient_profile_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"reason\": \"Vacation\",\n    \"is_paid\": true,\n    \"time_off_type_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"amount\": 30\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.letsdeel.com/rest/time_offs', [
  'body' => '{
  "data": {
    "end_date": "2021-04-30",
    "start_date": "2021-04-01",
    "recipient_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "reason": "Vacation",
    "is_paid": true,
    "time_off_type_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "amount": 30
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.letsdeel.com/rest/time_offs");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"data\": {\n    \"end_date\": \"2021-04-30\",\n    \"start_date\": \"2021-04-01\",\n    \"recipient_profile_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"reason\": \"Vacation\",\n    \"is_paid\": true,\n    \"time_off_type_id\": \"d290f1ee-6c54-4b01-90e6-d701748f0851\",\n    \"amount\": 30\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["data": [
    "end_date": "2021-04-30",
    "start_date": "2021-04-01",
    "recipient_profile_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "reason": "Vacation",
    "is_paid": true,
    "time_off_type_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "amount": 30
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.letsdeel.com/rest/time_offs")! 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()
```