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

# Create Manual Journal

POST https://api.papertracc.com/v1/journal/entries
Content-Type: application/json

Creates a manual journal entry. `transaction_date`, `currency_code`, and at least two `lines` are required; total debits must equal total credits or the request is rejected with 422. The entry is created as a DRAFT. `auto_post` is optional; when true, the entry is posted immediately after creation (the project must have `allow_create_and_post` enabled, otherwise the request is rejected with 400). Posting is rejected with 423 if the transaction date falls in a locked accounting period.

Reference: https://api-docs.papertracc.com/papertracc/journals/create-manual-journal

## Authentication

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

## Servers

- `https://api.papertracc.com/v1` (Production, default)
- `https://api.papertracc.com/rc-1` (Release Candidate 1)

## Request

### Body (application/json)

This endpoint expects an object.

- `transaction_date` (datetime, required)
- `currency_code` (string, required)
- `lines` (list of object, required)
  - `account_id` (string, required)
  - `amount` (double, required)
  - `type` (enum, required)
    - Allowed values: `DEBIT`, `CREDIT`
  - `tax_id` (string, optional)
  - `contact_id` (string, optional)
  - `staff_id` (string, optional)
  - `description` (string, optional)
- `exchange_rate` (double, optional)
- `description` (string, optional)
- `auto_post` (boolean, optional)

## Response

### 201

Created

- `status` (boolean, required)
- `message` (string, required)
- `data` (object, required)
  - `id` (string, required)
  - `created_by` (string, required)
  - `approved_by` (string, required, nullable)
  - `journal_entry_id` (string, required, nullable)
  - `project_id` (string, required)
  - `reference` (string, required)
  - `transaction_reference` (string, required)
  - `currency_code` (string, required)
  - `exchange_rate` (string, required)
  - `description` (string, required, nullable)
  - `rejection_reason` (string, required, nullable)
  - `is_test` (boolean, required)
  - `status` (enum, required) — DRAFT until posted; ARCHIVED means rejected.
    - Allowed values: `DRAFT`, `POSTED`, `ARCHIVED`, `VOIDED`
  - `approved_at` (datetime, required, nullable)
  - `transaction_date` (datetime, required)
  - `created_at` (datetime, required)
  - `updated_at` (datetime, required)
  - `lines` (list of object, required)
    - `id` (string, required)
    - `account_id` (string, required)
    - `tax_id` (string, required, nullable)
    - `account_name` (string, required)
    - `account_code` (string, required)
    - `contact_id` (string, required, nullable)
    - `staff_id` (string, required, nullable)
    - `description` (string, required, nullable)
    - `debit` (string, required)
    - `credit` (string, required)
    - `forex_debit` (string, required)
    - `forex_credit` (string, required)
    - `tax_amount` (string, required)

## Examples

### Create a draft manual journal

**Request**

```json
{
  "transaction_date": "2026-06-18T10:00:00.000Z",
  "currency_code": "NGN",
  "lines": [
    {
      "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
      "amount": 150000,
      "type": "DEBIT",
      "description": "Office rent - June"
    },
    {
      "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
      "amount": 150000,
      "type": "CREDIT",
      "description": "Office rent - June"
    }
  ],
  "description": "Office rent - June",
  "auto_post": false
}
```

**Response**

```json
{
  "status": true,
  "message": "Successfully created manual journal draft",
  "data": {
    "id": "45c6e26d-e132-4548-8e2e-5bfc467cf94a",
    "created_by": "6d7a1b2e-6f0a-4b8e-9a3a-1a9f9a2b3c4d",
    "approved_by": null,
    "journal_entry_id": null,
    "project_id": "spruce-demo",
    "reference": "ORG-0001",
    "transaction_reference": "JOU-0001",
    "currency_code": "NGN",
    "exchange_rate": "1.00",
    "description": "Office rent - June",
    "rejection_reason": null,
    "is_test": false,
    "status": "DRAFT",
    "approved_at": null,
    "transaction_date": "2026-06-18T10:00:00Z",
    "created_at": "2026-06-18T10:00:00Z",
    "updated_at": "2026-06-18T10:00:00Z",
    "lines": [
      {
        "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
        "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
        "tax_id": null,
        "account_name": "Rent Expense",
        "account_code": "6100",
        "contact_id": null,
        "staff_id": null,
        "description": "Office rent - June",
        "debit": "150000.00",
        "credit": "0.00",
        "forex_debit": "150000.00",
        "forex_credit": "0.00",
        "tax_amount": "0.00"
      },
      {
        "id": "16fd2706-8baf-433b-82eb-8c7fada847da",
        "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
        "tax_id": null,
        "account_name": "Cash and Cash Equivalents",
        "account_code": "1000",
        "contact_id": null,
        "staff_id": null,
        "description": "Office rent - June",
        "debit": "0.00",
        "credit": "150000.00",
        "forex_debit": "0.00",
        "forex_credit": "150000.00",
        "tax_amount": "0.00"
      }
    ]
  }
}
```

