Feed and schema reference

If your shop isn't connected to Motive through one of the Motive plugins, Motive indexes your catalogue from two files for each language:

  • Feed: The list of your products, in Google Shopping format (Merchant Center XML) or Motive format (JSON).
  • Schema: A JSON file that tells Motive where each piece of data is in the feed and what it is, such as the name, price, or image. See Schema.

You publish the feed at a public URL that Motive can access and enter it when you add each catalogue in the setup wizard. Motive downloads it every time it synchronises your catalogue.

You can define the schema in the setup wizard, and Motive creates it for you. If you create it yourself, publish it at a public URL too, and enter it in Use a schema URL. To learn more, see Install Motive on other platforms.

warning

The schema doesn't transform the feed. It only describes it. Each path must point to data that exists exactly as written in the feed.

Schema

The schema works the same way for both feed formats. This section describes its structure and the rules that apply to any feed. For specific instructions and complete examples for each format, see Google Shopping format (XML) and Motive format (JSON).

The schema is a JSON object with three keys:

  • metadata: Tells Motive how to read the feed.
  • fields: Lists the product fields and where each one is in the feed.
  • product_labels: Sets the text of the product labels.

Only fields is required. Motive ignores any other key, such as shop, lang, currency, version, or labels. You can keep them for reference, but they have no effect.

This is the basic structure of a schema:

{
  "metadata": {
    "feed": {
      "format": "XML",
      "type": "GOOGLE_SHOPPING_FEED",
      "tag": "item"
    }
  },
  "fields": [
    { "id": "id",   "type": "id",   "path": "id" },
    { "id": "name", "type": "name", "path": "title", "label": "Name", "features": { "searchable": true } }
  ],
  "product_labels": []
}
Key Required Description Default
metadata.feed Recommended How to read the feed: format, type, product element, variant grouping, and categories. See Metadata. The default value of each key
fields Yes List of product fields. See Fields. —
product_labels No Text of the product labels.
Example: [{ "id": "on-sale", "text": "On sale" }]
None. If you don't define in-stock or out-of-stock, Motive adds them based on availability: in-stock if the product can be ordered, and out-of-stock if it can't be ordered and has no stock.

Metadata

The metadata.feed object tells Motive how to read your feed: the file format, the conventions it follows and where each product is. You can also use it to group Variants and to change how categories are split.

For example, this metadata reads a Google Shopping feed in XML, where each product is an <item> element and variants share item_group_id:

"metadata": {
  "feed": {
    "format": "XML",
    "type": "GOOGLE_SHOPPING_FEED",
    "tag": "item",
    "groupBy": "item_group_id"
  }
}
Key Values Description Default
format XML
JSON
JSONL
How Motive reads the file. Always set it: if the feed URL has no file extension, Motive can't read the feed. Taken from the URL extension (.xml, .json, .jsonl)
type GOOGLE_SHOPPING_FEED
MOTIVE
Conventions the feed follows:
GOOGLE_SHOPPING_FEED: Google values, such as in_stock and out_of_stock for availability, and > as the category separator.
MOTIVE: Motive values, such as true and false for availability, and \|> as the category separator.
Motive conventions (same as MOTIVE)
tag Text XML: Name of the element for each product (item in Google Shopping feeds).
JSON: Name of the product array inside the root object.
Not used in JSONL.
XML: product
JSON: products
groupBy Text Only with GOOGLE_SHOPPING_FEED. Groups the Variants of a product by this attribute, usually item_group_id. See Variants. No grouping: each item is a product
category Object Changes how Motive splits categories. See Categories. The rules of the feed type

Fields

The fields array lists the product fields that Motive uses. Each field says what a piece of data is, with its type, and where it is in the feed, with its path. You can also give it a label and set what Motive can do with it, such as search or filter by it.

For example, this field reads the brand from a Google Shopping feed, and lets shoppers search and filter by brand:

{ "id": "brand", "type": "brand", "path": "brand", "label": "Brand", "features": { "searchable": true, "facetable": true } }

In this example, id, type, and path have the same value, but each one has a different purpose: id is a name you choose for the field, type is one of the field types, and path is where the data is in the feed. They often match, but they don't have to.

