Starforest API
The Starforest API lets an AI agent compare the same product across top US retailers, with each retailer's own price, stock and ratings, and the time we checked.
The API is opening soon. Request access, and we’ll be in touch.
You use it in four steps: search, compare, check and buy. Each step is also a tool in our MCP server.
Searching is free. Searches, lookups, product reads, similar products, price history and suggestions count toward a fair-use allowance of 20,000 calls a month, plus 1,500 for every purchase through your buy links. Fresh checks are free when the shopper opens your buy link within 30 minutes, and other checks are $0.01 an offer after 1,000 free each month.
Quick start
This quick start follows one product, a 24-pack of Voltmark AA batteries, through the four steps. Voltmark is a made-up brand, and its prices are examples.
Before you start
Request access to get two API tokens: a test token, which starts with sf_test_, and a live token, which starts with sf_live_. The examples read your token from an environment variable called STARFOREST_TOKEN, and the responses show what a live token returns.
The TypeScript examples use fetch and the Python examples use requests. Each defines a small starforest() helper in step 1 and reuses it in the later steps.
1. Search for the product
Create a search with the shopper's words. Setting max_products to 1 returns only the best match.
curl https://api.thestarforest.com/searches \
-H "Authorization: Bearer $STARFOREST_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "voltmark aa batteries 24 count",
"max_products": 1
}' const API = "https://api.thestarforest.com";
async function starforest(path: string, body?: object) {
const res = await fetch(API + path, {
method: body ? "POST" : "GET",
headers: {
Authorization: `Bearer ${process.env.STARFOREST_TOKEN}`,
"Content-Type": "application/json",
},
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json();
if (!res.ok) throw new Error(json.errors[0].message);
return json.data;
}
const search = await starforest("/searches", {
query: "voltmark aa batteries 24 count",
max_products: 1,
});
const product = search.products[0];
for (const offer of product.offers) {
console.log(offer.retailer, offer.price, offer.availability, offer.checked_at);
} import os
import requests
API = "https://api.thestarforest.com"
session = requests.Session()
session.headers.update({
"Authorization": f"Bearer {os.environ['STARFOREST_TOKEN']}",
})
def starforest(path, body=None):
if body is None:
res = session.get(API + path)
else:
res = session.post(API + path, json=body)
payload = res.json()
if not res.ok:
raise RuntimeError(payload["errors"][0]["message"])
return payload["data"]
search = starforest("/searches", {
"query": "voltmark aa batteries 24 count",
"max_products": 1,
})
product = search["products"][0]
for o in product["offers"]:
print(o["retailer"], o["price"], o["availability"], o["checked_at"]) The response holds one product with an offer from each retailer. An offer has its own ID, the retailer's price and stock, its rating and checked_at, the time we checked the price. Kroger's offer comes last because Kroger is out of stock.
{
"data": {
"id": "srh_0000AqN3jZ8xYb2Kd7",
"query": "voltmark aa batteries 24 count",
"retailer_statuses": [
{ "retailer": "amazon", "status": "complete" },
{ "retailer": "walmart", "status": "complete" },
{ "retailer": "target", "status": "complete" },
{ "retailer": "kroger", "status": "complete" }
],
"products": [
{
"id": "prd_0000AqN3kT4bWc9Rf1",
"title": "Voltmark AA alkaline batteries, 24 ct",
"brand": "Voltmark",
"gtin": "00412345670136",
"offers": [
{
"id": "off_0000AqN3mP7cVd2Tg5",
"retailer": "walmart",
"price": "16.97",
"unit_price": "0.71",
"availability": "in_stock",
"rating": 4.6,
"badge": "Best seller",
"checked_at": "2026-11-19T14:05:00Z"
},
{
"id": "off_0000AqN3tV9bZe4Xd8",
"retailer": "amazon",
"price": "17.49",
"unit_price": "0.73",
"availability": "in_stock",
"rating": 4.7,
"badge": null,
"checked_at": "2026-11-19T14:02:00Z"
},
{
"id": "off_0000AqN3xZ6dBg7Zf1",
"retailer": "target",
"price": "18.99",
"unit_price": "0.79",
"availability": "in_stock",
"rating": 4.5,
"badge": null,
"checked_at": "2026-11-19T14:04:00Z"
},
{
"id": "off_0000AqN41D0fDi1Bh5",
"retailer": "kroger",
"price": "19.99",
"unit_price": "0.83",
"availability": "out_of_stock",
"rating": 4.4,
"badge": null,
"checked_at": "2026-11-19T14:01:00Z"
}
]
}
]
}
} 2. Compare the offers
The search already returned every retailer's offer, so your agent can compare them right away. To show the same comparison later, for example when a shopper comes back to a product they saved, get the product by its ID. Its offers are ordered by price, lowest first, with out-of-stock offers last.
curl https://api.thestarforest.com/products/prd_0000AqN3kT4bWc9Rf1 \
-H "Authorization: Bearer $STARFOREST_TOKEN" const item = await starforest(`/products/${product.id}`);
for (const offer of item.offers) {
console.log(offer.retailer, offer.price, offer.unit_price, offer.checked_at);
} item = starforest(f"/products/{product['id']}")
for o in item["offers"]:
print(o["retailer"], o["price"], o["unit_price"], o["checked_at"]) The response is the same product object that the search returned.
3. Check your agent's final picks
Search results come from the catalog, which is refreshed daily, so run a fresh check on the offers your agent plans to recommend before it calls a price final. A fresh check re-confirms the price and stock of the offers you name and takes 5 to 10 seconds, so keep the list short. This example checks the three offers that were in stock.
curl https://api.thestarforest.com/checks \
-H "Authorization: Bearer $STARFOREST_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"offer_ids": [
"off_0000AqN3mP7cVd2Tg5",
"off_0000AqN3tV9bZe4Xd8",
"off_0000AqN3xZ6dBg7Zf1"
]
}' // Check every offer that was in stock. Offers are ordered by price, cheapest first.
const picks = item.offers.filter((o: any) => o.availability === "in_stock");
const check = await starforest("/checks", { offer_ids: picks.map((o: any) => o.id) });
for (const r of check.results) {
console.log(r.retailer, r.status, r.price, r.checked_at);
} # Check every offer that was in stock. Offers are ordered by price, cheapest first.
picks = [o for o in item["offers"] if o["availability"] == "in_stock"]
check = starforest("/checks", {"offer_ids": [o["id"] for o in picks]})
for r in check["results"]:
print(r["retailer"], r["status"], r["price"], r["checked_at"]) {
"data": {
"id": "chk_0000AqN4bR2wHx5Lc8",
"results": [
{
"offer_id": "off_0000AqN3mP7cVd2Tg5",
"retailer": "walmart",
"status": "unchanged",
"price": "16.97",
"previous_price": "16.97",
"currency": "USD",
"availability": "in_stock",
"previous_availability": "in_stock",
"checked_at": "2026-11-19T17:41:07Z"
},
{
"offer_id": "off_0000AqN3tV9bZe4Xd8",
"retailer": "amazon",
"status": "changed",
"price": "16.99",
"previous_price": "17.49",
"currency": "USD",
"availability": "in_stock",
"previous_availability": "in_stock",
"checked_at": "2026-11-19T17:41:08Z"
},
{
"offer_id": "off_0000AqN3xZ6dBg7Zf1",
"retailer": "target",
"status": "changed",
"price": "18.99",
"previous_price": "18.99",
"currency": "USD",
"availability": "out_of_stock",
"previous_availability": "in_stock",
"checked_at": "2026-11-19T17:41:09Z"
}
],
"live_mode": true
}
} Walmart's offer is unchanged. Amazon's price dropped 50¢ to $16.99 and Target is now out of stock, so both have the status changed. Each result holds the new values, with the old ones in previous_price and previous_. Walmart is still the cheapest offer in stock. If a retailer had stopped listing the product, its status would be no_. The test store has products that do each of these.
4. Send the shopper to the retailer
When the shopper chooses an offer, create a buy link for it. Here the shopper picks Walmart, which is still the cheapest. The link opens Walmart's own product page, and the shopper buys there. The order, the receipt and any return stay between the shopper and Walmart.
curl https://api.thestarforest.com/links \
-H "Authorization: Bearer $STARFOREST_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "offer_id": "off_0000AqN3mP7cVd2Tg5" }' // The offer the shopper chose
const link = await starforest("/links", { offer_id: picks[0].id });
console.log(link.url); # The offer the shopper chose
link = starforest("/links", {"offer_id": picks[0]["id"]})
print(link["url"]) {
"data": {
"offer_id": "off_0000AqN3mP7cVd2Tg5",
"retailer": "walmart",
"url": "https://www.walmart.com/ip/…",
"live_mode": true
}
} Key ideas
Products and offers
A product is one item, such as a 24-pack of Voltmark AA batteries. An offer is one retailer's listing of that product, with the retailer's own title, price, stock and ratings. A product listed at four retailers has four offers. You use an offer's ID to check it or to create a buy link.
We put listings in one product only when they're the same brand, variant, size and count. A 12-pack and a 24-pack are different products, and similar products links them. Each offer's match_confidence, from 0 to 1, says how sure we are that the listing belongs to the product.
When each value was checked
Every offer has a checked_at time for when we last checked its price, and a stock_checked_at time for its stock. The catalog is refreshed daily. When your agent quotes a price, have it name the retailer and say when we checked the price, for example "$16.97 at Walmart, checked at 6:05 am PT".
Fresh checks before you recommend
Search results come from the catalog, which is refreshed daily. A fresh check re-confirms the price and stock of the offers you name. A fresh check takes 5 to 10 seconds, against about a second for a search. Use search results to narrow the choice, then check only the offers your agent is about to recommend.
Retailers missing from a result
Every search reports a status for each retailer it covered, in retailer_statuses. complete means that retailer's results are in the response. not_found means we didn't find a match at that retailer in our catalog. When a retailer shows not_found, your agent should say it didn't find the product there. It shouldn't say the product is out of stock there.
Ratings, badges and sort order
An offer carries the retailer's own rating and review count, its badge when it shows one, such as Best seller, and at some retailers how many people bought it recently, such as "2K+ bought in past month". These come from each retailer, so compare them within a retailer rather than across retailers.
Products come back in the order you set with sort: by relevance, price, unit price or rating. Brands can't pay to rank higher, and there are no ads in answers.
Coming soon
These are on the way. Their fields are marked Coming soon in this reference.
- Stock at a store near a ZIP code. Today, stock is one status per retailer, with shipping, pickup and same-day delivery where the retailer shows them.
- Whole-list compare: the total for a shopping list at each retailer.
- Price and stock alerts, sent to your webhook when an offer changes.
If you need one of these, tell us which one.
Test store
Starforest Mart is a test retailer with the ID sfmart. It appears only when you use a test token, and its products behave the same way every time. A real retailer's prices and stock can change between checks, and you can't make one drop a product when you need to test that case.
Each product is named after what it does. To find one, search for its name with retailers set to ["sfmart"]. Starforest Mart's prices aren't realistic.
| Product | What happens |
|---|---|
| Always In Stock | It's in stock at 10.00, and every fresh check returns unchanged. Use it for the path where nothing goes wrong. |
| Always Out Of Stock | It's out of stock in every search and every check. Use it to test how your agent tells a shopper an item is unavailable. |
| Price Changes On Check | It shows 12.99 in search. A fresh check returns 14.49, with previous_price 12.99 and the status changed. |
| No Longer Available | It shows in search. A fresh check returns the status no_, and creating a buy link returns the error offer_. |
| Check Times Out | Any fresh check that includes it fails with a 504 error and the code check_. Use it to test how your agent falls back on the values from our last check. |
| Not Found Elsewhere | Only Starforest Mart has it. The other retailers show not_found in retailer_. |
For example, a search for Price Changes On Check returns an offer at 12.99. A fresh check on that offer returns the new price, 14.49, with the old one in previous_price.
{
"data": {
"id": "chk_0000AqT3vW8nRd2Kf5",
"results": [
{
"offer_id": "off_0000AqT2pC4hNg8Qs1",
"retailer": "sfmart",
"status": "changed",
"price": "14.49",
"previous_price": "12.99",
"currency": "USD",
"availability": "in_stock",
"previous_availability": "in_stock",
"checked_at": "2026-11-19T17:45:12Z"
}
],
"live_mode": false
}
} Buy links for Starforest Mart products open a test page.
API reference
The API has nine endpoints under https://api.thestarforest.com. Every endpoint returns JSON, and the POST endpoints take a JSON body.
| Endpoint | Name |
|---|---|
| POST /searches | Create a search |
| POST /lookups | Look up a product |
| GET /products/{id} | Get a single product |
| GET /products/{id}/similar | List similar products |
| GET /products/{id}/history | Get price history |
| GET /suggestions | List suggestions |
| POST /checks | Create a check |
| POST /links | Create a buy link |
| GET /retailers | List retailers |
Conventions
Authentication and headers
Send your token as a bearer token in the Authorization header. POST requests also need Content-Type: application/json.
| Header | Value |
|---|---|
| Authorization | Bearer sf_test_… or Bearer sf_live_…. Required on every request. |
| Starforest-Version | Optional. A dated version, such as 2026-11-20. Without it, a request uses your account's default version. |
| Content-Type | application/json. Required on POST requests. |
| Idempotency-Key | A unique string you choose, such as a UUID. Optional on POST requests. |
If you send a POST request again with the same Idempotency-Key, for example after a network timeout, you get the original response back, and we don't create a second search, check or link.
Test and live mode
Your token sets the mode. Test tokens work against the test store, and live tokens against the catalog. Every object has a live_mode field, which is false in test mode and true in live mode.
Response format
A successful response wraps its result in data. Request bodies are plain JSON objects and don't need the wrapper.
- IDs start with a prefix that says what they are:
srh_for a search,prd_for a product,off_for an offer andchk_for a check. - Money is a decimal string, such as
"16.97", with the currency in a separatecurrencyfield. Strings keep amounts exact, which floating-point numbers can't always do. Every retailer we cover prices in US dollars. - Times are ISO 8601 strings in UTC, such as
"2026-11-19T14:05:00Z".
Versioning
Each request uses your account's default version, which is the latest version on the day you sign up. To pin a version, send Starforest-Version with its date, such as 2026-11-20. Changes that could break your code only come in a new dated version, and every change is listed in the changelog.
Limits and fair use
Discovery calls are free. They're searches, lookups, product reads, similar products, price history, suggestions and the retailer list. Buy links don't count, and fresh checks are billed on their own.
| Limit | Free plan |
|---|---|
| Monthly allowance | 20,000 discovery calls, plus 1,500 for every purchase through your buy links. Over that, $0.005 a call. We email you first. |
| Discovery calls | 10 a second for each key. |
| Fresh checks | 2 a second for each key, with up to 10 offers in a check. A check is free when the shopper opens your buy link for one of its offers within 30 minutes. Other checks: the first 1,000 offers each month are free, then $0.01 an offer. |
| Results | Up to 20 products a page and 100 for one query. |
If you go over a rate limit, you get a 429 error with the code rate_limit_exceeded and a Retry-After header, so wait that long and retry. For higher limits, talk to sales.
Using the data
- Show results to shoppers, or use them to act for one.
- Keep prices for up to 24 hours. Refresh older ones, or run a fresh check, before you show them. Keep product IDs as long as you like.
- Copying the catalog in bulk, reselling it or training models on it needs a data license. Ask us about one.
- Keep buy links as they are. They carry your attribution, so a purchase counts for your commission share and your allowance.
Searches
A search finds products from a shopper's words and returns each product with an offer from every retailer where we found it. Searches read the catalog, which covers top US retailers and is refreshed daily. A search takes about a second. To start from a barcode or a link, look it up instead.
Create a search
POST /searches
Send query, or a category in filters to browse that category. The other fields are optional.
| Field | Description |
|---|---|
| querystring | What the shopper asked for, in their words, such as "aa batteries 24 pack". |
| retailersarray of strings | The retailers to search, by ID from List retailers. Defaults to all of them. With a test token, you can add sfmart. |
| filtersobject | Narrows the results. Every filter you set must match. The fields are below. |
| sortstring | relevance, price, unit_ or rating. price and unit_ put the product with the cheapest in-stock offer first. Defaults to relevance. Offers inside a product are always ordered by price, with out-of-stock offers last. |
| max_productsinteger | The most products to return, from 1 to 20. Defaults to 3. |
| page_tokenstring | The next_ from the previous page. One query returns up to 100 products in all. |
| Field | Description |
|---|---|
| in_stockboolean | Only products with at least one offer in stock. |
| price_min, price_maxstring | The lowest offer must be within this range, such as "20.00". |
| brandsarray of strings | Brand names, such as ["Voltmark"]. |
| categorystring | A category path from suggestions, such as "Household > Batteries". |
| dietary_ | Claims on the product, such as vegan, organic, gluten-free, non-gmo or kosher. |
| audiencearray of strings | Who it's for: women, men, kids, baby or pets. |
| attributesobject | Category attributes and the values to allow, such as { "flavor": ["cherry"] } for drinks. |
The response is a search object.
The search object
| Field | Description |
|---|---|
| idstring | Starts with srh_. |
| querystring or null | The query you sent. null when you browsed a category. |
| retailer_ | One entry for each retailer searched, with retailer and status. The status is complete or not_found, as described in Retailers missing from a result. |
| productsarray | The matching products. |
| next_ | Send it as page_token to get the next page. null on the last page. |
| live_modeboolean | false in test mode. |
{
"data": {
"id": "srh_0000AqN3jZ8xYb2Kd7",
"query": "voltmark aa batteries 24 count",
"retailer_statuses": [
{ "retailer": "amazon", "status": "complete" },
{ "retailer": "walmart", "status": "complete" },
{ "retailer": "target", "status": "complete" },
{ "retailer": "kroger", "status": "complete" }
],
"products": [
{
"id": "prd_0000AqN3kT4bWc9Rf1",
"title": "Voltmark AA alkaline batteries, 24 ct",
"brand": "Voltmark",
"manufacturer": "Voltmark Power Co.",
"category": "Household > Batteries > AA",
"size": { "quantity": 24, "unit": "count" },
"gtin": "00412345670136",
"dietary_claims": [],
"audience": [],
"attributes": { "battery_size": "AA", "chemistry": "alkaline" },
"offers": [
{
"id": "off_0000AqN3mP7cVd2Tg5",
"retailer": "walmart",
"retailer_product_id": "5410983372",
"title": "Voltmark AA Alkaline Batteries, 24 Count",
"url": "https://www.walmart.com/ip/…",
"match_confidence": 0.98,
"price": "16.97",
"list_price": null,
"currency": "USD",
"unit_price": "0.71",
"unit": "count",
"availability": "in_stock",
"fulfillment": {
"shipping": "in_stock",
"pickup": "in_stock",
"same_day_delivery": "out_of_stock"
},
"promotion": null,
"badge": "Best seller",
"popularity": "500+ bought since yesterday",
"rating": 4.6,
"review_count": 1204,
"price_since": "2026-11-02T08:12:00Z",
"checked_at": "2026-11-19T14:05:00Z",
"stock_checked_at": "2026-11-19T14:05:00Z",
"live_mode": true
},
{
"id": "off_0000AqN3tV9bZe4Xd8",
"retailer": "amazon",
"retailer_product_id": "B0FV1TQ7ZK",
"title": "Voltmark AA Batteries, Alkaline, 24-Pack",
"url": "https://www.amazon.com/dp/…",
"match_confidence": 0.97,
"price": "17.49",
"list_price": "19.99",
"currency": "USD",
"unit_price": "0.73",
"unit": "count",
"availability": "in_stock",
"fulfillment": null,
"promotion": { "text": "Save 5% on 2 select items", "type": "multi_buy" },
"badge": null,
"popularity": "2K+ bought in past month",
"rating": 4.7,
"review_count": 2318,
"delivery_promise": "FREE delivery Fri, Nov 21",
"prime_eligible": true,
"price_since": "2026-11-14T06:40:00Z",
"checked_at": "2026-11-19T14:02:00Z",
"stock_checked_at": "2026-11-19T14:02:00Z",
"live_mode": true
}
],
"live_mode": true
}
],
"next_page_token": null,
"live_mode": true
}
} Lookups
A lookup finds one product from something exact: a UPC or EAN, a retailer's own product ID, or a link to a product page at a retailer we cover. It returns the product with every retailer's offer, the same way a search does. Use it when a shopper pastes a link, scans a barcode, or has an item in a cart somewhere else.
Look up a product
POST /lookups
Send exactly one of these fields.
| Field | Description |
|---|---|
| upcstring | A 12-digit UPC or a 13-digit EAN. |
| urlstring | A product page at a retailer we cover, such as a link a shopper pasted. |
| asinstring | An Amazon product ID. |
| walmart_ | A Walmart item ID. |
| target_tcinstring | A Target product ID (TCIN). |
| kroger_ | A Kroger product ID. |
curl https://api.thestarforest.com/lookups \
-H "Authorization: Bearer $STARFOREST_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "url": "https://www.target.com/p/voltmark-aa-24ct/-/A-91822604" }' The response is the matched product, with every retailer's offer. If nothing matches, you get a 404 error with the code product_not_found. A link to a page that isn't a product at a retailer we cover returns a 422 error with the code unsupported_url.
Products
A product is one item matched across retailers, and each retailer's listing of it is an offer. An offer carries the retailer's own price, stock, ratings and promotions, and the time we checked them.
The product object
| Field | Description |
|---|---|
| idstring | Starts with prd_. |
| titlestring | Our name for the product. Each retailer's own title is on its offer. |
| brandstring | The brand name. |
| manufacturerstring or null | The company that owns the brand. |
| categorystring | The category path, such as "Household > Batteries > AA". |
| image_urlstring | The main product image. |
| descriptionstring or null | The product description. |
| bullet_pointsarray of strings | The feature list from the product page. |
| sizeobject or null | The pack size, as quantity and unit, such as { "quantity": 24, "unit": "count" }. Units are count, oz or fl oz. |
| gtinstring or null | The 14-digit GTIN, when the product has one. A 12-digit UPC gets two leading zeros, as in 00412345670136. |
| dietary_ | Claims such as vegan, organic or gluten-free. |
| audiencearray of strings | Who it's for, such as kids or pets. |
| ingredientsstring or null | The ingredient list, for food, drinks and personal care. |
| attributesobject | Attributes for the product's category, such as flavor, pack type and volume for drinks, or shade for beauty. |
| offersarray | One offer for each retailer that lists the product. |
| live_modeboolean | false in test mode. |
The offer object
Fields a retailer doesn't show are null. For example, only Amazon shows a delivery promise, and only Walmart and Target show stock for shipping, pickup and same-day delivery.
| Field | Description |
|---|---|
| idstring | Starts with off_. Use it to create a check or a buy link. |
| retailerstring | The retailer's ID, such as walmart. |
| retailer_ | The retailer's own ID for the listing, such as an ASIN or a TCIN. |
| titlestring | The retailer's own listing title. |
| urlstring | The retailer's product page, for showing where a value came from. To send a shopper to buy, create a buy link. |
| match_ | How sure we are that this listing is the product, from 0 to 1. |
| pricestring | The retailer's price, as a decimal string. |
| list_pricestring or null | The was-price, when the retailer shows one above the price. |
| currencystring | ISO 4217 currency code, such as USD. |
| unit_pricestring or null | The price per unit of size, such as "0.71" per battery. |
| unitstring or null | What unit_price is per: count, oz or fl oz. |
| availabilitystring | in_stock or out_of_stock. One status for the retailer, not for a particular store. |
| fulfillmentobject or null | Stock for shipping, pickup and same_, each in_stock or out_of_stock. |
| promotionobject or null | The deal shown with the offer, as text and type, such as multi_buy or price_. |
| couponstring or null | A coupon shown on the product page. |
| badgestring or null | The retailer's own badge, such as "Best seller". |
| popularitystring or null | How many people bought it recently, as the retailer says it, such as "2K+ bought in past month". |
| ratingnumber or null | The retailer's average star rating, from 0 to 5. |
| review_countinteger or null | How many ratings the retailer shows. |
| delivery_ | The delivery date the retailer shows, such as "FREE delivery Fri, Nov 21". |
| prime_ | Whether the offer ships with Prime. |
| price_sincestring | When the price last changed, in UTC. |
| checked_atstring | When we last checked the price, in UTC. |
| stock_ | When we last checked the stock, in UTC. |
| live_modeboolean | false in test mode. |
| store Coming soonobject | Stock at a store near a ZIP code you send. |
Get a single product
GET /products/{id}
Returns the product with every retailer's offer, in the same shape as in a search. Offers are ordered by price, lowest first, with out-of-stock offers last. An unknown ID returns a 404 error with the code product_not_found.
curl https://api.thestarforest.com/products/prd_0000AqN3kT4bWc9Rf1 \
-H "Authorization: Bearer $STARFOREST_TOKEN" Similar products
Similar products start from a product you already have. Other sizes are the same item in a different pack, so your agent can find a lower unit price. Alternatives are other brands' products in the same category with the same key attributes, for when the first choice is out of stock or costs more.
List similar products
GET /products/{id}/similar
| Field | Description |
|---|---|
| kindstring | sizes, alternatives or all. Defaults to all, with sizes first. |
| max_productsinteger | From 1 to 20. Defaults to 5. |
{
"data": {
"product_id": "prd_0000AqN3kT4bWc9Rf1",
"similar": [
{
"relation": "size",
"product": {
"id": "prd_0000AqN8cX2mLp4Ws7",
"title": "Voltmark AA alkaline batteries, 48 ct",
"lowest_offer": { "retailer": "walmart", "price": "29.76", "unit_price": "0.62" }
}
},
{
"relation": "alternative",
"product": {
"id": "prd_0000AqN9dY3nMq5Xt8",
"title": "Brightcell AA batteries, 24 ct",
"lowest_offer": { "retailer": "target", "price": "15.36", "unit_price": "0.64" }
}
}
],
"live_mode": true
}
} Each product is a full product object, shortened here, plus lowest_offer, its cheapest offer in stock.
Price history
Price history shows how each offer's price, promotion and stock changed over the last 90 days, with a summary your agent can quote: the lowest, highest and typical price. Your agent can use it to tell a deal from a normal price, or to suggest waiting.
Get price history
GET /products/{id}/history
| Field | Description |
|---|---|
| retailersstring | Retailer IDs, separated by commas. Defaults to all of them. |
| daysinteger | From 1 to 90. Defaults to 90. |
{
"data": {
"product_id": "prd_0000AqN3kT4bWc9Rf1",
"offers": [
{
"offer_id": "off_0000AqN3mP7cVd2Tg5",
"retailer": "walmart",
"summary": {
"current": "16.97",
"lowest": "16.97",
"highest": "17.97",
"typical": "17.97",
"in_stock_days": 87
},
"periods": [
{ "from": "2026-08-22T07:30:00Z", "price": "17.97", "promotion": null, "availability": "in_stock" },
{ "from": "2026-10-09T06:55:00Z", "price": "17.97", "promotion": null, "availability": "out_of_stock" },
{ "from": "2026-10-12T07:10:00Z", "price": "17.97", "promotion": null, "availability": "in_stock" },
{ "from": "2026-11-02T08:12:00Z", "price": "16.97", "promotion": null, "availability": "in_stock" }
]
}
],
"live_mode": true
}
} typical is the price the offer had for the most days in the window, and in_stock_ counts the days it was in stock. Each period starts at from and runs until the next one starts. The last period is the current one.
Suggestions
Suggestions complete what a shopper has started typing, with brands, categories and full searches. Use a category path from here in a search's filters.
List suggestions
GET /suggestions?q=volt
{
"data": {
"query": "volt",
"brands": ["Voltmark"],
"categories": ["Household > Batteries > AA", "Household > Batteries > AAA"],
"searches": ["voltmark aa batteries", "voltmark aaa batteries 24 count"],
"live_mode": true
}
} Checks
A fresh check re-confirms the price and stock of the offers you name. Use it on your agent's final picks, before it tells a shopper a price is final. A fresh check takes 5 to 10 seconds.
When a check is free
When a shopper opens your buy link for an offer within 30 minutes of a check that included it, that check is free. We match the open to your most recent check of the offer, so there's nothing extra to send. Only opens by real shoppers count. Other checks: the first 1,000 offers each month are free, then $0.01 an offer.
Create a check
POST /checks
| Field | Description |
|---|---|
| offer_idsarray of strings | Required. The IDs of up to 10 offers to check. They can be from different retailers. |
The response is a check object. Step 3 of the quick start shows an example.
The check object
| Field | Description |
|---|---|
| idstring | Starts with chk_. |
| resultsarray | One result for each offer, in the order you sent them. |
| live_modeboolean | false in test mode. |
Each result has these fields.
| Field | Description |
|---|---|
| offer_idstring | The offer you asked about. |
| retailerstring | The offer's retailer. |
| statusstring | unchanged means the price and stock match the offer. changed means the price, the stock or both are different. The new values are in this result, and the old ones are in previous_price and previous_. no_ means the retailer no longer lists the product. |
| pricestring or null | The price when we checked. null if the status is no_. |
| previous_pricestring | The offer's price before this check. |
| currencystring | USD. |
| availabilitystring or null | in_stock or out_of_stock. null if the status is no_. |
| previous_ | The offer's stock before this check. |
| checked_atstring | When we checked, in UTC. |
If we can't confirm every offer in time, the check fails with a 504 error and the code check_timeout. The offers keep the values from our last check, with their checked_at times. Try again, or check fewer offers at a time.
Links
A buy link is the address to send a shopper to when they're ready to buy. It opens the retailer's own product page, and the shopper buys there. We don't take orders or payments, so the order, the payment and any return stay between the shopper and the retailer.
Create a buy link
POST /links
| Field | Description |
|---|---|
| offer_idstring | Required. The offer the shopper chose. |
| Field | Description |
|---|---|
| offer_idstring | The offer you sent. |
| retailerstring | The retailer the link opens. |
| urlstring | The retailer's own product page for the offer. |
| live_modeboolean | false in test mode. |
A buy link carries your attribution. When a shopper opens it, your fresh check on that offer becomes free, and a purchase through it counts for your commission share and your fair-use allowance. Send shoppers to the link as it is, without changing it.
If the retailer no longer lists the product, you get a 422 error with the code offer_no_longer_available instead of a link to a missing page. Step 4 of the quick start shows an example response.
Retailers
The catalog covers top US retailers, each refreshed daily, and we add more all the time. A fresh check happens only when you create one.
List retailers
GET /retailers
| Field | Description |
|---|---|
| idstring | The ID you use in retailers and see on offers, such as walmart. |
| namestring | The retailer's name. |
| refreshstring | How often the retailer's data in the catalog is refreshed. It's daily for every retailer. |
| live_modeboolean | false in test mode. |
curl https://api.thestarforest.com/retailers \
-H "Authorization: Bearer $STARFOREST_TOKEN" {
"data": [
{ "id": "amazon", "name": "Amazon", "refresh": "daily", "live_mode": true },
{ "id": "walmart", "name": "Walmart", "refresh": "daily", "live_mode": true },
{ "id": "target", "name": "Target", "refresh": "daily", "live_mode": true },
{ "id": "kroger", "name": "Kroger", "refresh": "daily", "live_mode": true }
]
} With a test token, the list also includes Starforest Mart, with the ID sfmart.
Errors
A failed request returns an HTTP error status and an errors array. Each error has a type for the kind of problem and a code for the exact problem, so your code can branch on either. When you contact us about an error, include meta.request_id.
{
"errors": [
{
"type": "invalid_request_error",
"code": "offer_no_longer_available",
"title": "Offer no longer available",
"message": "Walmart no longer lists this product. Search again to find another offer.",
"documentation_url": "https://thestarforest.com/docs#errors"
}
],
"meta": {
"request_id": "req_0000AqN4fK7sJy3Pn6"
}
} The error object
| Field | Description |
|---|---|
| typestring | One of authentication_, validation_, invalid_, check_error, rate_ or api_error. |
| codestring | The exact problem, such as product_. Codes are listed below. |
| titlestring | A short summary that stays the same for each code. |
| messagestring | A longer explanation of this error, written for a developer. |
| documentation_ | A link to this section of the docs. |
Status codes and retries
No endpoint places an order, so a retry can't buy anything twice. At worst it creates a second search, lookup, check or link.
| Status | What to do |
|---|---|
| 400invalid_ | Don't retry. The body isn't valid JSON, or a required header is missing. |
| 401authentication_ | Don't retry. The token is missing, malformed or revoked. |
| 404invalid_ | Don't retry. No product or offer has that ID, a lookup found no match, or the path is wrong. |
| 422validation_ invalid_ | Don't retry the same request. A field is missing or has the wrong value, or the request can't be done, such as a buy link for an offer the retailer no longer lists. |
| 429rate_ | Retry after the number of seconds in Retry-After. See Limits and fair use. |
| 500api_error | Retry a few times with exponential backoff. If it keeps failing, send us the request_id. |
| 503api_error | Retry later. The API is down for maintenance or overloaded. |
| 504check_error | Retry after a few seconds, or check fewer offers at a time. We couldn't confirm every offer in time. The offers keep the values from our last check. |
Error codes
These are the codes you'll see most often.
| Code | Meaning |
|---|---|
| invalid_token401 | The token is missing, malformed or revoked. |
| query_ | A search needs query, or a category in filters. |
| one_ | A lookup needs exactly one of upc, url or a retailer's product ID. |
| unsupported_ | The link isn't a product page at a retailer we cover. |
| too_many_ | A fresh check can hold up to 10 offers. |
| unknown_ | A value in retailers isn't one of the retailers we cover. sfmart works only with a test token. |
| product_ | No product has this ID. |
| offer_ | No offer has this ID. |
| offer_ | The retailer no longer lists the product. Search again to find another offer. |
| check_ | We couldn't confirm every offer in a fresh check in time. The offers keep the values from our last check. |
| rate_ | You've sent too many requests. Wait, then retry. |
MCP tools
Agents that use the Model Context Protocol (MCP) call Starforest through our MCP server at https://mcp.thestarforest.com. The server has seven tools, and each one returns the same JSON as the API call it mirrors.
Connect a client
Add the server to your MCP client's settings with your token. Your client may name these fields differently.
{
"mcpServers": {
"starforest": {
"url": "https://mcp.thestarforest.com",
"headers": {
"Authorization": "Bearer sf_live_..."
}
}
}
} The seven tools
| Tool | What it does |
|---|---|
| search_ | Finds products from a shopper's words and filters, with each retailer's offer. |
| lookup_ | Finds one product from a barcode, a retailer's product ID or a product link. |
| get_productGET /products/{id} | Returns one product with every retailer's offer. |
| find_similarGET /products/{id}/similar | Returns other sizes of the same item and alternatives from other brands. |
| get_price_ | Returns up to 90 days of price, promotion and stock changes for each offer, with the lowest, highest and typical price. |
| check_offersPOST /checks | Runs a fresh check, which re-confirms the price and stock of the offers your agent plans to recommend. |
| get_buy_linkPOST /links | Returns a link to the retailer's own product page, where the shopper buys. |
None of the tools places an order or takes a payment. get_buy_link returns a URL, and the shopper opens it to buy at the retailer.
How search_products is defined
The description in a tool's definition tells the agent how to use the results. This one tells the agent to name the retailer and say when we checked the price whenever it quotes one, and to call check_offers before it calls a price final.
{
"name": "search_products",
"title": "Search products across top US retailers",
"description": "Find products in the Starforest catalog and compare them across top US retailers. Returns matching products, each with one offer per retailer where we found it: the retailer's price, unit price, stock, rating and checked_at, the time Starforest checked the price. The catalog is refreshed daily. When you quote a price, name the retailer and say when it was checked. Before you tell the user a price is final, call check_offers with the IDs of the offers you plan to recommend. If retailer_statuses shows a retailer as not_found, say you didn't find the product there; do not say it is out of stock there. If the user gives a barcode or a product link, call lookup_product instead. To send the user to buy, call get_buy_link.",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "What the shopper wants, in their words, such as 'aa batteries 24 pack'."
},
"retailers": {
"type": "array",
"items": {
"type": "string",
"enum": ["amazon", "walmart", "target", "kroger"]
},
"description": "Retailers to search. Defaults to all of them."
},
"filters": {
"type": "object",
"properties": {
"in_stock": { "type": "boolean" },
"price_max": { "type": "string", "description": "Such as '20.00'." },
"brands": { "type": "array", "items": { "type": "string" } },
"dietary_claims": { "type": "array", "items": { "type": "string" } }
}
},
"sort": {
"type": "string",
"enum": ["relevance", "price", "unit_price", "rating"],
"default": "relevance",
"description": "How to order products. Use unit_price to compare pack sizes."
},
"max_products": {
"type": "integer",
"minimum": 1,
"maximum": 20,
"default": 3,
"description": "The most products to return."
}
},
"required": ["query"]
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": true
}
} The tool returns the same object as Create a search.
Changelog
- More ways to search. Lookups by barcode, retailer ID or link, similar products, price history and suggestions, with three new MCP tools. Offers now carry ratings, badges, promotions and stock for shipping, pickup and same-day delivery. Searching is free within fair use.
- Starforest API v1. Searches, products, fresh checks, buy links, retailers and the MCP server.
Coming soon
- Stock at a store near a ZIP code
- Whole-list compare
- Price and stock alerts
To get your API tokens, request access.