> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qubesync.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Auto-Pagination

> Auto-paginate requests / responses from QuickBooks.

## Overview

QuickBooks frequently needs to paginate responses to avoid timeouts and other issues. Usually this would require tracking iterator metadata and making multiple requests to QuickBooks.

## Auto-pagination to the rescue

QuBe Sync can automatically paginate any QuickBooks request that supports it. Each result page will be sent to the `webhook_url` provided with the original request. Each webhook will contain the `page` and `page_request_id` attributes to help you distinguish between pages.

If you are using [pre-built requests](/api-reference/pre-built-queries/query-customers), you can auto-paginate them by setting the `iterate` parameter to `true`.

<CodeGroup>
  ```curl curl theme={null}
  curl https://qubesync.com/api/v1/connections/$CONN_ID/customers?iterate=true \
       --user $QUBE_API_KEY:
  ```
</CodeGroup>

If you're building custom requests, QuBe Sync will automatically paginate any request you send with `iterator="Start"`.

<CodeGroup>
  ```xml qbxml theme={null}
  <?xml version="1.0" encoding="utf-8"?>
  <?qbxml version="13.0"?>
  <QBXML>
    <QBXMLMsgsRq>
      <CustomerQueryRq iterator="Start">
        <MaxReturned>100</MaxReturned>
      </CustomerQueryRq>
    </QBXMLMsgsRq>
  </QBXML>
  ```

  ```ruby ruby theme={null}
  QubeSync::RequestBuilder.new do |r|
    r.QBXML do
      r.QBXMLMsgsRq do
        r.CustomerQueryRq(iterator: "Start") do
          r.MaxReturned(100)
        end
      end
    end
  end
  ```
</CodeGroup>
