A watchlist of ASINs and a Notion database are a natural fit: everyone on the team already has Notion open, and a database view sorts, filters and groups the rows for free. This script reads the Buy Box price from /api/amazon-product-offers (1 credit per ASIN) and upserts it into a Notion data source: an existing row gets Price, Currency and Checked patched, a new ASIN gets a new page. No automation platform in between, just the Notion REST API and Python.
Key Takeaways
- One /amazon-product-offers call per ASIN (1 credit); the Notion write costs no SellerMagnet credits, only Notion's own request budget.
- Notion's own rate limit is an average of 3 requests per second per connection on most plans (10/s on Business/Enterprise); the script sleeps between calls and retries once on a 429.
- A missing Buy Box clears the Notion Price property to null, never 0, so a real free item and 'nothing on offer' never look the same in the database.
- Existing rows are found once per run via a data source query, paginated with has_more and next_cursor, not one Notion search call per tracked ASIN.
- A 401 or 403 stops the whole run before any later ASIN is touched, the same billing-safe pattern as the Slack and Discord alert posts.
Setting up the Notion side
Create an internal integration at notion.so/my-integrations, copy its token, then share your database with that integration from the database's ••• menu (Notion's own permission model: an unshared database answers every API call with a 404, not a 403). The database needs four properties with these exact types; the script writes to all four and reads the title to match an ASIN to its existing page.
| Property | Notion type | Why |
|---|---|---|
| ASIN | title | The page's title; also the lookup key this script uses to find an existing row |
| Price | number | null clears a stale price on 'no featured offer', never 0 |
| Currency | rich_text | An empty array (never a blank string) when there is no price to report |
| Checked | date | ISO 8601 UTC timestamp of this run, written on every sync |

