# Pagination in Transaction Inquiries

Since the result of an inquiry request could contain a large amount of data, the `inquireTransactions` command supports pagination. It is recommended to use pagination for faster response times when sending requests that may return a large number of results, such as date range inquiries.

When you use pagination in transaction inquiries, your [initial request](#initial-request) will differ from your [subsequent requests](#requests-for-subsequent-pages).

## Initial request

When sending the initial request, add the `resultType` parameter to the `inquireTransactions` command in your XML payload and set it to `Paging`.

Here's what your XML payload could look like for an initial request to inquire about transactions transmitted within a specific date range:

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>inquireTransactions</command>
        <inquireTransactions>
            <terminalNumber>{terminalNumber}</terminalNumber>
            <resultType>Paging</resultType>
            <fromTransmitDate>2025-07-20</fromTransmitDate>
            <toTransmitDate>2025-08-01</toTransmitDate>
        </inquireTransactions>
    </request>
</ashrait>
```

Hyp API will return the first 50 matches in the `transactions` element, as well as the `totals` element containing pagination information such as the current page number (`pageNumber`) and total pages (`pagesAmount`). In this example, the total number of results (`totalMatch`) is 284, and the total number of pages (`pagesAmount`) is 6:

```xml
<ashrait>
    <response>
        <command>inquireTransactions</command>
        <dateTime>2025-08-05 14:27</dateTime>
        <requestId/>
        <tranId>119278435</tranId>
        <result>000</result>
        <message>Permitted transaction</message>
        <userMessage>Permitted transaction</userMessage>
        <additionalInfo/>
        <version>2000</version>
        <language>Eng</language>
        <inquireTransactions>
            <transactions>
                ...
            </transactions>
            <totals>
                <pageNumber>1</pageNumber>
                <pagesAmount>6</pagesAmount>
                <queryResultId>2508051631_3b83b4</queryResultId>
                <total>50</total>
                <totalMatch>284</totalMatch>
            </totals>
        </inquireTransactions>
    </response>
</ashrait>
```

The `queryResultId` element under `totals` in the response is the identifier that you'll need to use in subsequent requests to retrieve additional pages of results.

## Requests for subsequent pages

To retrieve additional pages of results, you need to send subsequent requests with the `queryResultId` value received in the initial response. In these requests, you also need to include the `pageNumber` parameter to specify which page you want to retrieve.

Following the example above, if you want to retrieve the second page of results, your XML payload should look like this:

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>inquireTransactions</command>
        <inquireTransactions>
            <terminalNumber>{terminalNumber}</terminalNumber>
            <resultType>Paging</resultType>
            <pageNumber>2</pageNumber>
            <queryResultId>2508051631_3b83b4</queryResultId>
        </inquireTransactions>
    </request>
</ashrait>
```

The response will deliver 50 more results, and the `totals` element will still provide pagination information, including the current page number, total pages, and total matches:

```xml
<totals>
    <pageNumber>2</pageNumber>
    <pagesAmount>6</pagesAmount>
    <queryResultId>2508051631_3b83b4</queryResultId>
    <total>50</total>
    <totalMatch>284</totalMatch>
</totals>
```

You can continue to request additional pages by incrementing the `pageNumber` parameter until you reach the last page, as indicated by the `pagesAmount` value in the `totals` element.

If you attempt to specify a page that is beyond the total number of pages, the API will return a response with an empty `transactions` element.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.hyp.co.il/creditguard/inquiring-transactions/inquire-transactions-with-pagination.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
