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

# Unlock loan officer contacts

POST https://api.modex.com/v1/contacts/loan-officers/unlock
Content-Type: application/json

Unlocks contact data for up to 100 loan officers in one call.

**Body:**

| Field | Type           | Required | Description                                     |
| ----- | -------------- | -------- | ----------------------------------------------- |
| `ids` | array of UUIDs | yes      | 1–100 loan officer IDs. Duplicates are ignored. |

**Response:** `data[]` has one row per ID, in the order sent, plus `usage` (same shape as **Contact Usage**) after the unlock.

| Field             | Type             | Description                                                                                                                                  |
| ----------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `data[].id`       | UUID             | The ID you sent                                                                                                                              |
| `data[].status`   | string           | See below                                                                                                                                    |
| `data[].contacts` | object, nullable | `phone_numbers`, `emails`, `websites`, `addresses` as `{type, value}` rows. Present for `unlocked` and `already_unlocked`, otherwise `null`. |

| `status`           | Meaning                                              | Uses quota |
| ------------------ | ---------------------------------------------------- | ---------- |
| `unlocked`         | Newly unlocked                                       | yes        |
| `already_unlocked` | You'd already unlocked this record                   | no         |
| `not_found`        | No active loan officer with this ID that you can see | no         |
| `unavailable`      | The record has no contact data to unlock             | no         |
| `limit_reached`    | Your monthly quota ran out before this ID            | no         |

