> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# List batches for org

GET https://api-sandbox.payabli.com/api/Query/batches/org/{orgId}

Retrieve a list of batches for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response.

Reference: https://docs.payabli.com/developers/api-reference/query/get-list-of-batches-for-an-organization

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi-oas
  version: 1.0.0
paths:
  /Query/batches/org/{orgId}:
    get:
      operationId: ListBatchesOrg
      summary: Get list of batches for an organization
      description: >-
        Retrieve a list of batches for an org. Use filters to limit results.
        Include the `exportFormat` query parameter to return the results as a
        file instead of a JSON response.
      tags:
        - Query
      parameters:
        - name: orgId
          in: path
          description: The numeric identifier for organization, assigned by Payabli.
          required: true
          schema:
            type: integer
        - name: exportFormat
          in: query
          description: >-
            Export format for file downloads. When specified, returns data as a
            file instead of JSON.
          required: false
          schema:
            $ref: '#/components/schemas/ExportFormat'
        - name: fromRecord
          in: query
          description: >-
            The number of records to skip before starting to collect the result
            set.
          required: false
          schema:
            type: integer
            default: 0
        - name: limitRecord
          in: query
          description: >-
            Max number of records to return for the query. Use `0` or negative
            value to return all records.
          required: false
          schema:
            type: integer
            default: 20
        - name: parameters
          in: query
          description: >-
            Collection of field names, conditions, and values used to filter the
            query.

            <Info>
              **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.**

              Because of a technical limitation, you can't make a request that includes filters from the API console on this page. The response won't be filtered. Instead, copy the request, remove `parameters=` and run the request in a different client.

              For example:

              --url https://api-sandbox.payabli.com/api/Query/transactions/org/236?parameters=totalAmount(gt)=1000&limitRecord=20

              should become:

              --url https://api-sandbox.payabli.com/api/Query/transactions/org/236?totalAmount(gt)=1000&limitRecord=20
            </Info>


            See [Filters and Conditions
            Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference)
            for more information.


            **List of field names accepted:**


            - `batchDate` (gt, ge, lt, le, eq, ne)

            - `batchNumber` (ne, eq)

            - `method` (in, nin, eq, ne)

            - `connectorName` (ne, eq, ct, nct)

            - `batchAmount` (gt, ge, lt, le, eq, ne)

            - `feeBatchAmount` (gt, ge, lt, le, eq, ne)

            - `netBatchAmount` (gt, ge, lt, le, eq, ne)

            - `releaseAmount` (gt, ge, lt, le, eq, ne)

            - `heldAmount` (gt, ge, lt, le, eq, ne)

            - `status` (in, nin, eq, ne)

            - `paypointLegal` (ne, eq, ct, nct)

            - `paypointDba` (ne, eq, ct, nct)

            - `orgName` (ne, eq, ct, nct)

            - `paypointId` (ne, eq)

            - `externalPaypointID` (ct, nct, eq, ne)

            - `expectedDepositDate` (gt, ge, lt, le, eq, ne)

            - `depositDate` (gt, ge, lt, le, eq, ne)

            - `batchRecords` (gt, ge, lt, le, eq, ne)

            - `transferId` (ne, eq)

            - `transferDate` (gt, ge, lt, le, eq, ne)

            - `grossAmount` (gt, ge, lt, le, eq, ne)

            - `chargeBackAmount` (gt, ge, lt, le, eq, ne)

            - `returnedAmount` (gt, ge, lt, le, eq, ne)

            - `billingFeeAmount` (gt, ge, lt, le, eq, ne)

            - `thirdPartyPaidAmount` (gt, ge, lt, le, eq, ne)

            - `netFundedAmount` (gt, ge, lt, le, eq, ne)

            - `adjustmentAmount` (gt, ge, lt, le, eq, ne)

            - `processor` (ne, eq, ct, nct)

            - `transferStatus` (ne, eq, in, nin)


            **List of parameters accepted:**

            - `limitRecord`: max number of records for query (default="20", "0"
            or negative value for all)

            - `fromRecord`: initial record in query


            Example: `batchAmount(gt)=20` returns all records with a
            `batchAmount` greater than 20.00
          required: false
          schema:
            type: object
            additionalProperties:
              type:
                - string
                - 'null'
        - name: sortBy
          in: query
          description: >-
            The field name to use for sorting results. Use `desc(field_name)` to
            sort descending by `field_name`, and use `asc(field_name)` to sort
            ascending by `field_name`.
          required: false
          schema:
            type: string
        - name: requestToken
          in: header
          description: >
            Long-lived API token sent in the `requestToken` header. See [API
            token authentication](/developers/api-tokens).
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryBatchesResponse'
        '400':
          description: Bad request / invalid data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '503':
          description: Database connection error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