Each field has these keys:

Key Required Description Default
id Yes Field ID in Motive. It must be unique and have no spaces, for example name, brand, or material. This is the field name you see in the Playboard. —
type Yes What the data represents, in lowercase. See Field types. —
path Yes Where the data is in the product. Use a dot for nested data, for example price.regular. —
label No Field name shown to shoppers, for example in filters and sorting options. No label
features No What Motive can do with the field: searchable, facetable (filter), sortable, and retrievable (returned in search results).
Example: { "searchable": true, "facetable": true }
These are initial values.
All false. See the note after this table.
fields Only for variation Fields of each Variant, with paths relative to the Variant. —

Motive always returns fields of these types in search results, even without retrievable: id, name, link, product_label, variation, variation_default, attribute, and all image, price, availability and code types, such as image_url, price_regular, availability_allow_order or code_gtin. Other fields, such as description, brand, category or text, are only returned with retrievable: true. Set it for any field you want to show on the product card.

searchable fields and filters

After the first synchronisation, you can change in the Playboard which fields shoppers can search by and which ones they can use as filters. To learn more, see Managing searchable fields and Managing filters.

warning

A misspelled type invalidates the whole schema, and synchronisation fails. Check each type against Field types.

Field types

The type of each field tells Motive what the data represents, so it can search, filter, and display it correctly. For example, with price_regular, Motive reads the value as a price, and with brand, as the product brand.

The following types are required. The fields array must include one field for each of these six pieces of data. Where two types are listed, you only need one of them. If one is missing, Motive rejects the schema.

  • Identifier: id
  • Name: name
  • Product URL: link
  • Price: price_regular or price
  • Image: image_url or image
  • Availability: availability_allow_order or availability

For example, this fields array includes all the required types for a Google Shopping feed:

"fields": [
  { "id": "id", "type": "id", "path": "id" },
  { "id": "name", "type": "name", "path": "title" },
  { "id": "url", "type": "link", "path": "link" },
  { "id": "price_regular", "type": "price_regular", "path": "price" },
  { "id": "image_url", "type": "image_url", "path": "image_link" },
  { "id": "availability_allow_order", "type": "availability_allow_order", "path": "availability" }
]

Here, the product URL field shows that id, type, and path can differ: its ID is url, its type is link, and its path is link.

All other types are optional. This table lists all the types you can use:

Type Required Value in the feed Notes
id Yes Text Must be unique for each product. If an ID is repeated, the product appears twice in search results.
name Yes Text
description No Text
link Yes URL
image_url Yes, or image URL or list of URLs Can be repeated. Motive joins all images in the order you declare them. The first one is the main image.
image_alt No Text or list Alternative text. If there's none, Motive uses the product name.
image Yes, or image_url List of { "url", "alt" } Motive format: all images in one field.
price_regular Yes, or price Number, or text with a number (19.99, "19,99 EUR") Price without discount. Don't use a thousands separator: with 1.299,99 EUR, the product has no price.
price_on_sale No Same as price_regular Discounted price, if any.
price Yes, or price_regular Object { "regular", "on_sale" } Motive format: the price in one field.
availability_allow_order Yes, or availability Google: in_stock, out_of_stock, preorder, backorder, also with a space (in stock).
Motive: true or false
Whether the product can be ordered.
availability_stock No Google: the same values, which count as 1 or 0.
Motive: number
Units in stock.
availability Yes, or availability_allow_order Object { "stock", "allow_order" } Motive format: availability in one field.
category No Text or list of texts See Categories.
brand No Text
code_mpn, code_gtin, code_isbn, code_upc, code_reference, code_ean13 No Text Product codes. Useful as searchable.
code No Object with the codes above Motive format: all codes in one field.
color No Object { "name", "hex" }
text No Text Any extra text, such as material or tags.
attribute No Text Product or variant attribute, such as size or colour. Usually facetable.
boolean No true or false
long, double No Number Integers and decimals.
product_label No List of { "id", "text" } Labels shown on the product card.
variation No List of variants See variants and Motive format.
variation_default No true or false Inside variation: marks the variant shown by default.

