Sainsbury's CLI

Aug 26, 2026 • Yousef Amar • 2 min read • Parent project

For the past 5 years or so, I've ordered my weekly groceries online. For the past year or so, I've had that on autopilot.

My household orders groceries from Sainsbury's which unfortunately does not have an API, and the web UI is absolute garbage. I thought maybe this is a use case for computer-use agents (they were just about becoming a thing at the time), but there's an easier way!

I did an order manually, went through all the main journeys (including adding coupons), and then via browser dev tools, downloaded a .HAR file, which is a detailed log of all network requests. After that, Claude Code (Opus at the time) made short work of it. Out the other side came a CLI tool for interfacing with Sainsbury's.

Some of the auth stuff was tricky to do as they use Akamai Bot Manager to detect bots, but it was possible to get around that with pure software (no LLMs) with a headless browser for just that part.

Since then I was able to say things to AL like "add the usuals to this week's groceries, minus a carton of eggs" and in my inbox would land the receipt. It's low risk because they only take payment the day before, so I can always correct things. But then I set a cron to populate our groceries every week (pure software, no LLMs), and now I (or anyone in my household) only needs to talk to AL when they want some extras or changes that week.

If this is useful to others that order from Sainsbury's, here's the NPM package (npm install -g sainsburys-cli) and here's the GitHub repo.

It's trivial to create a skill for your agents to tell them to use this, but I can't share mine unfortunately as it has loads of things about exactly the way I like to order my groceries! You'll have different "usuals"! Just ask the agent to look at your order history and derive by frequency what your usuals are.

Just a word of warning: it's against Sainsbury's ToS to do this kind of thing, but I have the repo auto-maintaining itself, so I doubt it's detectable even if they change their interfaces. I've been using this for probably 50+ weekly orders now and never had any issues. But don't blame me if they ban you or something!