
A validation endpoint is available for:
- testing if the syntax of your IQL query is correct.
- previewing the results of the IQL (function results, actual values of context attributes).
- checking examples of items which match the IQL query.
- checking if a particular item matches the IQL query.


  <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

  This article presents one request example. For a complete list of all available options and response parameters, see the [API reference](https://developers.synerise.com/AISuite/AISuite.html#operation/ValidateItemFilter).

  </div></div></div>

## Request


<pre><code class="language-plaintext">curl --location --request POST 'https://api.synerise.com/items/v2/filter/validate?itemsCatalogId=default' \
--header 'authorization: Bearer eyJhbG...66Wr4' \
--header 'Content-Type: application/json' \
--data-raw '{
    "filteringString": "IF(\"vip\" IN client.tags, discount &gt; context.discount, discount == 0)",
    "contextItems": ["549"],
    "candidateItems": ["302","413"],
    "clientUUID": "516e431d-c6d9-488e-b184-f8b15f93baeb"
}'</code></pre>


where
- `itemsCatalogId=default` is the ID of the item feed which is the source for items tested by the query
- `filteringString` is the complete IQL query (note the escaped quotes in the query)
- `contextItems` is an array of context items, in this case it's one item
- `candidateItems` is an array of items to test against the `filteringString`
- `clientUUID` is the identifier of the context profile

## Response


<pre><code class="language-json">{
    "filteringString": "IF(\"vip\" IN client.tags, discount &gt; context.discount, discount == 0)",
    "contextItems": [
        "549"
    ],
    "clientUUID": "516e431d-c6d9-488e-b184-f8b15f93baeb",
    // informs if the IQL syntax (and only the syntax) is valid:
    "parserResult": {
        // processed filtering string:
        "parsedFilteringString": "IF(\"vip\" IN client.tags THEN discount &gt; context.discount ELSE discount == 0.0)",
        "valid": true
    },
    // summary of context values used in the query. Details are available in the API reference.
    "extracts": {
        "clientExtracts": {
            "aggregateConstants": [],
            "attributeConstants": [],
            "expressionConstants": [],
            "segmentationsConstant": [],
            "tagsConstant": true
        },
        "contextConstants": [
            "discount"
        ],
        "variables": [
            "discount"
        ]
    },
    // results of running the query in context of the item feed and its configuration:
    "evaluationResult": {
        "evaluationErrors": [],
        // fully processed filtering string, with inserted values of context attributes:
        "modifiedFilteringString": "IF(\"vip\" IN [documentation,test,example] THEN discount &gt; 0.0 ELSE discount == 0.0)",
        // the number of matching items:
        "resultsSize": 584
    },
    // results of checking particular items against the filter:
    "candidateItems": [
        {
            "itemId": "302",
            "valid": false
        },
        {
            "itemId": "413",
            "valid": true
        }
    ],
    // an array of example items which matched the filter:
    "exampleItems": [
        "100",
        "356",
        "257",
        "377",
        "358",
        "297",
        "136",
        "514",
        "196",
        "404"
    ]
}</code></pre>