Read the Buy Box price and currency for one ASIN with curl and jq
# One offers call (1 credit): the Buy Box price and currency this script writes to Notion
curl -sG "https://sellermagnet-api.com/api/amazon-product-offers" \
-H "X-Api-Key: $SELLERMAGNET_API_KEY" \
--data-urlencode "asin=B0CL61F39H" --data-urlencode "marketplaceId=ATVPDKIKX0DER" \
| jq '.data | {price: .buyBox.totalPrice, currency: .currency.code}'
Respecting Notion's rate limit
Notion enforces a per-connection limit measured over a 60 second window, separate from any SellerMagnet rate limit. A request over the limit answers 429 with a Retry-After header; the JavaScript SDK waits and retries automatically, this script does the same by hand since it only uses requests.
| Plan | Limit | Scope |
|---|---|---|
| Business / Enterprise plan | 600 requests / 60 s window (about 10/s) | per connection |
| Every other plan | 180 requests / 60 s window (about 3/s) | per connection |
| Over the limit | HTTP 429 with a Retry-After header | wait exactly that long, then retry once |
notion_price_tracker.py: find-or-create a Notion page per ASIN, patch its price
"""Sync Amazon Buy Box prices into a Notion database (data source) via the Notion API.
One /amazon-product-offers call per ASIN (1 credit). Notion's average rate limit is 3 requests
per second per connection (developers.notion.com/reference/request-limits), so this script sleeps
between Notion calls and honours a 429's Retry-After header instead of hammering it. The data
source is queried once per run to find each ASIN's existing page by its title property; a missing
ASIN gets a new page, an existing one gets its Price/Currency/Checked properties patched.
Helpers: sellermagnet.py and retry.py from the Python quickstart post.
"""
import os
import re
import time
import requests
from retry import get_with_retry
from sellermagnet import ApiError, new_session
ASIN_RE = re.compile(r"^[A-Z0-9]{10}$") # offers calls are billed even for a typo, so filter first
MARKETPLACE = "ATVPDKIKX0DER" # amazon.com
ASINS = ["B0CL61F39H", "B0EXAMPLE1", "B0EXAMPLE2", "B0EXAMPLE3"]
NOTION_API = "https://api.notion.com/v1"
NOTION_VERSION = "2025-09-03" # pin a version; this script was written against this one
NOTION_RATE_DELAY = 0.4 # keeps every connection under the 3 req/s average
ASIN_PROP = "ASIN" # title property
PRICE_PROP = "Price" # number property
CURRENCY_PROP = "Currency" # rich_text property
CHECKED_PROP = "Checked" # date property
def notion_headers(token: str) -> dict:
return {"Authorization": f"Bearer {token}", "Notion-Version": NOTION_VERSION, "Content-Type": "application/json"}
def notion_request(method: str, url: str, token: str, body: dict | None = None) -> dict:
"""One retry on a 429, honouring Retry-After; every other non-2xx is reported, not retried."""
time.sleep(NOTION_RATE_DELAY)
resp = requests.request(method, url, headers=notion_headers(token), json=body, timeout=30)
if resp.status_code == 429:
wait = float(resp.headers.get("Retry-After", 1))
time.sleep(wait)
resp = requests.request(method, url, headers=notion_headers(token), json=body, timeout=30)
data = resp.json()
if resp.status_code >= 300:
raise RuntimeError(f"notion {method} {url.rsplit('/', 1)[-1]}: {resp.status_code} {data.get('message', '')}")
return data
def existing_pages(data_source_id: str, token: str) -> dict:
"""asin -> page_id for every page already in the data source (paginates at 100 per call)."""
pages, cursor = {}, None
while True:
body = {"page_size": 100}
if cursor:
body["start_cursor"] = cursor
data = notion_request("POST", f"{NOTION_API}/data_sources/{data_source_id}/query", token, body)
for row in data["results"]:
title = row["properties"].get(ASIN_PROP, {}).get("title") or []
if title:
pages[title[0]["plain_text"]] = row["id"]
if not data.get("has_more"):
return pages
cursor = data["next_cursor"]
def properties_for(price, currency) -> dict:
return {
PRICE_PROP: {"number": price}, # null clears a stale price, never 0
CURRENCY_PROP: {"rich_text": [{"text": {"content": currency}}] if currency else []},
CHECKED_PROP: {"date": {"start": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())}},
}
def upsert(asin: str, price, currency, data_source_id: str, token: str, pages: dict) -> str:
props = properties_for(price, currency)
if asin in pages:
notion_request("PATCH", f"{NOTION_API}/pages/{pages[asin]}", token, {"properties": props})
return "updated"
props[ASIN_PROP] = {"title": [{"text": {"content": asin}}]}
page = notion_request("POST", f"{NOTION_API}/pages", token,
{"parent": {"type": "data_source_id", "data_source_id": data_source_id}, "properties": props})
pages[asin] = page["id"]
return "created"
def sync(asins: list[str], data_source_id: str, notion_token: str) -> None:
session = new_session()
pages = existing_pages(data_source_id, notion_token)
checked, problems, stopped = 0, [], ""
for asin in dict.fromkeys(a.strip().upper() for a in asins): # dedupe, keep order
if not ASIN_RE.match(asin):
problems.append(f"{asin}: not an ASIN, skipped")
continue
try:
data = get_with_retry(session, "amazon-product-offers", asin=asin, marketplaceId=MARKETPLACE)
except ApiError as err:
if err.status in (401, 403):
stopped = str(err) # bad key or no credits: every further call fails too
problems.append(f"{asin}: stopped: {stopped}")
break
problems.append(f"{asin}: {err}") # 404 = listing gone (billed); Notion untouched
continue
except requests.RequestException as err:
problems.append(f"{asin}: {type(err).__name__} after retries, Notion untouched")
continue
box = data.get("buyBox") or {}
price = box.get("totalPrice") if isinstance(box.get("totalPrice"), (int, float)) else None
currency = (data.get("currency") or {}).get("code")
try:
action = upsert(asin, price, currency, data_source_id, notion_token, pages)
except RuntimeError as err:
problems.append(str(err))
continue
checked += 1
note = "no featured offer" if price is None else f"{price:.2f} {currency}"
print(f"{asin} {action} {note}")
for line in problems:
print(line)
print(f"{checked} synced to Notion, {len(problems)} problem(s)" + (f", stopped: {stopped}" if stopped else ""))
if __name__ == "__main__":
sync(ASINS, os.environ["NOTION_DATA_SOURCE_ID"], os.environ["NOTION_TOKEN"])
Two runs: the first creates three pages and reports one gone ASIN; the second updates all three existing pages (illustrative ASINs apart from the documented B0CL61F39H)
--- run 1: one existing page updated, three new ASINs create pages
B0CL61F39H updated 444.98 USD
B0EXAMPLE1 created 29.99 USD
B0EXAMPLE2 created no featured offer
B0EXAMPLE3: 404: Invalid product
3 synced to Notion, 1 problem(s)
--- run 2: every page now exists, same ASINs re-synced
B0CL61F39H updated 444.98 USD
B0EXAMPLE1 updated 29.99 USD
B0EXAMPLE2 updated no featured offer
B0EXAMPLE3: 404: Invalid product
3 synced to Notion, 1 problem(s)