servers:
  - url: https://api-sandbox.payabli.com/api
    description: Sandbox
  - url: https://api.payabli.com/api
    description: Production
components:
  schemas:
    ExportFormat:
      type: string
      enum:
        - csv
        - xlsx
      description: |
        Export format for file downloads. When specified, returns data as a file
        instead of JSON.
      title: ExportFormat
    BatchNumber:
      type: string
      description: >
        A unique identifier for the batch. This is generated by Payabli when the

        batch is created, and follows this format:

        `paypointId + "_" + serviceName + "_" + batchDate:yyyyMMdd + "_" +
        Guid.NewGuid()`.

        Payabli generates the GUID to ensure that the batch number is unique.


        For example, in this batch number:

        `123_card_20251008_3f2504e0-4f89-11d3-9a0c-0305e82c3301`, the paypointID

        is `123`, the service is `card`, the batch date is `2025-10-08`, and

        the GUID is `3f2504e0-4f89-11d3-9a0c-0305e82c3301`.
      title: BatchNumber
    TransferIdentifier:
      type: string
      description: Unique identifier for the transfer.
      title: TransferIdentifier
    Source:
      type: string
      description: Custom identifier to indicate the transaction or request source.
      title: Source
    GeneralEvents:
      type: object
      properties:
        description:
          type: string
          description: Event description.
        eventTime:
          type: string
          format: date-time
          description: Event timestamp, in UTC.
        extraData:
          type:
            - string
            - 'null'
          description: Extra data.
        refData:
          type: string
          description: Reference data.
        source:
          $ref: '#/components/schemas/Source'
          description: The event source.
      title: GeneralEvents
    PaypointId:
      type: integer
      format: int64
      description: The paypoint's ID. Note that this is different than the entryname.
      title: PaypointId
    PaypointName:
      type: string
      description: The paypoint name.
      title: PaypointName
    Dbaname:
      type: string
      description: |
        The alternate or common name that this business is doing business under,
        usually referred to as a DBA name.
      title: Dbaname
    OrgParentName:
      type: string
      description: The name of the parent organization.
      title: OrgParentName
    ExternalPaypointId:
      type: string
      description: |
        A custom identifier for the paypoint, if applicable.
      title: ExternalPaypointId
    Entrypointfield:
      type: string
      description: The entrypoint identifier.
      title: Entrypointfield
    ExpectedDepositDate:
      type: string
      format: date-time
      description: The date the funds are expected to be deposited.
      title: ExpectedDepositDate
    DepositDate:
      type: string
      format: date-time
      description: The date the funds were deposited.
      title: DepositDate
    QueryBatchesTransfer:
      type: object
      properties:
        TransferId:
          type:
            - integer
            - 'null'
          description: The transfer ID.
        TransferDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The transfer date.
        Processor:
          type:
            - string
            - 'null'
          description: The processor used for the transfer.
        TransferStatus:
          type:
            - integer
            - 'null'
          description: The transfer status.
        GrossAmount:
          type:
            - number
            - 'null'
          format: double
          description: The gross amount of the transfer.
        ChargeBackAmount:
          type:
            - number
            - 'null'
          format: double
          description: The chargeback amount.
        ReturnedAmount:
          type:
            - number
            - 'null'
          format: double
          description: The returned amount.
        RefundAmount:
          type:
            - number
            - 'null'
          format: double
          description: The refund amount.
        HoldAmount:
          type:
            - number
            - 'null'
          format: double
          description: The amount being held.
        ReleasedAmount:
          type:
            - number
            - 'null'
          format: double
          description: The amount that has been released.
        BillingFeesAmount:
          type:
            - number
            - 'null'
          format: double
          description: The billing fees amount.
        ThirdPartyPaidAmount:
          type:
            - number
            - 'null'
          format: double
          description: The third party paid amount.
        AdjustmentsAmount:
          type:
            - number
            - 'null'
          format: double
          description: The adjustments amount.
        NetFundedAmount:
          type:
            - number
            - 'null'
          format: double
          description: The net funded amount.
      required:
        - TransferId
        - TransferDate
        - Processor
        - TransferStatus
        - GrossAmount
        - ChargeBackAmount
        - ReturnedAmount
        - RefundAmount
        - HoldAmount
        - ReleasedAmount
        - BillingFeesAmount
        - ThirdPartyPaidAmount
        - AdjustmentsAmount
        - NetFundedAmount
      description: Transfer details within a batch response.
      title: QueryBatchesTransfer
    QueryBatchesResponseRecordsItem:
      type: object
      properties:
        IdBatch:
          type:
            - integer
            - 'null'
          description: The batch ID.
        BatchNumber:
          oneOf:
            - $ref: '#/components/schemas/BatchNumber'
            - type: 'null'
        TransferIdentifier:
          oneOf:
            - $ref: '#/components/schemas/TransferIdentifier'
            - type: 'null'
        EventsData:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/GeneralEvents'
          description: Events associated with the batch.
        ConnectorName:
          type:
            - string
            - 'null'
        BatchDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The batch date.
        BatchAmount:
          type:
            - number
            - 'null'
          format: double
          description: The amount of the batch.
        BatchFeesAmount:
          type:
            - number
            - 'null'
          format: double
          description: The total of fees in the batch.
        BatchAuthAmount:
          type:
            - number
            - 'null'
          format: double
        BatchReleasedAmount:
          type:
            - number
            - 'null'
          format: double
          description: Previously held funds that have been released after a risk review.
        BatchHoldAmount:
          type:
            - number
            - 'null'
          format: double
          description: >-
            The total amount of the batch that's being held for fraud or risk
            concerns.
        BatchReturnedAmount:
          type:
            - number
            - 'null'
          format: double
          description: Total amount of ACH returns deducted from batch.
        BatchRefundAmount:
          type:
            - number
            - 'null'
          format: double
          description: The total amount of refunds deducted from batch.
        BatchSplitAmount:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Total of split transactions that included split funding instructions
            at the time of authorization.
        BatchStatus:
          type: integer
          description: >-
            The batch status. See [Batch
            Status](/developers/references/money-in-statuses#batch-status) for
            more.
        BatchRecords:
          type: integer
          description: The number of records in the batch.
        PaypointId:
          oneOf:
            - $ref: '#/components/schemas/PaypointId'
            - type: 'null'
        PaypointName:
          oneOf:
            - $ref: '#/components/schemas/PaypointName'
            - type: 'null'
        PaypointDba:
          oneOf:
            - $ref: '#/components/schemas/Dbaname'
            - type: 'null'
        ParentOrgName:
          $ref: '#/components/schemas/OrgParentName'
          description: The entrypoint's parent org.
        ParentOrgId:
          type: integer
          description: The parent organization ID.
        externalPaypointID:
          oneOf:
            - $ref: '#/components/schemas/ExternalPaypointId'
            - type: 'null'
        EntryName:
          $ref: '#/components/schemas/Entrypointfield'
        BankName:
          type:
            - string
            - 'null'
          description: The bank name.
        BatchType:
          type:
            - integer
            - 'null'
          description: The batch type.
        Method:
          type:
            - string
            - 'null'
          description: The payment method used.
        ExpectedDepositDate:
          oneOf:
            - $ref: '#/components/schemas/ExpectedDepositDate'
            - type: 'null'
        DepositDate:
          oneOf:
            - $ref: '#/components/schemas/DepositDate'
            - type: 'null'
        TransferDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The batch transfer date.
        Transfer:
          oneOf:
            - $ref: '#/components/schemas/QueryBatchesTransfer'
            - type: 'null'
          description: Transfer details for the batch.
      required:
        - IdBatch
        - BatchNumber
        - TransferIdentifier
        - EventsData
        - ConnectorName
        - BatchDate
        - BatchAmount
        - BatchFeesAmount
        - BatchAuthAmount
        - BatchReleasedAmount
        - BatchHoldAmount
        - BatchReturnedAmount
        - BatchRefundAmount
        - BatchSplitAmount
        - BatchStatus
        - BatchRecords
        - PaypointId
        - PaypointName
        - PaypointDba
        - ParentOrgName
        - ParentOrgId
        - externalPaypointID
        - EntryName
        - BankName
        - BatchType
        - Method
        - ExpectedDepositDate
        - DepositDate
        - TransferDate
        - Transfer
      title: QueryBatchesResponseRecordsItem
    PageIdentifier:
      type: string
      description: Auxiliary validation used internally by payment pages and components.
      title: PageIdentifier
    BatchSummary:
      type: object
      properties:
        pageidentifier:
          $ref: '#/components/schemas/PageIdentifier'
        pageSize:
          type: integer
          description: Number of records on each response page.
        totalAmount:
          type: number
          format: double
          description: Total amount for the records.
        totalNetAmount:
          type: number
          format: double
          description: Total net amount for the records.
        totalPages:
          type: integer
          description: Total number of pages in response.
        totalRecords:
          type: integer
          description: Total number of records in response.
      title: BatchSummary
    QueryBatchesResponse:
      type: object
      properties:
        Records:
          type: array
          items:
            $ref: '#/components/schemas/QueryBatchesResponseRecordsItem'
        Summary:
          $ref: '#/components/schemas/BatchSummary'
      required:
        - Records
        - Summary
      description: Response body for queries about batches.
      title: QueryBatchesResponse
    PayabliErrorBodyResponseData:
      type: object
      properties:
        explanation:
          type: string
          description: Human-readable explanation of what happened.
        todoAction:
          type: string
          description: Suggested resolution.
      description: Object with detailed error context.
      title: PayabliErrorBodyResponseData
    PayabliErrorBody:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: Always `false` for error responses.
        responseCode:
          type: integer
          description: |
            Code for the response. Learn more in
            [API Response Codes](/developers/api-reference/api-responses).
        responseText:
          type: string
          description: Error text describing what went wrong.
        responseData:
          $ref: '#/components/schemas/PayabliErrorBodyResponseData'
          description: Object with detailed error context.
      required:
        - isSuccess
        - responseText
      description: |
        Shape returned by every Payabli API error response. The `responseData`
        object carries human-readable error context.
      title: PayabliErrorBody
  securitySchemes:
    APIKeyAuth:
      type: apiKey
      in: header
      name: requestToken
      description: >
        Long-lived API token sent in the `requestToken` header. See [API token
        authentication](/developers/api-tokens).
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        OAuth2 Bearer access token from the client-credentials flow. See [OAuth
        authentication](/developers/oauth-authentication).

```

## Examples



**Response**

```json
{
  "Records": [
    {
      "IdBatch": 1049,
      "BatchNumber": "batch_2857_combined_08-26-2025_001",
      "TransferIdentifier": null,
      "EventsData": [
        {
          "description": "Created",
          "eventTime": "2025-08-25T03:19:27.6190027-04:00",
          "extraData": null,
          "refData": null,
          "source": "api"
        }
      ],
      "ConnectorName": "GP",
      "BatchDate": "2025-08-25T20:00:00",
      "BatchAmount": 0,
      "BatchFeesAmount": 0,
      "BatchAuthAmount": 0,
      "BatchReleasedAmount": 0,
      "BatchHoldAmount": 0,
      "BatchReturnedAmount": 0,
      "BatchRefundAmount": 0,
      "BatchSplitAmount": 0,
      "BatchStatus": 2,
      "BatchRecords": 2,
      "PaypointId": 3040,
      "PaypointName": "Gruzya Adventure Outfitters, LLC",
      "PaypointDba": "Gruzya Adventure Outfitters",
      "ParentOrgName": "Pilgrim Planner",
      "ParentOrgId": 105,
      "externalPaypointID": null,
      "EntryName": "47f4f8c7e1",
      "BankName": "Riverdale Community Bank",
      "BatchType": 0,
      "Method": "combined",
      "ExpectedDepositDate": "2025-08-26T00:00:00Z",
      "DepositDate": null,
      "TransferDate": "2025-08-26T00:00:00Z",
      "Transfer": null
    },
    {
      "IdBatch": 1043,
      "BatchNumber": "BT-2023041817-187",
      "TransferIdentifier": null,
      "EventsData": null,
      "ConnectorName": null,
      "BatchDate": "2023-04-18T17:01:03Z",
      "BatchAmount": 219.02,
      "BatchFeesAmount": 0,
      "BatchAuthAmount": 0,
      "BatchReleasedAmount": 0,
      "BatchHoldAmount": 0,
      "BatchReturnedAmount": 0,
      "BatchRefundAmount": 0,
      "BatchSplitAmount": 0,
      "BatchStatus": 2,
      "BatchRecords": 1,
      "PaypointId": 3040,
      "PaypointName": "Gruzya Adventure Outfitters, LLC",
      "PaypointDba": "Gruzya Adventure Outfitters",
      "ParentOrgName": "Pilgrim Planner",
      "ParentOrgId": 105,
      "externalPaypointID": null,
      "EntryName": "d193cf9a46",
      "BankName": "Riverdale Community Bank",
      "BatchType": 0,
      "Method": "card",
      "ExpectedDepositDate": "2023-04-19T00:00:00Z",
      "DepositDate": null,
      "TransferDate": "2025-09-02T00:00:00Z",
      "Transfer": null
    },
    {
      "IdBatch": 1012,
      "BatchNumber": "BT-2023041421-187",
      "TransferIdentifier": "ec310c3d-d4bf-4670-9524-00fcc4ab6a2a",
      "EventsData": [
        {
          "description": "Created",
          "eventTime": "2023-04-14T21:01:03Z",
          "extraData": null,
          "refData": null,
          "source": "api"
        },
        {
          "description": "Closed",
          "eventTime": "2023-04-15T03:05:10Z",
          "extraData": null,
          "refData": "batchId: 1012",
          "source": "worker"
        }
      ],
      "ConnectorName": "GP",
      "BatchDate": "2023-04-14T21:01:03Z",
      "BatchAmount": 1080.44,
      "BatchFeesAmount": 0,
      "BatchAuthAmount": 1080.44,
      "BatchReleasedAmount": 0,
      "BatchHoldAmount": 0,
      "BatchReturnedAmount": 0,
      "BatchRefundAmount": 0,
      "BatchSplitAmount": 0,
      "BatchStatus": 2,
      "BatchRecords": 4,
      "PaypointId": 3040,
      "PaypointName": "Gruzya Adventure Outfitters, LLC",
      "PaypointDba": "Gruzya Adventure Outfitters",
      "ParentOrgName": "Pilgrim Planner",
      "ParentOrgId": 105,
      "externalPaypointID": null,
      "EntryName": "d193cf9a46",
      "BankName": "Riverdale Community Bank",
      "BatchType": 0,
      "Method": "card",
      "ExpectedDepositDate": "2023-04-15T00:00:00Z",
      "DepositDate": null,
      "TransferDate": "2025-09-02T00:00:00Z",
      "Transfer": {
        "TransferId": 4521,
        "TransferDate": "2025-09-02T00:00:00Z",
        "Processor": "gp",
        "TransferStatus": 1,
        "GrossAmount": 1080.44,
        "ChargeBackAmount": 0,
        "ReturnedAmount": 0,
        "RefundAmount": 0,
        "HoldAmount": 0,
        "ReleasedAmount": 0,
        "BillingFeesAmount": 0,
        "ThirdPartyPaidAmount": 0,
        "AdjustmentsAmount": 0,
        "NetFundedAmount": 1080.44
      }
    }
  ],
  "Summary": {
    "pageidentifier": null,
    "pageSize": 20,
    "totalAmount": 54049.71,
    "totalNetAmount": 0,
    "totalPages": 3,
    "totalRecords": 3
  }
}
```

**SDK Code**

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.query.listBatchesOrg(123, {
        fromRecord: 251,
        limitRecord: 0,
        sortBy: "desc(field_name)",
    });
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.query.list_batches_org(
    org_id=123,
    from_record=251,
    limit_record=0,
    sort_by="desc(field_name)",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.resources.query.requests.ListBatchesOrgRequest;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.query().listBatchesOrg(
            123,
            ListBatchesOrgRequest
                .builder()
                .fromRecord(251)
                .limitRecord(0)
                .sortBy("desc(field_name)")
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.query.list_batches_org(
  org_id: 123,
  from_record: 251,
  limit_record: 0,
  sort_by: "desc(field_name)"
)

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.Query.ListBatchesOrgAsync(
            123,
            new ListBatchesOrgRequest {
                FromRecord = 251,
                LimitRecord = 0,
                SortBy = "desc(field_name)"
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.ListBatchesOrgRequest{
        FromRecord: payabli.Int(
            251,
        ),
        LimitRecord: payabli.Int(
            0,
        ),
        SortBy: payabli.String(
            "desc(field_name)",
        ),
    }
    client.Query.ListBatchesOrg(
        context.TODO(),
        123,
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Query\Requests\ListBatchesOrgRequest;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->query->listBatchesOrg(
    123,
    new ListBatchesOrgRequest([
        'fromRecord' => 251,
        'limitRecord' => 0,
        'sortBy' => 'desc(field_name)',
    ]),
);

```

```swift
import Foundation

let headers = ["requestToken": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Query/batches/org/123?fromRecord=251&limitRecord=0&sortBy=desc%28field_name%29")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```