Skip to content

Selling products online

Your store sells the same products as your till. To sell one online, give it photos (each with a description for people who can’t see it), any web fields you want, and publish it online. Collections group products for your pages and menus.

  1. PhotosPOST /v1/media
  2. Web fieldsPOST /v1/products/{id}
  3. ChecklistGET …/online_checklist
  4. OnlinePOST …/publish_online

POST /v1/media takes the file’s bytes as base64 in data: a JPEG or PNG photo (up to 10 MB, re-encoded to at most 2048 px on the long edge) or an MP4 video (H.264, up to 60 seconds, with a poster_media_id). Send alt_text with it. The same bytes again answer the same asset.

Terminal window
curl -sS https://api.tuppence.ai/v1/media \
-H "Authorization: Bearer $TUPPENCE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d "{\"data\": \"$(base64 < candle.jpg)\", \"alt_text\": \"A sea salt candle in a blue tin\"}"

POST /v1/media/{id} changes alt_text and focal_point (where crops keep the subject). A photo your live site uses can’t be deleted.

POST /v1/products/{id} takes the web fields beside the till’s. Only what you send changes.

FieldWhat
mediaIts photos and videos (med_…) in order. The first is the main one
web_title, web_descriptionIts name and description online, if not the till’s
slug, web_pathIts address, /products/<slug>, and an optional path of its own
brand, product_type, attributesFor search and feeds
weight_grams, dimensions_mm, hs_code, origin_countryFor delivery and customs
gpsrThe manufacturer and warnings, for EU sales
seo{title, description} for search results
inventory_policyAt zero stock: deny (the default), continue or preorder with preorder_ships_on
compare_at_amountA “was” price. Accepted only after 28 days in a row at that price within six months
Terminal window
curl -sS https://api.tuppence.ai/v1/products/prod_…/publish_online \
-H "Authorization: Bearer $TUPPENCE_SECRET_KEY"

A product that isn’t ready is refused with what it still needs and a fix_url to the field. GET /v1/products/{id}/online_checklist lists all of it first:

NeedsWhy
status: activeA draft is sold nowhere
A fixed priceA price typed at the till can’t be shown online
A photo, processed, with alt_textEvery picture online needs a description
A passed claims checkA sentence its facts don’t back is named, with where to add a fact

POST /v1/products/{id}/unpublish_online takes it out of the store. It stays on sale at the till.

A collection is manual (products you pick, in your order) or rule (every product a rule matches, read from the catalogue each time).

Terminal window
curl -sS https://api.tuppence.ai/v1/collections \
-H "Authorization: Bearer $TUPPENCE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Gifts under £20", "kind": "rule", "published": true,
"rules": {"match": "all", "conditions": [{"field": "price", "op": "lt", "value": 2000}]}}'
Terminal window
curl -sS https://api.tuppence.ai/v1/collections \
-H "Authorization: Bearer $TUPPENCE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Gifts under $20", "kind": "rule", "published": true,
"rules": {"match": "all", "conditions": [{"field": "price", "op": "lt", "value": 2000}]}}'
Terminal window
curl -sS https://api.tuppence.ai/v1/collections \
-H "Authorization: Bearer $TUPPENCE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Gifts under €20", "kind": "rule", "published": true,
"rules": {"match": "all", "conditions": [{"field": "price", "op": "lt", "value": 2000}]}}'

It is at /collections/<slug>. GET /v1/collections/{id}/products?channel=online lists what shoppers see in it.

Over MCP and in the Tuppence Assistant: update_product_web_fields, publish_product_online, unpublish_product_online, list_media, update_media, list_collections, create_collection and update_collection. Prices change only through update_product, and the assistant always asks before a price changes.

EventWhen
store.product_publishedA product went online
store.product_unpublishedA product came out of the store
store.collection_created, store.collection_updated, store.collection_deletedA collection changed

Docs assistant

Open as a page
Loading the assistant…