# Advanced headless integration using the API

For full control and flexibility, you can retrieve recommendations directly from the **Recommendations API**. This approach is ideal for headless architectures or native apps, or CRM-integrated environments where you want to manage the rendering fully on your side.

## Advanced headless integration s**etup**

{% stepper %}
{% step %}

### **Retrieve your Recommendation ID (RECO\_ID)**

1. Go to your **Recommendations**  tab in the AB Tasty platform.
2. In the list, locate your recommendation
3. Locate the ID on the line and copy it.

You’ll use this ID in your API requests.
{% endstep %}

{% step %}

### **Make your API request**

You can now call the **Recommendations API** to retrieve product recommendations associated with your `RECO_ID`.

**Recommendation request example :**

<pre class="language-bash"><code class="lang-bash"><strong>GET https://uc-info.eu.abtasty.com/v1/reco/[SITE_ID]/recos/[RECO_ID]?variables=[VARIABLES]&#x26;fields=[FIELDS]
</strong></code></pre>

<table><thead><tr><th>Parameter</th><th width="295.9453125">Description</th><th>Exemple</th></tr></thead><tbody><tr><td><code>RECO_ID</code></td><td>The unique identifier of your recommendation (copied from the platform).</td><td><code>5a936bc0-fbd1-4048-81a8-b94da73178e2</code></td></tr><tr><td><code>SITE_ID</code></td><td>Your AB Tasty site identifier.</td><td><code>952</code></td></tr><tr><td><code>VARIABLES</code></td><td>JSON-encoded dynamic variables used by the recommendation</td><td><code>JSON.stringify({</code><br><code>"viewing_item": "46857036202293",</code><br><code>"viewed_items": [</code><br><code>"46855642644789"</code><br><code>]</code><br><code>})</code></td></tr><tr><td><code>FIELDS</code></td><td>Optional JSON-encoded fields to retrieve from the query. By default, only id.</td><td><code>JSON.stringify([ "img_link", "id", "price", "catalog_page_path", "name", "revenues_last_30_days" ])</code></td></tr></tbody></table>
{% endstep %}

{% step %}

### **Handle the API response**

The API will return a list of recommended products based on the selected strategy and context.

**Response example:**

```json
{
  "queryRecosApi": {
    "name": "n/a",
    "items": [
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/retroviseur-vicma-reversible-m10-rond-o116-noir.jpg?v=1695221168",
        "id": "46857073852725",
        "price": 15,
        "category": "auto-moto",
        "name": "Rétroviseur Vicma réversible M10 rond Ø116 noir",
        "revenues_last_30_days": 135,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/retroviseur-vicma-reversible-m8-rond-noir.jpg?v=1695221665",
        "id": "46857169764661",
        "price": 15,
        "category": "auto-moto",
        "name": "Rétroviseur Vicma réversible M8 rond noir",
        "revenues_last_30_days": 45,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/3233895f998ab4914e85.00276182.jpg?v=1695219340",
        "id": "46856601403701",
        "price": 32.99,
        "category": "sport",
        "name": "Disque de Frein Shimano Deore XT SM-RT86 Noir",
        "revenues_last_30_days": 65.98,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/laine-de-silencieux-haute-temperature-doppler.jpg?v=1695221884",
        "id": "46857231860021",
        "price": 14,
        "category": "auto-moto",
        "name": "Laine de silencieux haute température Doppler 500x700x10",
        "revenues_last_30_days": 84,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/CLEAN-Packshot-Huile-Resize.jpg?v=1695205576",
        "id": "46854315442485",
        "price": 7.9,
        "category": "cosmeto",
        "name": "Huile Démaquillante Éclair",
        "revenues_last_30_days": 23.7,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/BODY-creme-corps-Packshot.jpg?v=1695205578",
        "id": "46854315770165",
        "price": 34.9,
        "category": "cosmeto",
        "name": "Crème Corps Raffermissante",
        "revenues_last_30_days": 34.9,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/TDM_W23_POCKETS_0065_FONTAINE-DU-LION.png?v=1695213737",
        "id": "46855642644789",
        "price": 12,
        "category": "maroquinerie",
        "name": "Pochette Fontaine du Lion L",
        "revenues_last_30_days": 180,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/chargeur-de-batterie-et-maintien-de-charge-sc.jpg?v=1695223277",
        "id": "46857735438645",
        "price": 30,
        "category": "auto-moto",
        "name": "Chargeur de batterie et maintien de charge Sc Power 12v 800ma",
        "revenues_last_30_days": 630,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/3701328303367_007_c9048288-25e1-42ff-b62b-6ad6521aa427.jpg?v=1695206660",
        "id": "46854474531125",
        "price": 99,
        "category": "maroquinerie",
        "name": "Reykjavik - Sac à dos - Maxi",
        "revenues_last_30_days": 1881,
        "catalog_page_path": ""
      },
      {
        "img_link": "https://cdn.shopify.com/s/files/1/0722/7578/8085/products/77d773f1-c2f9-4a1c-856e-608718daf8d1.png?v=1695214298",
        "id": "46855739441461",
        "price": 35,
        "category": "maroquinerie",
        "name": "Creamy Gin Noir",
        "revenues_last_30_days": 490,
        "catalog_page_path": ""
      }
    ]
  }
}
```

You can now use this data to display the products anywhere in your website or application — e.g. through a front-end component, mobile app, or CMS block.
{% endstep %}
{% endstepper %}

## **Tips**

* You can cache the API response to reduce load times.
* Always include contextual parameters (e.g., product category, user segment) to improve recommendation relevance.
* Combine the Recommendations API with your analytics setup to track impressions and clicks for full performance visibility.


---

# 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.abtasty.com/recommendations-and-merchandising/how-tos/how-to-deploy-a-strategy/how-to-deploy-a-recommendation-strategy-on-web/advanced-headless-integration-using-the-api.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.
