> For the complete documentation index, see [llms.txt](https://help.citrusad.com/retail-media-interface/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.citrusad.com/retail-media-interface/integration/fr/data-api/api-overview/ad-generation-filtering-1.md).

# Filtrage de la génération d'annonces

Lors de la demande d'annonces, vous devez viser à prendre en charge le filtrage de votre client par marque, catégories, restrictions alimentaires, et plus encore. Si votre site d'e-commerce prend en charge le filtrage qui utilise la fonctionnalité et/ou, Epsilon Retail Media peut prendre cela en charge avec le paramètre supplémentaire `filterMode` dans votre requête.

Il existe deux types de filtrage, comme décrit ci-dessous.

## `andOr` filtrage (recommandé)

`andOr` le filtrage est utile pour les contextes où l'utilisateur a filtré profondément dans sa recherche. Il permet un formatage de contexte plus simple, tout en prenant en charge le filtrage profond. Cette méthode suit la structure décrite ci-dessous :

```json
"productFilters": [
     [ "" OR "" ] AND [ "" OR "" ] AND [ "" OR "" ]
    ],
    "options": {
     "filterMode": "AndOr"
    },
```

Une requête d'exemple ressemble à ce qui suit :

```http
POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9",
    "placement": "category",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [
     	 ["category:bread"],
    	 ["brand:brandA","brand:brandB"],
    	 ["price:below $10"],
    	 ["nutrition:organic","nutrition:vegan"]
    ],
    "options": {
   							 "filterMode": "AndOr"
 							 },
    "maxNumberOfAds": 3
}
```

Cette approche est généralement plus facile pour les distributeurs pour enchaîner les requêtes par type lorsque les clients filtrent profondément dans leurs recherches.

{% hint style="warning" %}
Vous devez spécifier le `filterMode` of `andOr` pour que cette fonctionnalité fonctionne correctement.
{% endhint %}

## `orAnd` filtrage (mode par défaut)

La méthode par défaut de filtrage des filtres de produits suit la structure décrite ci-dessous :

```json
"productFilters": [
     [ "" AND "" ], OR [ "" AND "" ], OR [ "" AND "" ]
    ],
    "options": {
     "filterMode": "OrAnd"
    },
```

Le même exemple présenté ci-dessus serait envoyé sous forme de requête comme ci-dessous :

```http
POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9",
    "placement": "category",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [
     	 ["category:bread","brand:brandA","price:below $10","nutrition:organic"],
     	 ["category:bread","brand:brandB","price:below $10","nutrition:organic"],
     	 ["category:bread","brand:brandA","price:below $10","nutrition:vegan"],
     	 ["category:bread","brand:brandB","price:below $10","nutrition:vegan"],
    ],
    "options": {
   							 "filterMode": "OrAnd"
 							 },
    "maxNumberOfAds": 3
}
```

{% hint style="info" %}
Vous n'avez pas besoin de spécifier un `filterMode` of `orAnd` pour cette fonctionnalité, car il s'agit du comportement par défaut.
{% endhint %}


---

# 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 dynamically by asking a question.

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

```
GET https://help.citrusad.com/retail-media-interface/integration/fr/data-api/api-overview/ad-generation-filtering-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