These types can only appear once: id, name, description, link, image, category, availability, variation, brand, and all price and code types, such as price_regular or code_gtin. Generic types (text, attribute, boolean, etc.) and image_url can appear more than once, each with its own id.

Categories

The category value is a path of nested categories, from the most general level to the most specific:

  • Google Shopping: Levels separated by >.
    Example: Home > Kitchen > Frying pans
  • Motive: Levels separated by |>. Each level can include an ID, separated by |.
    Examples: 2|Home|>3|Clothes|>4|Men, Home|>Clothes|>Men

If your feed follows these formats, you don't need to add anything to the schema. If it uses other separators, or includes several categories in the same text, declare the separators in metadata.feed.category:

"category": { "treeSeparator": "/", "categorySeparator": "#", "arraySeparator": "," }
Key Description Default
treeSeparator Separates levels, for example Home/Kitchen/Frying pans. \|>
categorySeparator Separates the ID from the name in each level, for example 12#Kitchen. Leave it out if your categories have no IDs. No IDs: each level is only the name
arraySeparator Separates several categories in the same text, for example Home/Kitchen,Offers. Each value is a single category

warning

The category block replaces the rules of the feed type, including in Google Shopping feeds. The defaults in this table are the defaults of the block. For example, in a Google Shopping feed with a category block but no treeSeparator, levels are separated by |>, not by >. If you add the block, declare every separator your feed uses.

Google Shopping format (XML)

This is the feed your shop already generates for Google Merchant Center. Most ecommerce platforms can export it.

This feed is an XML file in RSS format. Each product is an <item> element, and its attributes use the g: prefix. For example, this feed has one product:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
  <channel>
    <title>My shop</title>
    <link>https://www.myshop.com</link>
    <description>Product feed</description>
    <item>
      <g:id>1</g:id>
      <g:title>Printed T-shirt</g:title>
      <g:description>Cotton T-shirt…</g:description>
      <g:link>https://www.myshop.com/printed-t-shirt</g:link>
      <g:image_link>https://www.myshop.com/img/1.jpg</g:image_link>
      <g:additional_image_link>https://www.myshop.com/img/2.jpg</g:additional_image_link>
      <g:price>28.68 EUR</g:price>
      <g:sale_price>22.94 EUR</g:sale_price>
      <g:availability>in_stock</g:availability>
      <g:product_type>Home > Clothes > Men</g:product_type>
      <g:brand>Studio Design</g:brand>
      <g:mpn>TS-001</g:mpn>
      <g:gtin>8412345678905</g:gtin>
    </item>
  </channel>
</rss>

google shopping feed specification

To learn about each attribute, see the Google Merchant Center product data specification (opens new window).

To index this feed, Motive needs a schema that describes it. The schema follows the same structure as for any feed, but with values specific to Google Shopping: the feed metadata and the path of each Google attribute. The following subsections explain how to set them, with complete examples for products with and without variants.

Schema metadata

For a Google Shopping feed, set the format to XML and the type to GOOGLE_SHOPPING_FEED. Because each product in the feed is an <item> element, set the tag to item. Use this metadata in your schema:

"metadata": {
  "feed": { "format": "XML", "type": "GOOGLE_SHOPPING_FEED", "tag": "item" }
}

If your feed includes variants, also add groupBy. See Variants.

Schema paths

In the schema, write each path with the name of the Google attribute, but without the g: prefix. The feed keeps the prefix. For example, for <g:title> in the feed, use "path": "title" in the schema, and for <g:price>, use "path": "price".

This table shows the type and path to use in the schema for the most common Google attributes:

Google attribute type path
g:id id id
g:title name title
g:item_group_title name (instead of g:title, when you group variants and want one product name for all of them) item_group_title
g:description description description
g:link link link
g:image_link image_url image_link
g:additional_image_link image_url (a second field) additional_image_link
g:price price_regular price
g:sale_price price_on_sale sale_price
g:availability availability_allow_order availability
g:product_type category product_type
g:brand brand brand
g:mpn code_mpn mpn
g:gtin code_gtin gtin
g:color, g:size, g:material, etc. attribute or text color, size, material, etc.

