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

# Get Multiple Documents With Pagination

POST https://api.staple.io/v1/documents
Content-Type: application/json

Get a list of all the documents and their status within a single queue.

Reference: https://docs.staple.ai/api-reference/v1/documents/get-multiple-documents-with-pagination

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/documents:
    post:
      operationId: getMultipleDocumentsWithPagination
      summary: Get Multiple Documents With Pagination
      description: Get a list of all the documents and their status within a single queue.
      tags:
        - documents
      parameters:
        - name: x-api-key
          in: header
          description: API key issued by Staple.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Documents_getMultipleDocumentsWithPagination_Response_200
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                filter:
                  $ref: >-
                    #/components/schemas/V1DocumentsPostRequestBodyContentApplicationJsonSchemaFilter
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    V1DocumentsPostRequestBodyContentApplicationJsonSchemaFilterSort:
      type: object
      properties:
        fileName:
          type: string
        company:
          type: string
      title: V1DocumentsPostRequestBodyContentApplicationJsonSchemaFilterSort
    V1DocumentsPostRequestBodyContentApplicationJsonSchemaFilter:
      type: object
      properties:
        qid:
          type: integer
        status:
          type: string
        skip:
          type: integer
        take:
          type: integer
        sort:
          $ref: >-
            #/components/schemas/V1DocumentsPostRequestBodyContentApplicationJsonSchemaFilterSort
        search:
          type: string
      title: V1DocumentsPostRequestBodyContentApplicationJsonSchemaFilter
    Documents_getMultipleDocumentsWithPagination_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Documents_getMultipleDocumentsWithPagination_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key issued by Staple.
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT obtained from the login endpoint.

```

## Examples

### Get Multiple Documents With Pagination



**Request**

```json
undefined
```

**Response**

```json
{
  "getDocumentsByStatus": {
    "data": [
      {
        "categorisation": null,
        "company": "",
        "completeness": 100,
        "createdAt": 1589786505665,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "image1.png",
        "fileURL": "documents/-aJWAt7wWN08OKdhrOcZyV_PiGd6KIL8byGI.png",
        "id": 5965,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1591293714000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1587372178772,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "invoice_#INV-20200220-178 (1).pdf",
        "fileURL": "documents/0JjvRM2DGes9p-dFPmdbsv8Bxe_kl0wwitoc.png",
        "id": 5699,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1587372179000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586432227890,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "5f13f120-7a56-11ea-8616-43562dbc2b0a-Dental-Invoice_1.JPG",
        "fileURL": "documents/2GtIZEzFU7K38m1PYv8Tg9ZJsM2m8UVsvvOq.png",
        "id": 5488,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1586432228000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586419480167,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "Central 24 Hour Clinic.jpg",
        "fileURL": "documents/2XJaxSoG5apLvgWWGI1SI-MQTazFhb1BUggJ.png",
        "id": 5436,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586419480000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1587372066231,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "invoice_#INV-20200220-178 (1).pdf",
        "fileURL": "documents/3h0v89MsnCcBb0kycXKjN04AoRV2UR0qNggF.png",
        "id": 5698,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1587372066000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586419041503,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "aec0ead0-7a37-11ea-82e5-1132d154af42-GRH-Invoice_2.pdf",
        "fileURL": "documents/7ivnDehxFZ9lSHqeSeB0EhMRs34zlKFXSofl.png",
        "id": 5434,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586419041000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586418406163,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "345dda10-7a36-11ea-82e5-1132d154af42-GRH-Invoice_2.pdf",
        "fileURL": "documents/7XcMJoUYypk6qYh6URyEhsyDBtT6KxJ0gM4m.png",
        "id": 5430,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586418406000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586418971449,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "804029a0-7a37-11ea-82e5-1132d154af42-GRH-Invoice_1.pdf",
        "fileURL": "documents/AA07-j9WOXGZQth4bLosuML62GQ2xacrPV5c.png",
        "id": 5433,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586418971000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586418964896,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "80411400-7a37-11ea-82e5-1132d154af42-GRH-Invoice_2.pdf",
        "fileURL": "documents/AkeCjDcKGgUqyf3Xl22HBDUJh4OxD0NQzCxu.png",
        "id": 5432,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586418965000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586425103460,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "ce711130-7a45-11ea-b5ce-17ed1a020c16-GP-Clinic-Invoice_2.pdf",
        "fileURL": "documents/HgI718EX1Y1hOk0tE6U9SRQg0EAswFF0tR0m.png",
        "id": 5469,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586425103000,
        "uploadedBy": "vovanluc1987@gmail.com"
      }
    ],
    "pageInfo": {
      "hasNextPage": true,
      "hasPreviousPage": false,
      "lastCursor": 5469
    },
    "total": 24
  }
}
```

**SDK Code**

```python Get Multiple Documents With Pagination
import requests

