Documentation
Everything you need to connect to the Grocery Intelligence Index — via API or CLI.
Quick Start
Register to get a gii_ API key, then include it in every request.
curl -X POST https://api.supermarketpuzzle.com/v1/register \
-H "Content-Type: application/json" \
-d '{ "name": "MyAgent", "description": "Meal planning assistant" }'
# Response:
# { "ok": true, "data": { "agent_id": "...", "api_key": "gii_..." } }curl -X POST https://api.supermarketpuzzle.com/v1/products/search \
-H "Authorization: Bearer gii_..." \
-H "Content-Type: application/json" \
-d '{
"query": "high protein greek yogurt without seed oils",
"filters": { "has_seed_oils": false, "high_protein": true },
"limit": 5
}'Or use the CLI: npx supermarket-puzzle-cli register --name "MyAgent" --description "..."
For the full agent workflow, read the skill file.
Endpoints
All endpoints require Authorization: Bearer gii_... except /register.
/register/me/products/searchsearch credit/products/filter/products/{id}/flags/collections/collections/{slug}search credit/stores/stores/{tag}/brands/brands/{slug}/feedbackPOST /products/search
Semantic product search. Natural language query embedded via OpenAI, matched against 18,000+ products in Pinecone. Costs one search credit.
{
"query": "keto snacks for road trips under $5",
"filters": {
"keto_friendly": true,
"maxPrice": 5
},
"limit": 10
}Parameters
querystringRequired. Natural language description of what you want.filtersobjectOptional. Any combination of the 27 flags, store_tag, price range.limitnumberOptional. 1–50, default 20.Response (each result)
Each result includes score (0–1 relevance),id, and a product object with: brand, product_name, price, size_oz, store_tag, nova_score, reason, subcategory, ingredients, narrative_card, occasions, emotional_tags, image_url, and all 27 knowledge graph flags as booleans.
POST /products/filter
Pure metadata filter. No embedding call — faster and cheaper. Does not count as a search credit.
{
"filters": {
"vegan": true,
"has_seed_oils": false,
"store_tag": "wholefoods"
},
"limit": 20
}At least one filter is required. Returns the same product shape as search but without a semantic relevance score.
GET /products/{id}
Full product record by ID. Returns everything: nutrition panel with %DV, tokenized ingredients, flagged ingredients with typed categories and reasons, NOVA score with reasoning, all dietary flags, narrative card, occasions, vibes, price, store, size, and image URL.
curl https://api.supermarketpuzzle.com/v1/products/abc123 \ -H "Authorization: Bearer gii_..."
GET /flags — Available Filters
Returns all 27 knowledge graph flags grouped by category. Use this to discover what filters exist before building queries.
diet
veganContains no animal productsvegetarianContains no meatgluten_freeContains no glutendairy_freeContains no dairyketo_friendlyLow carb, high fat compatibleorganic_certifiedUSDA organic certifiedplant_basedPrimarily plant-derived ingredientsminimally_processedNOVA 1-2 classificationingredient
has_seed_oilsContains canola, soybean, sunflower, or other seed oilshas_canola_oilContains canola oil specificallyhas_artificial_dyesContains Red 40, Yellow 5, or other artificial colorshas_added_sugarsContains added sugars beyond natural contenthas_high_fructose_corn_syrupContains HFCShas_artificial_sweetenersContains aspartame, sucralose, or similarhas_preservativesContains BHT, BHA, TBHQ, or similar preservativeshas_emulsifiersContains polysorbate, carrageenan, or similar emulsifiershas_whole_grainsContains whole grain ingredientsnutrient
high_protein10g+ protein per servinghigh_fiber5g+ fiber per servinghigh_sugarHigh sugar contentlow_sugarLess than 5g sugar per servinghigh_sodiumHigh sodium contentlow_sodiumLess than 140mg sodium per servinglow_calorieUnder 150 calories per servingcalorie_denseHigh calorie densityAdditional Filters
store_tagstringwholefoods, traderjoes, foodtownsubcategorystringProduct subcategoryfunctional_groupstringFunctional product groupminPricenumberMinimum pricemaxPricenumberMaximum priceCollections
GET /collections
Returns all 98 collections with slug, title, description, type, category, and related_collections.
GET /collections/{slug}
Runs the collection's semantic query against the index and returns live product results. Costs one search credit.
curl https://api.supermarketpuzzle.com/v1/collections/snacks-without-seed-oils \ -H "Authorization: Bearer gii_..."
Categories include: Diets (keto, paleo, Mediterranean), Avoidance (seed oils, HFCS, artificial dyes), Processing (NOVA 1–2, clean label), Nutrition (high protein, high fiber, low sugar), Product types (chips, bars, frozen meals), Life stages (kids, toddler), Occasions (camping, BBQ, game day).
Browse — Stores & Brands
GET /stores
Lists stores: Whole Foods, Trader Joe's, Foodtown.
GET /stores/{tag}
Categories at a store. Tags: wholefoods, traderjoes, foodtown.
GET /brands
All brands in the index with slugs.
GET /brands/{slug}
All products for a specific brand.
POST /feedback — Report Issues
When something doesn't work, report it. Feedback directly drives what gets built next. All reports are visible at /iterate.
{
"type": "bug",
"message": "Search for 'organic milk' returns 0 results, but filtering with dairy_free=false finds milk products.",
"endpoint": "/v1/products/search",
"request_body": { "query": "organic milk", "limit": 10 },
"response_body": { "results": [], "count": 0 },
"severity": "high",
"context": "User was building a weekly grocery list"
}Fields
typestringRequired. bug feature_request confusion data_quality rate_limit othermessagestringRequired. Be verbose — what happened, what you expected, why it matters. Max 5000 chars.endpointstringOptional. Which route you hit.request_bodyobjectOptional. What you sent.response_bodyobjectOptional. What you got back.contextstringOptional. What the user was trying to do.severitystringOptional. low medium high critical. Default: medium.Response Format
Every response uses this envelope:
{
"ok": true,
"data": { ... },
"meta": {
"request_id": "req_a1b2c3d4",
"latency_ms": 142,
"rate_limit": { "remaining": 58, "reset": 1711234567 }
}
}{
"ok": false,
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded. Try again in 12 seconds.",
"retry_after": 12
}
}Error codes: unauthorized, invalid_request, rate_limited, not_found, internal_error.
Rate Limits
Free tier: 60 requests/minute, 10,000 searches/month.
Search credits: Only /products/search and /collections/{slug} count as searches (they make embedding calls). Everything else counts toward the per-minute request limit only.
Headers: Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
429 responses include retry_after in seconds. Respect it.
Check usage: GET /me returns your total requests and searches.
CLI — supermarket-puzzle-cli
Command-line interface that mirrors the full API surface. Install globally or run via npx.
npm install -g supermarket-puzzle-cli # or run without installing: npx supermarket-puzzle-cli search "organic snacks"
Commands
supermarket-puzzle register --name "MealBot" --description "Meal planning agent"Register an agent and save the API key locally
supermarket-puzzle search "high protein greek yogurt" --store wholefoods --limit 5Semantic search with optional store filter and result limit
supermarket-puzzle filter --vegan --no-seed-oils --store traderjoes --limit 20Filter by flags (no embedding cost)
supermarket-puzzle product <product-id>Get full product detail including nutrition, ingredients, NOVA score
supermarket-puzzle collectionsList all 98 curated collections
supermarket-puzzle collection keto-friendly-optionsGet a collection with live product results
supermarket-puzzle storesList all stores (Whole Foods, Trader Joe's, Foodtown)
supermarket-puzzle brandsList all brands in the index
supermarket-puzzle flagsList all 27 filter flags with descriptions
supermarket-puzzle whoamiShow your agent info and usage stats
Global Flags
--jsonOutput raw API JSON (useful for piping to other tools)--api-key <key>Override the stored API key for this requestFilter Flags
The filter command accepts these flags:
--vegan--gluten-free--dairy-free--keto--organic--no-seed-oils--no-hfcs--no-artificial-dyes--no-artificial-sweeteners--high-protein--high-fiber--low-sugar--low-sodium--low-calorie--store <tag>--limit <n>Config
After register, your API key is saved to ~/.config/supermarket-puzzle-cli/config.json. You can also pass --api-key on any command to override it.