Schema example

This is a complete schema for a Google Shopping feed, such as the feed example above. It reads the most common attributes, but doesn't group variants. To learn how to group them, see Variants.

{
  "metadata": {
    "feed": { "format": "XML", "type": "GOOGLE_SHOPPING_FEED", "tag": "item" }
  },
  "fields": [
    { "id": "id", "type": "id", "path": "id" },
    { "id": "name", "type": "name", "path": "title", "label": "Name", "features": { "searchable": true } },
    { "id": "description", "type": "description", "path": "description", "label": "Description", "features": { "searchable": true } },
    { "id": "url", "type": "link", "path": "link" },
    { "id": "image_url", "type": "image_url", "path": "image_link" },
    { "id": "image_url_additional", "type": "image_url", "path": "additional_image_link" },
    { "id": "price_regular", "type": "price_regular", "path": "price", "label": "Price", "features": { "facetable": true, "sortable": true } },
    { "id": "price_on_sale", "type": "price_on_sale", "path": "sale_price", "label": "Sale price", "features": { "facetable": true, "sortable": true } },
    { "id": "availability_allow_order", "type": "availability_allow_order", "path": "availability", "label": "Availability" },
    { "id": "categories", "type": "category", "path": "product_type", "label": "Categories", "features": { "searchable": true, "facetable": true } },
    { "id": "brand", "type": "brand", "path": "brand", "label": "Brand", "features": { "searchable": true, "facetable": true } },
    { "id": "code_mpn", "type": "code_mpn", "path": "mpn", "label": "Code", "features": { "searchable": true } },
    { "id": "code_gtin", "type": "code_gtin", "path": "gtin", "label": "EAN", "features": { "searchable": true } }
  ]
}

Hiding products that are out of stock

If you hide products that can't be ordered in the Playboard, Motive uses availability_allow_order and hides products with out_of_stock. To also hide products with no stock (preorder and backorder), add this field:

In the Playboard, you can hide products that can't be ordered or have no stock. In a Google Shopping feed, Motive takes both from the g:availability attribute, and which products it hides depends on the fields in your schema:

  • Products that can't be ordered: Products with out_of_stock. Motive uses the availability_allow_order field, which is already required in your schema:

    { "id": "availability_allow_order", "type": "availability_allow_order", "path": "availability" }
    
  • Products with no stock: Products with out_of_stock, preorder or backorder. Keep the availability_allow_order field, and add an availability_stock field that reads the same attribute:

    { "id": "availability_stock", "type": "availability_stock", "path": "availability" }
    

    This field only works in feeds without groupBy.

Variants

Variants are versions of the same product that differ in one or more attributes, such as size or colour. For example, a T-shirt available in black, white, and brown has three variants.

In Google Shopping feeds, each variant is a separate <item>, and variants of the same product share g:item_group_id. To show them as one product with variants:

  1. In metadata.feed, add "groupBy": "item_group_id".
  2. Add a variation field with the data specific to each variant. Its paths are attributes of the variant's <item>.
  3. To use one product name for all the variants of a product, set the path of the name field to item_group_title, and include g:item_group_title in each item of the feed, with the same value for all the items that share an item_group_id. This is useful if the title of your items includes variant details, such as the size or colour, that you don't want to show on the product card.