url = "https://api.staple.io/v1/documents"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Get Multiple Documents With Pagination
const url = 'https://api.staple.io/v1/documents';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

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

```go Get Multiple Documents With Pagination
package main

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

func main() {

	url := "https://api.staple.io/v1/documents"

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

	req.Header.Add("x-api-key", "<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 Get Multiple Documents With Pagination
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/documents")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

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

```java Get Multiple Documents With Pagination
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/documents")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Get Multiple Documents With Pagination
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/documents', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Get Multiple Documents With Pagination
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/documents");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Get Multiple Documents With Pagination
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/documents")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Documents_getMultipleDocumentsWithPagination_example



**Request**

```json
{
  "filter": {
    "qid": 1,
    "status": "REVIEWED",
    "skip": 0,
    "take": 10,
    "sort": {
      "fileName": "DESC",
      "company": "ASC"
    },
    "search": "invoice 11"
  }
}
```

**Response**

```json
{
  "getDocumentsByStatus": {
    "data": [
      {
        "categorisation": null,
        "company": "",
        "completeness": 100,
        "createdAt": 1589786505665,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "image1.png",
        "fileURL": "documents/-aJWAt7wWN08OKdhrOcZyV_PiGd6KIL8byGI.png",
        "id": 5965,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1591293714000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1587372178772,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "invoice_#INV-20200220-178 (1).pdf",
        "fileURL": "documents/0JjvRM2DGes9p-dFPmdbsv8Bxe_kl0wwitoc.png",
        "id": 5699,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1587372179000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586432227890,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "5f13f120-7a56-11ea-8616-43562dbc2b0a-Dental-Invoice_1.JPG",
        "fileURL": "documents/2GtIZEzFU7K38m1PYv8Tg9ZJsM2m8UVsvvOq.png",
        "id": 5488,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1586432228000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586419480167,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "Central 24 Hour Clinic.jpg",
        "fileURL": "documents/2XJaxSoG5apLvgWWGI1SI-MQTazFhb1BUggJ.png",
        "id": 5436,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586419480000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1587372066231,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "invoice_#INV-20200220-178 (1).pdf",
        "fileURL": "documents/3h0v89MsnCcBb0kycXKjN04AoRV2UR0qNggF.png",
        "id": 5698,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 20,
        "uploadedAt": 1587372066000,
        "uploadedBy": "developer@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586419041503,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "aec0ead0-7a37-11ea-82e5-1132d154af42-GRH-Invoice_2.pdf",
        "fileURL": "documents/7ivnDehxFZ9lSHqeSeB0EhMRs34zlKFXSofl.png",
        "id": 5434,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586419041000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586418406163,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "345dda10-7a36-11ea-82e5-1132d154af42-GRH-Invoice_2.pdf",
        "fileURL": "documents/7XcMJoUYypk6qYh6URyEhsyDBtT6KxJ0gM4m.png",
        "id": 5430,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586418406000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586418971449,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "804029a0-7a37-11ea-82e5-1132d154af42-GRH-Invoice_1.pdf",
        "fileURL": "documents/AA07-j9WOXGZQth4bLosuML62GQ2xacrPV5c.png",
        "id": 5433,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586418971000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586418964896,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "80411400-7a37-11ea-82e5-1132d154af42-GRH-Invoice_2.pdf",
        "fileURL": "documents/AkeCjDcKGgUqyf3Xl22HBDUJh4OxD0NQzCxu.png",
        "id": 5432,
        "layout": null,
        "qid": 14,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586418965000,
        "uploadedBy": "vovanluc1987@gmail.com"
      },
      {
        "categorisation": null,
        "company": null,
        "completeness": 100,
        "createdAt": 1586425103460,
        "exportedAt": null,
        "exportedBy": null,
        "exportedType": null,
        "fileName": "ce711130-7a45-11ea-b5ce-17ed1a020c16-GP-Clinic-Invoice_2.pdf",
        "fileURL": "documents/HgI718EX1Y1hOk0tE6U9SRQg0EAswFF0tR0m.png",
        "id": 5469,
        "layout": null,
        "qid": 1,
        "status": "REVIEWED",
        "uid": 38,
        "uploadedAt": 1586425103000,
        "uploadedBy": "vovanluc1987@gmail.com"
      }
    ],
    "pageInfo": {
      "hasNextPage": true,
      "hasPreviousPage": false,
      "lastCursor": 5469
    },
    "total": 24
  }
}
```