**SDK Code**

```python Create a draft manual journal
import requests

url = "https://api.papertracc.com/v1/journal/entries"

payload = {
    "transaction_date": "2026-06-18T10:00:00.000Z",
    "currency_code": "NGN",
    "lines": [
        {
            "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
            "amount": 150000,
            "type": "DEBIT",
            "description": "Office rent - June"
        },
        {
            "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
            "amount": 150000,
            "type": "CREDIT",
            "description": "Office rent - June"
        }
    ],
    "description": "Office rent - June",
    "auto_post": False
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a draft manual journal
const url = 'https://api.papertracc.com/v1/journal/entries';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"transaction_date":"2026-06-18T10:00:00.000Z","currency_code":"NGN","lines":[{"account_id":"d037d299-3029-4dc7-8e72-172f80f23c4f","amount":150000,"type":"DEBIT","description":"Office rent - June"},{"account_id":"2b0d1461-e52e-4a1a-a69c-11801431c2c9","amount":150000,"type":"CREDIT","description":"Office rent - June"}],"description":"Office rent - June","auto_post":false}'
};

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

```go Create a draft manual journal
package main

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

func main() {

	url := "https://api.papertracc.com/v1/journal/entries"

	payload := strings.NewReader("{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": false\n}")

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

	req.Header.Add("Authorization", "Bearer <apiKey>")
	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 Create a draft manual journal
require 'uri'
require 'net/http'

url = URI("https://api.papertracc.com/v1/journal/entries")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": false\n}"

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

```java Create a draft manual journal
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.papertracc.com/v1/journal/entries")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": false\n}")
  .asString();
```

```php Create a draft manual journal
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.papertracc.com/v1/journal/entries', [
  'body' => '{
  "transaction_date": "2026-06-18T10:00:00.000Z",
  "currency_code": "NGN",
  "lines": [
    {
      "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
      "amount": 150000,
      "type": "DEBIT",
      "description": "Office rent - June"
    },
    {
      "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
      "amount": 150000,
      "type": "CREDIT",
      "description": "Office rent - June"
    }
  ],
  "description": "Office rent - June",
  "auto_post": false
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create a draft manual journal
using RestSharp;

var client = new RestClient("https://api.papertracc.com/v1/journal/entries");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a draft manual journal
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "transaction_date": "2026-06-18T10:00:00.000Z",
  "currency_code": "NGN",
  "lines": [
    [
      "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
      "amount": 150000,
      "type": "DEBIT",
      "description": "Office rent - June"
    ],
    [
      "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
      "amount": 150000,
      "type": "CREDIT",
      "description": "Office rent - June"
    ]
  ],
  "description": "Office rent - June",
  "auto_post": false
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.papertracc.com/v1/journal/entries")! 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()
```

### Create and post manual journal

**Request**

```json
{
  "transaction_date": "2026-06-18T10:00:00.000Z",
  "currency_code": "NGN",
  "lines": [
    {
      "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
      "amount": 150000,
      "type": "DEBIT",
      "description": "Office rent - June"
    },
    {
      "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
      "amount": 150000,
      "type": "CREDIT",
      "description": "Office rent - June"
    }
  ],
  "description": "Office rent - June",
  "auto_post": true
}
```

**Response**

```json
{
  "status": true,
  "message": "Successfully created and posted manual journal",
  "data": {
    "id": "45c6e26d-e132-4548-8e2e-5bfc467cf94a",
    "created_by": "6d7a1b2e-6f0a-4b8e-9a3a-1a9f9a2b3c4d",
    "approved_by": null,
    "journal_entry_id": null,
    "project_id": "spruce-demo",
    "reference": "ORG-0001",
    "transaction_reference": "JOU-0001",
    "currency_code": "NGN",
    "exchange_rate": "1.00",
    "description": "Office rent - June",
    "rejection_reason": null,
    "is_test": false,
    "status": "POSTED",
    "approved_at": "2026-06-18T10:00:05Z",
    "transaction_date": "2026-06-18T10:00:00Z",
    "created_at": "2026-06-18T10:00:00Z",
    "updated_at": "2026-06-18T10:00:00Z",
    "lines": [
      {
        "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
        "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
        "tax_id": null,
        "account_name": "Rent Expense",
        "account_code": "6100",
        "contact_id": null,
        "staff_id": null,
        "description": "Office rent - June",
        "debit": "150000.00",
        "credit": "0.00",
        "forex_debit": "150000.00",
        "forex_credit": "0.00",
        "tax_amount": "0.00"
      },
      {
        "id": "16fd2706-8baf-433b-82eb-8c7fada847da",
        "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
        "tax_id": null,
        "account_name": "Cash and Cash Equivalents",
        "account_code": "1000",
        "contact_id": null,
        "staff_id": null,
        "description": "Office rent - June",
        "debit": "0.00",
        "credit": "150000.00",
        "forex_debit": "0.00",
        "forex_credit": "150000.00",
        "tax_amount": "0.00"
      }
    ]
  }
}
```

**SDK Code**

```python Create and post manual journal
import requests

url = "https://api.papertracc.com/v1/journal/entries"

payload = {
    "transaction_date": "2026-06-18T10:00:00.000Z",
    "currency_code": "NGN",
    "lines": [
        {
            "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
            "amount": 150000,
            "type": "DEBIT",
            "description": "Office rent - June"
        },
        {
            "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
            "amount": 150000,
            "type": "CREDIT",
            "description": "Office rent - June"
        }
    ],
    "description": "Office rent - June",
    "auto_post": True
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create and post manual journal
const url = 'https://api.papertracc.com/v1/journal/entries';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"transaction_date":"2026-06-18T10:00:00.000Z","currency_code":"NGN","lines":[{"account_id":"d037d299-3029-4dc7-8e72-172f80f23c4f","amount":150000,"type":"DEBIT","description":"Office rent - June"},{"account_id":"2b0d1461-e52e-4a1a-a69c-11801431c2c9","amount":150000,"type":"CREDIT","description":"Office rent - June"}],"description":"Office rent - June","auto_post":true}'
};

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

```go Create and post manual journal
package main

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

func main() {

	url := "https://api.papertracc.com/v1/journal/entries"

	payload := strings.NewReader("{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": true\n}")

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

	req.Header.Add("Authorization", "Bearer <apiKey>")
	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 Create and post manual journal
require 'uri'
require 'net/http'

url = URI("https://api.papertracc.com/v1/journal/entries")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": true\n}"

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

```java Create and post manual journal
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.papertracc.com/v1/journal/entries")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": true\n}")
  .asString();
```

```php Create and post manual journal
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.papertracc.com/v1/journal/entries', [
  'body' => '{
  "transaction_date": "2026-06-18T10:00:00.000Z",
  "currency_code": "NGN",
  "lines": [
    {
      "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
      "amount": 150000,
      "type": "DEBIT",
      "description": "Office rent - June"
    },
    {
      "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
      "amount": 150000,
      "type": "CREDIT",
      "description": "Office rent - June"
    }
  ],
  "description": "Office rent - June",
  "auto_post": true
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create and post manual journal
using RestSharp;

var client = new RestClient("https://api.papertracc.com/v1/journal/entries");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"transaction_date\": \"2026-06-18T10:00:00.000Z\",\n  \"currency_code\": \"NGN\",\n  \"lines\": [\n    {\n      \"account_id\": \"d037d299-3029-4dc7-8e72-172f80f23c4f\",\n      \"amount\": 150000,\n      \"type\": \"DEBIT\",\n      \"description\": \"Office rent - June\"\n    },\n    {\n      \"account_id\": \"2b0d1461-e52e-4a1a-a69c-11801431c2c9\",\n      \"amount\": 150000,\n      \"type\": \"CREDIT\",\n      \"description\": \"Office rent - June\"\n    }\n  ],\n  \"description\": \"Office rent - June\",\n  \"auto_post\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create and post manual journal
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "transaction_date": "2026-06-18T10:00:00.000Z",
  "currency_code": "NGN",
  "lines": [
    [
      "account_id": "d037d299-3029-4dc7-8e72-172f80f23c4f",
      "amount": 150000,
      "type": "DEBIT",
      "description": "Office rent - June"
    ],
    [
      "account_id": "2b0d1461-e52e-4a1a-a69c-11801431c2c9",
      "amount": 150000,
      "type": "CREDIT",
      "description": "Office rent - June"
    ]
  ],
  "description": "Office rent - June",
  "auto_post": true
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.papertracc.com/v1/journal/entries")! 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()
```