A malformed body returns 422 (for example `ids.0` isn't a UUID, or more than 100 IDs).

Reference: https://docs.modex.com/api-reference/contacts/unlock-loan-officers

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects an object.

- `ids` (list of string, optional)

## Response

### 200

OK

- `data` (list of V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItems, optional) — The records on this page.
- `usage` (V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaUsage, optional) — Your contact-unlock usage after this request. Same shape as Contact Usage.

## Errors

### 422 Unprocessable Entity Error

Unprocessable Content

- `error` (ApiErrorError, required)

## Types

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItems

- `id` (string, optional) — The ID you sent
- `status` (string, optional) — Result for this ID: `unlocked` (newly unlocked, uses quota), `already_unlocked` (free), `not_found`, `unavailable` (no contact data), or `limit_reached` (quota used up).
- `contacts` (V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContacts, optional, nullable) — `phone_numbers`, `emails`, `websites`, `addresses` as `{type, value}` rows. Present for `unlocked` and `already_unlocked`, otherwise `null`.

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaUsage

Your contact-unlock usage after this request. Same shape as Contact Usage.

- `used_this_month` (integer, optional)
- `limit` (integer, optional)
- `remaining` (integer, optional)
- `period` (V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaUsagePeriod, optional) — The current calendar month, in UTC.

### ApiErrorError

- `type` (string, required) — Error category: invalid_request, authentication_error, permission_error, not_found, rate_limit_error, or api_error.
- `code` (string, required) — Specific error code. Same as `type`, except `validation_error` for request-body validation failures.
- `message` (string, required) — Human-readable explanation.
- `details` (map from string to list of string, optional) — Validation errors only: each invalid field mapped to its messages.

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContacts

`phone_numbers`, `emails`, `websites`, `addresses` as `{type, value}` rows. Present for `unlocked` and `already_unlocked`, otherwise `null`.

- `phone_numbers` (list of V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContactsPhoneNumbersItems, optional) — `{type, value}` rows, e.g. `{"type": "mobile", "value": "(503) 555-0142"}`
- `emails` (list of V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContactsEmailsItems, optional) — `{type, value}` rows
- `websites` (list of V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContactsWebsitesItems, optional) — `{type, value}` rows
- `addresses` (list of any, optional)

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaUsagePeriod

The current calendar month, in UTC.

- `start` (datetime, optional) — Start of the period
- `end` (datetime, optional) — End of the period

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContactsPhoneNumbersItems

- `type` (string, optional) — Entry type, for example `mobile`, `office`, or `work`
- `value` (string, optional) — The phone number, email address, or URL

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContactsEmailsItems

- `type` (string, optional) — Entry type, for example `mobile`, `office`, or `work`
- `value` (string, optional) — The phone number, email address, or URL

### V1ContactsLoanOfficersUnlockPostResponsesContentApplicationJsonSchemaDataItemsContactsWebsitesItems

- `type` (string, optional) — Entry type, for example `mobile`, `office`, or `work`
- `value` (string, optional) — The phone number, email address, or URL

## Examples

### Mixed results

**Request**

```json
{
  "ids": [
    "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80",
    "d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091",
    "11111111-2222-4333-8444-555555555555",
    "66666666-7777-4888-9999-000000000000"
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80",
      "status": "unlocked",
      "contacts": {
        "phone_numbers": [
          {
            "type": "mobile",
            "value": "(503) 555-0142"
          },
          {
            "type": "office",
            "value": "(503) 555-0100"
          }
        ],
        "emails": [
          {
            "type": "work",
            "value": "jordan.ellery@example.com"
          }
        ],
        "websites": [
          {
            "type": "personal",
            "value": "https://www.example.com/jordan-ellery"
          }
        ],
        "addresses": []
      }
    },
    {
      "id": "d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091",
      "status": "already_unlocked",
      "contacts": {
        "phone_numbers": [
          {
            "type": "office",
            "value": "(360) 555-0119"
          }
        ],
        "emails": [
          {
            "type": "work",
            "value": "riley.chen@example.com"
          }
        ],
        "websites": [],
        "addresses": []
      }
    },
    {
      "id": "11111111-2222-4333-8444-555555555555",
      "status": "not_found",
      "contacts": null
    },
    {
      "id": "66666666-7777-4888-9999-000000000000",
      "status": "unavailable",
      "contacts": null
    }
  ],
  "usage": {
    "used_this_month": 43,
    "limit": 250,
    "remaining": 207,
    "period": {
      "start": "2026-10-01T00:00:00+00:00",
      "end": "2026-10-31T23:59:59+00:00"
    }
  }
}
```

**SDK Code**

```python Mixed results
import requests

url = "https://api.modex.com/v1/contacts/loan-officers/unlock"

payload = { "ids": ["c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80", "d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091", "11111111-2222-4333-8444-555555555555", "66666666-7777-4888-9999-000000000000"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Mixed results
const url = 'https://api.modex.com/v1/contacts/loan-officers/unlock';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"ids":["c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80","d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091","11111111-2222-4333-8444-555555555555","66666666-7777-4888-9999-000000000000"]}'
};

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

```go Mixed results
package main

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

func main() {

	url := "https://api.modex.com/v1/contacts/loan-officers/unlock"

	payload := strings.NewReader("{\n  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\",\n    \"d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091\",\n    \"11111111-2222-4333-8444-555555555555\",\n    \"66666666-7777-4888-9999-000000000000\"\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 Mixed results
require 'uri'
require 'net/http'

url = URI("https://api.modex.com/v1/contacts/loan-officers/unlock")

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  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\",\n    \"d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091\",\n    \"11111111-2222-4333-8444-555555555555\",\n    \"66666666-7777-4888-9999-000000000000\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.modex.com/v1/contacts/loan-officers/unlock")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\",\n    \"d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091\",\n    \"11111111-2222-4333-8444-555555555555\",\n    \"66666666-7777-4888-9999-000000000000\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modex.com/v1/contacts/loan-officers/unlock', [
  'body' => '{
  "ids": [
    "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80",
    "d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091",
    "11111111-2222-4333-8444-555555555555",
    "66666666-7777-4888-9999-000000000000"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Mixed results
using RestSharp;

var client = new RestClient("https://api.modex.com/v1/contacts/loan-officers/unlock");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\",\n    \"d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091\",\n    \"11111111-2222-4333-8444-555555555555\",\n    \"66666666-7777-4888-9999-000000000000\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Mixed results
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["ids": ["c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80", "d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091", "11111111-2222-4333-8444-555555555555", "66666666-7777-4888-9999-000000000000"]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modex.com/v1/contacts/loan-officers/unlock")! 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()
```

### Quota used up

**Request**

```json
{
  "ids": [
    "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80"
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80",
      "status": "limit_reached",
      "contacts": null
    }
  ],
  "usage": {
    "used_this_month": 250,
    "limit": 250,
    "remaining": 0,
    "period": {
      "start": "2026-10-01T00:00:00+00:00",
      "end": "2026-10-31T23:59:59+00:00"
    }
  }
}
```

**SDK Code**

```python Quota used up
import requests

url = "https://api.modex.com/v1/contacts/loan-officers/unlock"

payload = { "ids": ["c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Quota used up
const url = 'https://api.modex.com/v1/contacts/loan-officers/unlock';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"ids":["c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80"]}'
};

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

```go Quota used up
package main

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

func main() {

	url := "https://api.modex.com/v1/contacts/loan-officers/unlock"

	payload := strings.NewReader("{\n  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\"\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 Quota used up
require 'uri'
require 'net/http'

url = URI("https://api.modex.com/v1/contacts/loan-officers/unlock")

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  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\"\n  ]\n}"

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

```java Quota used up
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.modex.com/v1/contacts/loan-officers/unlock")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modex.com/v1/contacts/loan-officers/unlock', [
  'body' => '{
  "ids": [
    "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Quota used up
using RestSharp;

var client = new RestClient("https://api.modex.com/v1/contacts/loan-officers/unlock");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"ids\": [\n    \"c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Quota used up
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["ids": ["c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80"]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modex.com/v1/contacts/loan-officers/unlock")! 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()
```

### Invalid ID

**Request**

```json
{
  "ids": [
    "2345678"
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "c4e5f6a7-8b9c-4d0e-a1f2-3b4c5d6e7f80",
      "status": "unlocked",
      "contacts": {
        "phone_numbers": [
          {
            "type": "mobile",
            "value": "(503) 555-0142"
          },
          {
            "type": "office",
            "value": "(503) 555-0100"
          }
        ],
        "emails": [
          {
            "type": "work",
            "value": "jordan.ellery@example.com"
          }
        ],
        "websites": [
          {
            "type": "personal",
            "value": "https://www.example.com/jordan-ellery"
          }
        ],
        "addresses": []
      }
    },
    {
      "id": "d5f6a7b8-9c0d-4e1f-b2a3-4c5d6e7f8091",
      "status": "already_unlocked",
      "contacts": {
        "phone_numbers": [
          {
            "type": "office",
            "value": "(360) 555-0119"
          }
        ],
        "emails": [
          {
            "type": "work",
            "value": "riley.chen@example.com"
          }
        ],
        "websites": [],
        "addresses": []
      }
    },
    {
      "id": "11111111-2222-4333-8444-555555555555",
      "status": "not_found",
      "contacts": null
    },
    {
      "id": "66666666-7777-4888-9999-000000000000",
      "status": "unavailable",
      "contacts": null
    }
  ],
  "usage": {
    "used_this_month": 43,
    "limit": 250,
    "remaining": 207,
    "period": {
      "start": "2026-10-01T00:00:00+00:00",
      "end": "2026-10-31T23:59:59+00:00"
    }
  }
}
```

**SDK Code**

```python Invalid ID
import requests

url = "https://api.modex.com/v1/contacts/loan-officers/unlock"

payload = { "ids": ["2345678"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Invalid ID
const url = 'https://api.modex.com/v1/contacts/loan-officers/unlock';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"ids":["2345678"]}'
};

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

```go Invalid ID
package main

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

func main() {

	url := "https://api.modex.com/v1/contacts/loan-officers/unlock"

	payload := strings.NewReader("{\n  \"ids\": [\n    \"2345678\"\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 Invalid ID
require 'uri'
require 'net/http'

url = URI("https://api.modex.com/v1/contacts/loan-officers/unlock")

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  \"ids\": [\n    \"2345678\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.modex.com/v1/contacts/loan-officers/unlock")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"ids\": [\n    \"2345678\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modex.com/v1/contacts/loan-officers/unlock', [
  'body' => '{
  "ids": [
    "2345678"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Invalid ID
using RestSharp;

var client = new RestClient("https://api.modex.com/v1/contacts/loan-officers/unlock");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"ids\": [\n    \"2345678\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Invalid ID
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["ids": ["2345678"]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modex.com/v1/contacts/loan-officers/unlock")! 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()
```