What the credits and requests actually cost
Every ASIN costs exactly one SellerMagnet credit per sync, whatever the response holds. The Notion side costs API requests, not credits: one query call to find existing pages (more if the watchlist passes 100 rows), then one patch or one create per ASIN. For large lists, run the same offers call inside the worker pool from the bulk ASIN lookup guide.
| Step | Cost | Note |
|---|---|---|
| One /amazon-product-offers call per ASIN | 1 each | Buy Box price, whatever the run finds |
| An ASIN that does not exist (404) | 1 | Billed; the script counts it as an answer, not a failure |
| Retry after a 502 or 503 | 1 per attempt | A 500 without Retry-After is refunded |
| The Notion write itself | 0 SellerMagnet credits | Notion's own rate limit, not a credit cost |
What this does not do
- It does not alert. Unlike the Slack Buy Box alert, this script only keeps Notion current; add a Notion automation or a separate check on the Price property to notify on a drop.
- It tracks the featured offer, not every seller.
buyBox.totalPriceis the one price this script writes; the offer listing API covers every seller on the listing. - It needs the database shared with the integration. A database the integration cannot see answers every call with a 404, which looks identical to a deleted database from the API alone.
- Formulas and rollups are read-only here. The script only writes Price, Currency and Checked; a formula property computed from them updates itself inside Notion.
Frequently Asked Questions
Why query the whole data source first instead of searching for one ASIN at a time?
Querying once per run and building an ASIN to page ID map in memory costs one or two Notion calls for a whole watchlist, instead of one Notion search per tracked ASIN on top of the SellerMagnet call that already costs a credit.
What happens when the ASIN watchlist grows past 100 rows?
A data source query returns at most page_size rows (default and maximum 100) per call. The script follows has_more and next_cursor until every row is read, the same cursor pattern Notion's own docs use for every paginated list endpoint.
Why does a 404 ASIN never touch the Notion page?
A 404 is billed but it means the listing is gone, not that the price dropped to nothing. The script reports it and leaves whatever price Notion already has, rather than writing a value that was never actually read.
Why Price as a number property instead of writing a formatted string?
A Notion number property sorts and filters correctly in a view, and formulas can read it. A rich_text price would display fine but break every numeric filter and sort in the database.
What happens if credits run out mid-run?
The API answers 401 (or 403 during a burst), which is not billed. The script stops instead of calling the remaining ASINs, so no later row is skipped silently; already-synced rows from earlier in the same run keep their new values.
Bottom line: one SellerMagnet call per ASIN, one Notion query to find existing rows, one patch or create per ASIN, and a price that clears to empty instead of lying as 0. The product lookup page lists every response field, and a free account includes 150 credits.