**SDK Code**

```python Documents_getMultipleDocumentsWithPagination_example
import requests

url = "https://api.staple.io/v1/documents"

payload = { "filter": {
        "qid": 1,
        "status": "REVIEWED",
        "skip": 0,
        "take": 10,
        "sort": {
            "fileName": "DESC",
            "company": "ASC"
        },
        "search": "invoice 11"
    } }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Documents_getMultipleDocumentsWithPagination_example
const url = 'https://api.staple.io/v1/documents';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"filter":{"qid":1,"status":"REVIEWED","skip":0,"take":10,"sort":{"fileName":"DESC","company":"ASC"},"search":"invoice 11"}}'
};

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

```go Documents_getMultipleDocumentsWithPagination_example
package main

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

func main() {

	url := "https://api.staple.io/v1/documents"

	payload := strings.NewReader("{\n  \"filter\": {\n    \"qid\": 1,\n    \"status\": \"REVIEWED\",\n    \"skip\": 0,\n    \"take\": 10,\n    \"sort\": {\n      \"fileName\": \"DESC\",\n      \"company\": \"ASC\"\n    },\n    \"search\": \"invoice 11\"\n  }\n}")

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

	req.Header.Add("x-api-key", "<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 Documents_getMultipleDocumentsWithPagination_example
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/documents")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"filter\": {\n    \"qid\": 1,\n    \"status\": \"REVIEWED\",\n    \"skip\": 0,\n    \"take\": 10,\n    \"sort\": {\n      \"fileName\": \"DESC\",\n      \"company\": \"ASC\"\n    },\n    \"search\": \"invoice 11\"\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/documents")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"filter\": {\n    \"qid\": 1,\n    \"status\": \"REVIEWED\",\n    \"skip\": 0,\n    \"take\": 10,\n    \"sort\": {\n      \"fileName\": \"DESC\",\n      \"company\": \"ASC\"\n    },\n    \"search\": \"invoice 11\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/documents', [
  'body' => '{
  "filter": {
    "qid": 1,
    "status": "REVIEWED",
    "skip": 0,
    "take": 10,
    "sort": {
      "fileName": "DESC",
      "company": "ASC"
    },
    "search": "invoice 11"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Documents_getMultipleDocumentsWithPagination_example
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/documents");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"filter\": {\n    \"qid\": 1,\n    \"status\": \"REVIEWED\",\n    \"skip\": 0,\n    \"take\": 10,\n    \"sort\": {\n      \"fileName\": \"DESC\",\n      \"company\": \"ASC\"\n    },\n    \"search\": \"invoice 11\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Documents_getMultipleDocumentsWithPagination_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["filter": [
    "qid": 1,
    "status": "REVIEWED",
    "skip": 0,
    "take": 10,
    "sort": [
      "fileName": "DESC",
      "company": "ASC"
    ],
    "search": "invoice 11"
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/documents")! 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()
```