Product Search API for AI Agents: What to Look For

Most of what a name search returns is not usable by an agent: out of stock, wrong currency, no barcode or a different product. This guide lists what to look for in a product search API, with a demo on real results.

Affiliate.com Affiliate.com product search API for AI agents graphic

When a person searches for a product, a page of mixed results is fine, because the person sorts it out. They skip the case, ignore the listing in another currency and notice when the title is for a different model. An AI shopping agent does not sort anything out unless the search gives it the means to. Whatever comes back is what the agent has to work with, so the quality of a product search API for AI agents shows up directly in the quality of its answers. This guide lists what to look for in one, then lets you filter ten real results to see why each item matters. The demo below uses results last pulled November 16, 2026.

What an agent needs from a search

A person searching wants a good page of results. An agent wants something narrower: one product it can name, a price it can state and a store it can send a shopper to. That changes what counts as a good search. Ranking by relevance matters less than being able to ask for exactly what is needed, and being sure of what each result is.

Five things follow from that. The agent needs to filter on the server, so it does not receive results it will throw away. It needs a stable identifier, so it can tell one product from another. It needs stock and price on every result, and the price needs a currency. It needs a small, predictable response, because everything that comes back goes into the model’s context. And it needs the same search to work whether it is called as a tool or as a plain request.

Five things to look for

What to checkWhy an agent needs it
Filters in the requestAvailability, currency, price range and merchant should be search criteria, not something the agent does afterwards. Every filter applied by the API is a result the model never has to read.
A stable product identifierA barcode lets an agent say two listings are the same product, and say that two similar names are not. Titles differ by store, and a model will treat a case or a bundle as the product unless something stops it.
Stock and price on each resultAn answer such as “it is $89” needs the price, whether it is in stock and which currency it is in. Missing any of the three leaves the agent guessing.
Control over the fields returnedAsking for only the fields the agent will use keeps each result short. A long description per result is wasted context.
The same search as a tool or a requestAn agent connected through MCP and an application calling the API should be able to send the same arguments and get the same shape back.

Our posts on choosing between an MCP layer and an API and connecting an agent over MCP or REST cover the last item. The rest of this guide is about the first four.

Filter a real search

Below are the first ten results of a real search for a product, exactly as the Products API returned them with no filters. The page holds a rotating set of products that is rebuilt every night, and it offers three of them, a different three on most visits. Turn the filters on one at a time. Each result that fails a filter is crossed out with the reason, and the request at the bottom changes to include the filters you chose. Watch the count of results that pass.

Two things stand out. The first is how many results are not what they seem: some are for a different product that shares words with the name, some have no barcode at all, and some are priced in another currency. The second is that the filters do not agree with each other. A result can be in stock and in dollars and still be the wrong product, which is why the identifier is a filter of its own.

The request, with the filters in it

Every filter in the demo is a criterion in the search. The request below keeps results that are in stock, priced in US dollars and have a barcode, and asks for only the fields an agent will use.

POST https://api.affiliate.com/v1/products

{
  "search": [
    { "field": "name", "operator": "LIKE", "value": "Google Nest Thermostat" },
    { "field": "availability", "operator": "=", "value": "InStock" },
    { "field": "currency", "operator": "=", "value": "USD" },
    { "field": "barcode", "operator": "NOT NULL" }
  ],
  "fields": ["name", "brand", "barcode", "final_price", "availability", "currency", "merchant.name"],
  "per_page": 10
}

The name search is a partial match, so it finds the words in any order, and || between two values accepts either one. Prices use BETWEEN with two numbers and a single bar, for example 50|200. A search with these criteria returns only rows that pass, where the unfiltered version in the demo leaves the agent to cross most of them out.

Choosing the product from the results

Filters narrow the list, but the agent still has to decide which result is the product. The reliable way is to group results by barcode, take the group the shopper most likely means and then use that barcode for everything after. A short function does it.

// rows: the data array of one search response, already filtered to in stock, USD, with a barcode
function pickProduct(rows) {
  const groups = {};
  for (const r of rows) (groups[r.barcode] ||= []).push(r);
  // the barcode with the most listings is usually the product itself, not an accessory
  const [barcode, listings] = Object.entries(groups).sort((a, b) => b[1].length - a[1].length)[0];
  const cheapest = listings.reduce((a, b) => (b.final_price < a.final_price ? b : a));
  return { barcode, name: cheapest.name, price: cheapest.final_price, merchant: cheapest.merchant.name, stores: listings.length };
}

The rule is a heuristic and should be tested on your own queries. It works well for products sold at many stores and less well for a rare item with a single listing. A cautious agent asks the shopper to confirm when two groups are close. How LLMs fail on product identity explains why the barcode comes first, and barcode search shows how to look a product up by it.

What the November 12, 2026 pull shows

We ran the same unfiltered search on November 12, 2026 for the five products in that day’s set and read the first ten results of each, 50 in all. 40 of those were in stock, 33 were priced in US dollars and 44 had a barcode. 18 were the product the search was for, and 12 met all four conditions. In other words, about 24 percent of what a name search returned was something an agent could use as it stood.

SearchResultsIn stockUS dollarsSame productAll four
Google Nest Thermostat104422
Anker 737 power bank1010821
Tempur-Pedic Adapt pillow1081022
Shark Navigator Pet upright vacuum109865
OXO Good Grips salad spinner109362

This table is fixed to November 12, 2026. The demo above is rebuilt every night with a different set of products, so its results will change. Treat the table as a record of one day.

Ten results for each of a handful of products is a small sample and not a measure of any catalog. The figures describe the first ten results a name search returned, in the order it returned them, and a different query would give a different mix.

Questions to ask any product search API

The same questions are worth asking of any provider, including ours.

QuestionWhat a good answer sounds like
Can I filter by stock, currency and price in the request?Yes, as search criteria, with documented operators.
Does every result carry a barcode?Most do. Results without one are marked or can be excluded in the request.
Is the price shown with its currency and whether it is in stock?Both are fields on every result.
Can I choose which fields come back?Yes, so a result stays small enough for a model to read.
How do I find every store that sells a product?By barcode, in one request, not by repeating the name search.
How current is the data?Each result says when it was last updated, so you can check.

The last row is worth reading closely. A search that returns a price has to say how old it is. How shopping agents should handle out-of-stock and price-changed offers lays out what an agent should do when the answer changes between the search and the click.

Getting started in three steps

Moving from the demo to an agent of your own takes three steps.

StepWhat to do
1. Get a keyRequest an API key from Affiliate.com. REST requests send it as a Bearer token in the Authorization header, and an MCP client is configured with the same key.
2. Put the filters in the requestStart from the request above and add the criteria your shoppers care about, such as a price range or a merchant. Keep fields short.
3. Pick by barcode, then look it upGroup the results by barcode, choose the product and use its barcode for the price history and for every other store. Assistant-ready product search goes deeper on identifiers-first queries.
One API call
Search results your agent can use
  • ✓Stock, currency, price and barcode filters in the request
  • ✓Only the fields you ask for, so results stay small
  • ✓The same search as an MCP tool or a REST request
Get API access →
Request
{
  "search": [
    {
      "field": "name",
      "operator": "LIKE",
      "value": "Google Nest Thermostat"
    },
    {
      "field": "availability",
      "operator": "=",
      "value": "InStock"
    },
    {
      "field": "currency",
      "operator": "=",
      "value": "USD"
    },
    {
      "field": "barcode",
      "operator": "NOT NULL"
    }
  ],
  "fields": [
    "name",
    "brand",
    "barcode",
    "final_price",
    "availability",
    "currency",
    "merchant.name"
  ],
  "per_page": 10
}