{
  "metadata": {
    "feed": { "format": "XML", "type": "GOOGLE_SHOPPING_FEED", "tag": "item", "groupBy": "item_group_id" }
  },
  "fields": [
    { "id": "id", "type": "id", "path": "id" },
    { "id": "name", "type": "name", "path": "item_group_title", "features": { "searchable": true } },
    { "id": "link", "type": "link", "path": "link" },
    { "id": "image_url", "type": "image_url", "path": "image_link" },
    { "id": "price_regular", "type": "price_regular", "path": "price", "features": { "facetable": true, "sortable": true } },
    { "id": "price_on_sale", "type": "price_on_sale", "path": "sale_price" },
    { "id": "availability_allow_order", "type": "availability_allow_order", "path": "availability" },
    { "id": "category", "type": "category", "path": "product_type", "features": { "searchable": true, "facetable": true } },
    { "id": "brand", "type": "brand", "path": "brand", "features": { "searchable": true, "facetable": true } },
    {
      "id": "variation", "type": "variation", "path": "variation",
      "fields": [
        { "id": "v_id", "type": "id", "path": "id" },
        { "id": "v_price_regular", "type": "price_regular", "path": "price", "features": { "facetable": true, "sortable": true } },
        { "id": "v_price_on_sale", "type": "price_on_sale", "path": "sale_price" },
        { "id": "v_availability_allow_order", "type": "availability_allow_order", "path": "availability" },
        { "id": "v_image_url", "type": "image_url", "path": "image_link" },
        { "id": "size", "type": "attribute", "path": "size", "features": { "searchable": true, "facetable": true } },
        { "id": "color", "type": "attribute", "path": "color", "features": { "searchable": true, "facetable": true } }
      ]
    }
  ]
}

When Motive groups variants into one product:

  • The product id is the value of item_group_id. Shared data, such as the name, description, and brand, comes from the first item in the group.
  • The product price is the price of the cheapest variant. If variants have different prices, the price is shown as "from".
  • The product can be ordered if any variant can be ordered.
  • An item without item_group_id stays a regular product.

Use groupBy only if your feed has real groups, that is, several items with the same item_group_id. If each item has its own group, groupBy adds nothing and replaces the id of every product with the group ID.

Motive format (JSON)

This is Motive's own format. Use it if you can export your catalogue as a custom JSON file. Compound data, such as price, availability, images, and codes, is grouped in objects, and variants are nested inside each product.

This feed is a JSON object with an array of products. By default, the array is called products. If it has another name, set it in tag. The array can't be the root of the file. To have one product per line, use JSONL. For example, this feed has one product with one variant:

{
  "products": [
    {
      "id": "1",
      "name": "Printed T-shirt",
      "description": "Cotton T-shirt…",
      "url": "https://www.myshop.com/printed-t-shirt",
      "images": [
        { "url": "https://www.myshop.com/img/1.jpg", "alt": "Printed T-shirt" },
        { "url": "https://www.myshop.com/img/2.jpg" }
      ],
      "price": { "regular": 28.68, "on_sale": 22.94 },
      "availability": { "stock": 2400, "allow_order": true },
      "category": ["2|Home|>3|Clothes|>4|Men"],
      "code": { "reference": "demo_1", "gtin": "8412345678905" },
      "brand": "Studio Design",
      "material": "Cotton",
      "variation": [
        {
          "id": "1-S",
          "is_default": true,
          "price": { "regular": 28.68 },
          "availability": { "stock": 10, "allow_order": true },
          "size": "S"
        }
      ]
    }
  ]
}

To index this feed, Motive needs a schema that describes it. The schema follows the same structure as for any feed, but with values specific to Motive format: the feed metadata, the path of each key and the variants. The following subsections explain how to set them.

Schema metadata

For a Motive feed, set the format to JSON and the type to MOTIVE. Set the tag to the name of the product array, products by default. If your feed has one product per line, set the format to JSONL and leave out the tag. Use this metadata in your schema:

"metadata": {
  "feed": { "format": "JSON", "type": "MOTIVE", "tag": "products" }
}

Schema paths

In each path, use the name of the key in the feed. For example, for "name" in the feed, use "path": "name" in the schema. For nested data, separate the keys with a dot. For example, for the regular price inside the price object, use "path": "price.regular".

If you use an object type, such as price, availability, image, or code, the path points to the whole object. For example, "path": "price" reads both the regular and the sale price.

Schema example

This schema reads the feed in the example above. It follows the general schema rules, with the type MOTIVE and the tag products:

