Mercadona CLI operates in two modes. The anonymous read mode — search, batch pricing, product detail, and category browsing — requires no login and works from any IP. The authenticated mode — cart management, checkout, and order placement — requires a browser login once to seed a refresh token, after which the CLI renews the session headlessly. This guide walks through both.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ivorpad/mercadona-cli/llms.txt
Use this file to discover all available pages before exploring further.
Install the CLI
The quickest cross-platform install is via npm:Or, on macOS and Linux, use the curl installer:Confirm the binary is on your See Installation for all options including manual binary download and building from source.
PATH:Search for products
Search the catalog using plain text. No login is required — searches go directly to Algolia.Example output:Each result shows the product id, name, price, and reference price per unit weight or volume. Pass
--json to get the full Algolia hit object for agent consumption.Use --fresh to drop frozen (Congelados) and canned (Conservas) aisles from results, surfacing the fresh product when a bare term would otherwise top-rank the preserved version:Batch-price a shopping list
batch resolves many search terms in approximately one request, returning the top hit per term with its price. Write your list line by line and pipe it in:-f:total. It reads <id> [qty] lines (inline # comments are ignored) and sums in integer cents — fractional quantities work for weight items:-f:Get product details
Fetch the full detail for a single product by its id — price, packaging format, canonical URL, and nutrition data when available:Example output:Add
--json to get the full structured response including product_information.nutritional_information, nutrition_information (allergens and ingredients), brand, ean, origin, and details:Explore categories
Print the full category tree to see what top-level and nested categories are available:Fetch all products in a specific category by its id. Category The
118 is Arroz (rice):--json flag returns the raw API response, which you can pipe into jq for filtering. For example, find every product in a category that has a price decrease flagged:Authenticate and manage your cart (optional)
Authenticated commands require a browser sign-in once to capture a refresh token. The recommended method is Import a HAR file. In your browser, open DevTools → Network, sign in to tienda.mercadona.es (by email or Google), then export the HAR from the Network panel (the download icon → “Export HAR…”). Import it:This writes the durable Expected output:Inspect and build a cart:Apply many lines at once with Pass
import-har.Set your warehouse first. Product ids and prices are per-warehouse; online checkout requires the cart’s warehouse to match your delivery address. Resolve your postal code to the correct warehouse and save it as the default:refresh_token to ~/.mercadona/config.toml (mode 0600). Every future 401 token_not_valid response triggers an automatic headless token refresh — no browser needed again.Alternative methods. If you already have a refresh token, seed it directly with set-refresh <token>. For a quick one-off session without a refresh token, use import-curl with a DevTools “Copy as cURL” string — note that it cannot auto-renew when the access token expires. login --user … --password … also exists but requires a recaptcha_token and fails for Google accounts; import-har is strongly preferred. See Authentication for the full details.Confirm authentication:cart set-many. It prices the basket first, so --max can refuse before any write happens:0 as the quantity to remove a line. Use cart clear to empty the entire cart in one write.Next steps
Authentication
Learn the full HAR import flow, the curl import fallback, and how headless token refresh works.
Command Reference
Complete syntax and flags for every command, including common flags like
--wh, --lang, and --json.