> For the complete documentation index, see [llms.txt](https://fredhopper.gitbook.io/product-discovery/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fredhopper.gitbook.io/product-discovery/sending-and-managing-product-data/what-is-the-items-api/working-with-items/item-schema/migration-from-fhr-data-api.md).

# Data Types in the Items API

If you are onboarding on Fredhopper or migration from previous FHR DATA API based on CSV or JSON files, please follow mapping below how to represent Fredhopper data types in the items API.

## FHR to Items API data type mapping

{% tabs %}
{% tab title="Mapping" %}
{% hint style="danger" %}
***categories*** attribute *(i.e.* **hierarchical** type) is mandatory on parent item creation (POST operation) and contains a list of item's leaf category ids.
{% endhint %}

| FHR          | Items API     | Translatable |
| ------------ | ------------- | ------------ |
| int          | INTEGER       | ✘            |
| float        | FLOAT         | ✘            |
| text         | TEXT          | ✘            |
| asset        | LOCALIZEDTEXT | ✔            |
| list/list64  | OBJECT        | ✔            |
| set/set64    | OBJECTLIST    | ✔            |
| hierarchical | LIST          | ✔            |
| {% endtab %} |               |              |

{% tab title="Examples Multi-locale catalog" %}
**INTEGER (FHR&#x20;*****int)***

```javascript
{
    "attributes": {
        "in_stock": 1
    }
}
```

**FLOAT (FHR&#x20;*****float)***

```javascript
{
    "attributes": {
        "price": 33.3
    }
}
```

**TEXT (FHR&#x20;*****text)***

```javascript
{
    "attributes": {
        "_imageurl": "https://example.com/media/main_img.jpg"
    }
}
```

**LOCALIZEDTEXT (FHR&#x20;*****asset)***

```javascript
{
    "attributes": {
        "display_name": {
            "en_GB": "World Cup Boots",
            "fr_FR": "Chaussures World Cup"
        }
    }
}
```

**OBJECT (FHR&#x20;*****list/list64*****)**

```javascript
{
    "attributes": {
        "color": {
            "value_id": "red",
            "value": {
                "en_GB": "Red",
                "de_DE": "Rot"
            }
        }
    }
}
```

**OBJECTLIST (FHR&#x20;*****set/set64*****)**

```javascript
{
    "attributes": {
        "colors": [
            {
                "value_id": "red",
                "value": {
                    "en_GB": "Red",
                    "de_DE": "Rot"
                }
            },
            {
                "value_id": "blue",
                "value": {
                    "en_GB": "Blue",
                    "de_DE": "Blau"
                }
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Fredhopper requires for localisable attributes the locale to be sent, even if the catalogue contains only a single locale
{% endhint %}

### Attribute type Object/ObjectList

The attribute type Object and ObjectList must have the following structure and be set at the root level of the schema or variant:

```json
[
    {
        "name": {attribute_name},
        "type": "OBJECT" | "OBJECTLIST",
        "attributes": [
            { "name": "value", "type": "LOCALIZEDTEXT"},
            { "name": "valueId", "type": "TEXT"}
        ]
    }
]
```

### FHR data model validation

The new items API supports a more flexible data model which may not always be supported by the Fredhopper platform. The query parameter fhrValidation=true can be added to enforces Fredhopper specific validation to the schema API, the category API and the items API to ensure all the data can correctly be indexed.