{
  "metadata": {
    "feed": { "format": "JSON", "type": "MOTIVE", "tag": "products" }
  },
  "fields": [
    { "id": "id", "type": "id", "path": "id" },
    { "id": "name", "type": "name", "path": "name", "features": { "searchable": true } },
    { "id": "description", "type": "description", "path": "description", "features": { "searchable": true } },
    { "id": "url", "type": "link", "path": "url" },
    { "id": "images", "type": "image", "path": "images" },
    { "id": "price", "type": "price", "path": "price", "features": { "facetable": true, "sortable": true } },
    { "id": "availability", "type": "availability", "path": "availability" },
    { "id": "category", "type": "category", "path": "category", "features": { "searchable": true, "facetable": true } },
    { "id": "code", "type": "code", "path": "code", "features": { "searchable": true } },
    { "id": "brand", "type": "brand", "path": "brand", "features": { "searchable": true, "facetable": true } },
    { "id": "material", "type": "text", "path": "material", "label": "Material", "features": { "searchable": true, "facetable": true } },
    {
      "id": "variation", "type": "variation", "path": "variation",
      "fields": [
        { "id": "v_id", "type": "id", "path": "id" },
        { "id": "is_default", "type": "variation_default", "path": "is_default" },
        { "id": "v_price", "type": "price", "path": "price" },
        { "id": "v_availability", "type": "availability", "path": "availability" },
        { "id": "size", "type": "attribute", "path": "size", "label": "Size", "features": { "facetable": true } }
      ]
    }
  ]
}

In Motive format, you can also use the simple types, such as price_regular, image_url, or availability_allow_order, if your JSON has this data in separate fields instead of objects.

Variants

In Motive format, variants are nested inside each product, in an array. You don't need groupBy.

To describe them in the schema, add a variation field:

  • Set its path to the name of the variant array in the feed, such as variation.
  • In its fields, add the data specific to each variant, such as the ID, price, availability, and attributes. Paths in these fields are relative to each variant. For example, "path": "size" reads the size key of each variant.
  • To mark the variant shown by default, add a field of type variation_default. In the feed, set it to true for that variant.

Feed and schema checklist

Before you enter your feed and schema URLs in the setup wizard, check that both files:

  • Are available at public URLs.
  • Have URLs no longer than 255 characters, so pre-signed URLs don't fit.

Then, check each file:

Feed

  • Product IDs aren't repeated.
  • Prices don't include a thousands separator.
  • In Google Shopping feeds, availability is in_stock, out_of_stock, preorder, or backorder. Any other value, such as available for order, makes synchronisation fail.
  • In Google Shopping feeds with variants, several items share each item_group_id.
  • In Google Shopping feeds with variants and one product name for all of them, each item includes g:item_group_title.

Schema

  • The schema is valid JSON, and every type is in Field types.
  • The schema includes the required fields: id, name, link, price, image, and availability.
  • metadata.feed.format is set. Don't rely on the URL extension.
  • Each field id is unique and has no spaces.
  • Each path exists in the feed. In Google Shopping feeds, paths don't include the g: prefix.
  • In feeds with variants, the variation field includes the data specific to each variant.

Validating your files

You can also check your files automatically. Motive provides two optional validation files in JSON Schema (opens new window) format:

  • Schema validation file: Checks the structure of your schema, its field types, and its required fields. It works with both feed formats. Find it at https://docs.motive.co/schemas/motive-schema.json.

  • Motive feed validation file: Checks a feed in Motive format that uses the same key names as the Motive format example. Find it at https://docs.motive.co/schemas/motive-feed.json.


For Google Shopping feeds, Google Merchant Center checks your feed and shows any errors.

To validate a file in your code editor, such as Visual Studio Code, add a $schema key with the URL of its validation file at the start of the file. Your editor then checks the file and suggests valid keys and values as you write. Motive ignores this key when it reads your files.

For example, at the start of your schema:

{
  "$schema": "https://docs.motive.co/schemas/motive-schema.json",
  "metadata": {
    "feed": { "format": "XML", "type": "GOOGLE_SHOPPING_FEED", "tag": "item" }
  },
  "fields": [ … ]
}

If you use an AI coding assistant to create your schema or feed, give it the URL of the validation file so it can check the result.

The validation files don't check that each path exists in your feed, or the values in your feed. Use the checklist above for those checks.

validation files

To check your schema and your Motive feed automatically, open the schema validation file or the Motive feed validation file.