---
title: Overview
slug: template-js/modify-request
docTags: 
createdAt: 2022-06-02T13:18:36.000Z
---

# Modify Request

To modify a search request, the outgoing query to the indexed catalog is intercepted and any of the available [Klevu API ](https://developers.klevu.com/api) parameters are available to be inserted, or adjusted as needed.

There are two steps:

1. *Reference the API&#x20;*&#x74;o understand what parameters are available to meet the objective
2. *Attach the override* to the appropriate outgoing query (or queries)



## API Referencing

Any of the [Klevu API parameters](https://docs.klevu.com/apis/smart-search) are available to be applied as needed or otherwise to override any default values.

For example, the following snippet of an outgoing *productList* API Request assigns the value of "10" as the number of filter options to return.

:::BlockQuote
recordQueries: \[
&#x20;   \{
&#x20;     **filters**: \{
&#x20;       **filtersToReturn**: \{
&#x20;         **options**: \{
&#x20;           **limit**: **10**
&#x20;         }
&#x20;       }
&#x20;     },
&#x20;     id: "productList",
&#x20;     typeOfRequest: "SEARCH",
&#x20;     settings: \{
&#x20;       query: \{
&#x20;         term: "jackets"
&#x20;       }
&#x20;     }
&#x20;   }
&#x20; ],
:::

See : Klevu [API documentation on Retrieving Filters](https://docs.klevu.com/apis/faceting) for more details and options




## Attaching the Override

The query parameters are directly added or replaced by using the `klevu.modifyRequest` function.

:::BlockQuote
**klevu.modifyRequest**("\<scope>", "\<parameter object>", "\<parameter value>");
:::

The parameter object notation corresponds to that used in the outgoing JSON API query

For example, the following example snippet modifies the outgoing *productList* API Query by assigning the value of "20" as the number of filter options to return.

:::BlockQuote
klevu.modifyRequest("landing",
&#x20;   "**productList.filters.filtersToReturn.options.limit**",&#x20;
&#x20;   20
);
:::

Advanced `data` objects or modules can be accessed using a `callback function` as the parameter object

:::BlockQuote
klevu.modifyRequest("landing", function(data, scope)\{
&#x20;   console.log('modifyRequest data',data);
});
:::



## Determining Scope

**Note** that each `klevu.modifyRequest` function requires definition within the corresponding `scope` of the override. We will chart these below.

| Scope      | Description                                               |
| ---------- | --------------------------------------------------------- |
| all        | Applies to all scope modules                              |
| quick      | QuickSearch module                                        |
| landing    | SRLP module                                               |
| catnav     | Category module                                           |
| full\_page | Both SRLP and Category modules (same as "landing,catnav") |

:::hint{type="success"}
Multiple `klevu.modifyRequest` functions can be applied in the same or mixed scope.
:::



## Examples

Please see the Modify Request [Examples](docId\:HS9U2-i3tXfU0fhsg-AtK) section for details of common uses.





.
