Skip to main content
Every store names its colors its own way: one calls a shirt “Sage”, another “Eucalyptus”, a third “Dusty Green”. StoreRouter gives every product the same two color labels, whatever the store calls it:
  • a shade, a CSS color name such as darkseagreen, navy, or goldenrod
  • a color family, one of 12 broad colors such as green, blue, or brown
Filter on either one to find products in the color a shopper asks for, in every store or in one store. GET /v1/taxonomy/colors returns every accepted value. To see it working, open the Shop by color palette.

Three ways to ask for a color

All three are sent to POST /v1/products/search.

Put the color in the query

The simplest option is to pass the shopper’s words in q. StoreRouter reads the color as one shade and filters by it:
The color StoreRouter read from the text appears in effectiveQuery as a facet with source: "generated":
If StoreRouter reads the wrong color, send your own color or color_family facet. Either one replaces the color read from the text. To drop the color filter altogether, send "omit_generated_facets": ["color"]. See Control query understanding.

Filter by one shade

Use the color facet when you already know the exact shade, such as from a color picker or a swatch the shopper tapped:
The color facet takes CSS color names in lowercase without spaces, such as darkseagreen, navy, maroon, or ivory. There are two more values: bronze, and multi for products that have several colors. To get all 150, see List the accepted colors. A value that is not a shade name, such as "sage", returns a 422:
To find the shade for a word a shopper types, send the word in q and read the color facet from effectiveQuery.
attribute_facets.color is a separate filter. It holds taxonomy color values, such as color__navy and color__clear, which are listed at GET /v1/taxonomy/attributes/color/values. They are not shades, and sending one as a color value returns a 422. For “find this color” use cases, use color or color_family.

Filter by a color family

Use color_family when the shopper names a broad color, or when you want more results than one shade gives:
This returns limegreen, lightseagreen, and darkolivegreen shirts in the same results. There are 12 color families: white · gray · black · red · orange · brown · yellow · green · blue · purple · pink · multicolor Beige, camel, and tan are part of brown. Ivory and linen are part of white. Each shade belongs to exactly one family. For example, darkseagreen belongs to green, maroon to red, and goldenrod to yellow. To match more than one color, list several values in one facet, such as {"name": "color_family", "values": ["black", "gray"]}. To remove a color instead, send the same facet in exclude_facets.

List the accepted colors

GET /v1/taxonomy/colors returns every value the color_family and color facets accept, with each shade’s family. Use it to build a color picker, to check a value before sending it, or to give an agent the full list:
The response above is shortened: color lists all 150 shades. Every value can be sent back unchanged in a facets entry, and each shade’s colorFamily is itself a color_family value. To build a “green, then its shades” picker, keep the shades whose colorFamily is green. The list changes only when StoreRouter adds a value, so you can cache it; the response allows caching for a day. The request is not billed. Agents connected through MCP can call the taxonomy_colors tool, which returns the same list. The list says which values are valid, not which ones a store has products in. To see what’s in stock, use facet-counts.

Search one store or all of them

Leave out catalogs to search every store your key can access. Send catalogs to search only certain stores:
You can leave out q to list a store’s products in a color with no search text. Add a category facet such as category_path.depth_2 to narrow results to one kind of product.

Read each result’s color

When a search filters by color, each result is the specific color version of the product that matched, not the product in general. For example, a shirt sold in six colors comes back as its sage version, and productUrl opens the page for that color. Each result has these color fields:
primaryColor and hexCode are left out of results that don’t have them, so show a fallback swatch when they are missing. You can use the color shade or color_family instead.

Show the colors available

To build color filter chips or a palette with counts, call POST /v1/products/facet-counts. It counts the products that match each color family or each shade. It takes the same filters as search, so each count matches the results that selecting that color would return.

Count color families

Values come back in lowercase, the same form you send, so you can pass one straight back in a color_family facet. Add catalogs to count one store’s colors.

Count the shades in a family

Send color in facet_names to count shades. To count the shades of the items in one family, add that family as a facet:
The family facet selects the green items, and then every shade those items have is counted. So a green-and-white shirt also counts under white, which is not a green shade. To build a “green, then its shades” picker, keep only the values whose colorFamily is green in GET /v1/taxonomy/colors:
A few things to know about shade counts:
  • Counts are per color version. With color in facet_names, every count in the response counts the color versions of products, the same thing a color search returns.
  • Shades can add up to more than the total. A product with several shades, such as ["red", "white"], counts once under each.
  • Your own color facet is ignored. As with every counted facet, a color count ignores any color facet you send, so each shade shows what selecting it would return. Other facets, such as color_family above, still apply.
  • You get every shade by default. value_limit defaults to 150, the number of shades.
The Python and TypeScript SDKs accept color in facet_names from their next release. Until then, use the REST request above.

Tips

  • Start broad. A single shade can be narrow in a small store. If a color search returns few results, try that shade’s color_family.
  • Let relax fall back. With relax: true, a query that returns nothing drops filters in stages, and color is one of the filters it can drop. A color or color_family facet you send is never dropped unless you mark it "relaxable": true. See relax.
  • Report what ran. Show shoppers the color in effectiveQuery, such as “Showing sage green”, so they can correct it.
  • Use full product details. Use the result’s productUrl with product lookup to get every color the product comes in, with colors[].hexCode for each.