> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/upsell/search-upsell-campaigns.md).

# Search upsell campaigns

Use the **searchUpsellCampaigns** method via JSON-RPC API 6.0 to find and filter specific upsell campaigns.

## Request parameters

<table><thead><tr><th width="227.86669921875">Parameter Name</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>SessionId</code></td><td><p><strong>Required (string)</strong></p><p>Unique 2Checkout session ID code.</p></td></tr><tr><td><code>Name</code></td><td><p><strong>Optional (string)</strong></p><p>Title of the campaign.</p></td></tr><tr><td><code>PrimaryProductCodes</code></td><td><p><strong>Optional (array of strings)</strong></p><p>Array of product codes used as primary products you want to filter by.</p></td></tr><tr><td><code>PrimaryProductCode</code></td><td><p><strong>Optional (string)</strong></p><p>Unique product code.</p></td></tr><tr><td><code>RecommendedProductCodes</code></td><td><p><strong>Optional (array of strings)</strong></p><p>Array of product codes used as recommended products you want to filter by.</p></td></tr><tr><td><code>RecommendedProductCode</code></td><td><p><strong>Optional (string)</strong></p><p>Unique product code.</p></td></tr><tr><td><code>Statuses</code></td><td><p><strong>Optional (array of strings)</strong></p><p>Array of statuses you want to filter by.</p></td></tr><tr><td><code>Status</code></td><td><p><strong>Optional (string)</strong></p><p>Status of the upsell campaign. Enum can be one of: Enabled, Disabled, Expired</p></td></tr><tr><td><code>StartsAfter</code></td><td><p><strong>Optional (string)</strong></p><p>Date in ‘Y-m-d’ format after which campaigns start.</p></td></tr><tr><td><code>StartsBefore</code></td><td><p><strong>Optional (string)</strong></p><p>Date in ‘Y-m-d’ before campaigns start.</p></td></tr><tr><td><code>EndsAfter</code></td><td><p><strong>Optional (string)</strong></p><p>Date in ‘Y-m-d’ after which campaigns are ending.</p></td></tr><tr><td><code>EndsBefore</code></td><td><p><strong>Optional (string)</strong></p><p>Date in ‘Y-m-d’ before campaigns end.</p></td></tr><tr><td><code>EnabledForRenewals</code></td><td><p><strong>Optional (boolean)</strong></p><p>Filter campaigns enabled for renewal.</p></td></tr><tr><td><code>CampaignCodes</code></td><td><p><strong>Optional (array of strings)</strong></p><p>Array of campaign codes to filter by.</p></td></tr><tr><td><code>CampaignCode</code></td><td><p><strong>Optional (string)</strong></p><p>Unique code for an upsell campaign.</p></td></tr><tr><td><code>Page</code></td><td><p><strong>Optional (integer)</strong></p><p>Page you want to retrieve.</p></td></tr><tr><td><code>Limit</code></td><td><p><strong>Optional (integer)</strong></p><p>Maximum number of campaigns per page.</p></td></tr></tbody></table>

### Request sample

```php
<?php
 
require ('PATH_TO_AUTH');
 
$filters = new \stdClass();
$filters->Name = 'op_2';
$filters->PrimaryProductCodes = ['A59VUKFMA2', 'JN2GSQ184L'];
$filters->RecommendedProductCodes = ['XI2MNQ41MNH'];
$filters->Statuses = ['DISABLED', 'EXPIRED'];
$filters->StartsBefore = '2020-10-01';
$filters->StartsAfter = '2019-11-05';
$filters->EndsBefore = '2022-11-10';
$filters->EndsAfter = '2020-10-02';
//$filters->EnabledForRenewals = true;
//$filters->CampaignCodes = ['8050a1b7-338e-45bd-9936-17f98b01349e'];
$filters->Page = 1;
$filters->Limit = 10;
 
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'searchUpsellCampaigns';
$jsonRpcRequest->params = array($sessionID, $filters);
$jsonRpcRequest->id = $i++;
 
try {
    $result = callRPC($jsonRpcRequest, $host);
    echo "Campaigns: </br>",
    var_dump($result);
}
catch (SoapFault $e) {
    echo "Could not fetch upsell campaigns: " . $e->getMessage();
    exit;
}
```

## Response parameters

| Parameter                                                                                     | Type / Description                                                                                          |
| --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `Page`                                                                                        | <p><strong>Required (integer)</strong></p><p>The <em>Search</em> page you are on.</p>                       |
| `Limit`                                                                                       | <p><strong>Required (integer)</strong></p><p>Maximum number of campaigns per page.</p>                      |
| `Upsells`                                                                                     | <p><strong>Required (array of strings)</strong></p><p>Array of Upsell Campaigns.</p>                        |
| `Upsells.`[`UpsellCampaign`](/json-rpc-api-reference/json-rpc-api-6.0/api-requests/upsell.md) | **Required (object)**                                                                                       |
| `UpsellsCount`                                                                                | <p><strong>Required (integer)</strong></p><p>Total number of Upsells that fit your search criteria.</p>     |
| `PagesCount`                                                                                  | <p><strong>Required (integer)</strong></p><p>Total number of pages with Upsells that fit your criteria.</p> |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/upsell/search-upsell-campaigns.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
