# Search methods pagination

Starting with 2Checkout API 5.0, search methods are including the option of pagination. Pagination has been developed for decreasing the request loading time, while allowing you to better handle the returning responses.

<details>

<summary>How it works?</summary>

Pagination works on **all** the search methods existing on 2Checkout API 5.0. The default pagination behavior is to display page 1 with 10 results. The maximum number of items displayed on a single page is 200.

</details>

## Request parameters <a href="#parameters" id="parameters"></a>

To use pagination, include the `Pagination` object inside the search method call, using the parameters below:

<table><thead><tr><th width="175.5999755859375">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Pagination</code></td><td><strong>Object</strong><br>Details below.</td></tr><tr><td><code>Pagination.Page</code></td><td><strong>Int</strong><br>Set the number of pages that should be returned.</td></tr><tr><td><code>Pagination.Limit</code></td><td><strong>Int</strong><br>Set a limit for the number of results that should be returned.</td></tr></tbody></table>

### Request sample

The below PHP sample includes a search method for subscriptions.

```php
<?php

require('PATH_TO_AUTH');

$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail  = 'email@avangate.com';
$SubscriptionSearch->DeliveredCode = null;
$SubscriptionSearch->AvangateCustomerReference = null;
$SubscriptionSearch->ExternalCustomerReference = null;
$SubscriptionSearch->Aggregate = false;
$SubscriptionSearch->SubscriptionEnabled = null; //true false null
$SubscriptionSearch->RecurringEnabled = null; // true - autorenewal, false - manual renewal, null = both(default)
$SubscriptionSearch->ProductCodes = null; //array('Product_Code1', 'Product_Code2');
$SubscriptionSearch->CountryCodes = null;//array ('au')
$SubscriptionSearch->PurchasedAfter = null;
$SubscriptionSearch->PurchasedBefore = null;
$SubscriptionSearch->ExpireAfter = null;
$SubscriptionSearch->ExpireBefore = null;
$SubscriptionSearch->LifetimeSubscription = null;
$SubscriptionSearch->Type = 'regular'; //'trial', 'regular', 'regularfromtrial'
$SubscriptionSearch->TestSubscription = null; // true, false, null = both(default)
$SubscriptionSearch->Pagination = new stdClass();
$SubscriptionSearch->Pagination->Page = 1; // set the number of pages for the response
$SubscriptionSearch->Pagination->Limit = 200; // set the limit for the values from the response

$jsonRpcRequest = array (
'method' => 'searchSubscriptions',
'params' => array($sessionID, $SubscriptionSearch),
'id' => $i++,
'jsonrpc' => '2.0');

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
```

## Response parameters <a href="#response" id="response"></a>

The response of search methods that are including pagination will contain a new object, with the following parameters:

<table><thead><tr><th width="176.666748046875">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Pagination</code></td><td><strong>Object</strong><br>Details below</td></tr><tr><td><code>Pagination.Page</code></td><td><p><strong>Int</strong></p><p>Set the number of pages that should be returned.</p></td></tr><tr><td><code>Pagination.Limit</code></td><td><strong>Int</strong><br>Set a limit for the number of results that should be returned.</td></tr><tr><td><code>Pagination.Count</code></td><td><strong>Int</strong><br>Number of total results returned</td></tr></tbody></table>


---

# 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://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/search-methods-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.
