Home / Blog / Amazon Buy Box Lost Alert in Bark: the Key Lives in the Body, Not a Header

Amazon Buy Box Lost Alert in Bark: the Key Lives in the Body, Not a Header

Get an Amazon Buy Box lost alert pushed to your iPhone via Bark: poll the live offer listing for each ASIN, compare the featured offer's sellerId with yours, confirm the change on a second check and call POST /push once per run with the device key inside the JSON body - Bark is the only channel in this series with no auth header at all. Costs one credit per ASIN per check.

November 28, 2026
8 min read
SellerMagnet Team
Share & Bookmark
Terminal window showing the Amazon Buy Box lost alert a Python script pushed via Bark

To get an Amazon Buy Box lost alert pushed through Bark today, poll /amazon-product-offers for each of your ASINs, compare buyBox.sellerId with your own seller ID, and call POST /push once per run: https://api.day.app/push with title, body and device_key in the JSON body. There is no Authorization, no Access-Token, no X-*-Auth-Token header anywhere in the request - Bark is the only channel in this series where the whole credential rides inside the payload. The script below tells a lost Buy Box apart from a suppressed one, confirms a change on a second check, and costs one SellerMagnet credit per ASIN per check.

Key Takeaways

  • There is no auth header at all: device_key lives inside the JSON body (or the URL path on the GET form), unlike every other channel in this series.
  • The outcome is the real HTTP status code (200 success, 400 bad parameters, 403 key invalid, 410 APNs rejected) and a successful call also echoes a JSON {code, message, timestamp} body - the script checks resp.status_code, not the JSON field.
  • Bark bans a source after more than 1,000 erroneous requests in 5 minutes, so a 400 or 403 stops without retry rather than risk the whole channel.
  • A 410 means the phone's APNs token went stale (reinstall, cleared storage); only reopening the Bark app on the phone fixes it, no server-side retry can.
  • buyBox is the featured offer: its sellerId is the seller who holds the Buy Box, the literal "Amazon" when Amazon does.
  • Alert only when two checks in a row agree; each check costs 1 SellerMagnet credit per ASIN, 502/503 retries are billed per attempt, a 500 is refunded, and a free 401/403 stops the run with one push.

How is Bark's auth different from every other channel in this series?

Pushbullet uses an Access-Token header, Viber an X-Viber-Auth-Token header, LINE and Slack a Bearer token - every channel built so far in this series puts the credential in an HTTP header, separate from the message content. Bark (bark.day.app docs, checked 2026-11-27) puts the device key inside the same JSON body as the title and text, with no header at all. That also means the key is as exposed as the message itself: it shows up in request logs, in a copied curl command, in a browser history if ever sent as a GET URL. The docs' own fix for a leaked key is to reset it from the server list page, not to rotate a separate secret.

The four readings and the Bark push each one can trigger.
ResponseReadingBark body
buyBox.sellerId is your sellerIdmineBACK, after a confirmed return
buyBox.sellerId is any other seller or "Amazon"lostLOST, with holder, price and your offer
buyBox is {} and buyBoxSuppressed is truesuppressedNONE
buyBox is {} and offers is []no-offersEMPTY

How do I build the Amazon Buy Box lost alert for Bark?

read_buy_box() turns one offers response into a reading, check() keeps a streak per ASIN in buybox_state.json and queues a line once a new reading has been seen CONFIRM times in a row, and post_to_bark() sends every queued line as one POST /push call with level: "timeSensitive" so the alert pierces iOS Focus/Do Not Disturb. get_with_retry comes from retry.py and ApiError/new_session from sellermagnet.py, both from the Python quickstart. Malformed ASINs are skipped before any call, because the offers endpoint bills a typo like any other request. MY_SELLER_ID has no default on purpose: without it every ASIN would read as lost, so the script refuses to start. Only HTTP 500/502/503 is retried, once, after a fixed backoff; 400, 403 and 410 stop immediately since none of them are fixed by repeating the same request, and the body is capped well under APNs' documented 4 KB payload limit.

buybox_bark_alert.py - offers check, 2-check confirmation, one status-checked POST per run

import json
import os
import re
import time

import requests

from retry import get_with_retry
from sellermagnet import ApiError, new_session

MARKETPLACE_ID = "ATVPDKIKX0DER"                 # amazon.com
MY_SELLER_ID = os.environ["MY_SELLER_ID"]        # your sellerId as it appears in offers[]; no default on purpose
ASINS = ["B0CL61F39H", "B0EXAMPLE2", "B0EXAMPLE3"]
CONFIRM = 2                                      # same reading on 2 checks in a row before Bark hears about it
STATE_FILE = "buybox_state.json"
ASIN_RE = re.compile(r"^[A-Z0-9]{10}$")           # offers calls are billed even for a typo, so filter first

BARK_API = "https://api.day.app/push"
BARK_DEVICE_KEY = os.environ["BARK_DEVICE_KEY"]   # rides inside the JSON body, never a header - see note below
MAX_BODY_CHARS = 3800                              # Bark/APNs push payloads have no documented hard cap on
                                                    # this field, but APNs itself caps a whole payload at 4 KB,
                                                    # so the body is capped defensively well under that
MAX_LINES = 60

# developers.day.app / bark.day.app docs (checked 2026-11-27): the API answers through the real HTTP status
# code, unlike Viber or LINE in this series, AND echoes a JSON {code, message, timestamp} body on success.
PERMANENT_HTTP = {400: "bad parameters", 403: "device key invalid or revoked"}
STALE_TOKEN_HTTP = 410   # APNs rejected the stored device token: app was reinstalled/uninstalled, re-open it


def read_buy_box(session, asin: str) -> tuple[str, str]:
    """('mine' | 'lost' | 'suppressed' | 'no-offers', detail for the message)."""
    data = get_with_retry(session, "amazon-product-offers", asin=asin, marketplaceId=MARKETPLACE_ID)
    box = data.get("buyBox") or {}
    if not box:
        return ("suppressed", "") if data.get("buyBoxSuppressed") else ("no-offers", "")
    holder = box.get("sellerId") or "unknown"
    if holder == MY_SELLER_ID:
        return "mine", ""
    currency = (data.get("currency") or {}).get("code", "")
    detail = f"held by {box.get('sellerName', 'unknown')} ({holder}, {box.get('fulfillment', '?')}) at {box.get('price')} {currency}"
    return "lost", detail


def _load_state() -> dict:
    try:
        with open(STATE_FILE) as f:
            return json.load(f)
    except FileNotFoundError:
        return {}


def _save_state(state: dict) -> None:
    with open(STATE_FILE, "w") as f:
        json.dump(state, f)


def check(session, state: dict) -> list[str]:
    """Advance the streak for every ASIN, return the lines to push this run (confirmed changes only)."""
    lines = []
    for asin in ASINS:
        if not ASIN_RE.match(asin):
            continue
        reading, detail = read_buy_box(session, asin)
        entry = state.get(asin)
        if entry is None:
            state[asin] = {"reading": reading, "streak": CONFIRM, "reported": reading}  # seed, no false alert
            continue
        if entry["reading"] == reading:
            entry["streak"] = min(entry["streak"] + 1, CONFIRM)
        else:
            entry["reading"], entry["streak"] = reading, 1
        if entry["streak"] >= CONFIRM and entry["reported"] != reading:
            entry["reported"] = reading
            if reading == "lost":
                lines.append(f"{asin}: LOST, {detail}")
            elif reading == "mine":
                lines.append(f"{asin}: BACK, you hold the Buy Box again")
    return lines


def post_to_bark(lines: list[str]) -> bool:
    """One POST /push per run. The device key rides inside the JSON body (device_key), never a header - no
    Authorization, no Access-Token, no X-*-Auth-Token anywhere in this request, unlike every other channel
    in this series. Bark signals the outcome through the real HTTP status code (200/400/403/410) and still
    echoes a JSON {code, message, timestamp} body on success. Returns True only on HTTP 200."""
    if not lines:
        return False
    if len(lines) > MAX_LINES:
        lines = lines[:MAX_LINES] + [f"...and {len(lines) - MAX_LINES} more"]
    body_text = "\n".join(lines)
    if len(body_text) > MAX_BODY_CHARS:
        body_text = body_text[:MAX_BODY_CHARS - 20] + "\n...(truncated)"
    payload = {
        "title": "Amazon Buy Box Alert",
        "body": "Amazon Buy Box change, confirmed on 2 checks:\n" + body_text,
        "device_key": BARK_DEVICE_KEY,
        "level": "timeSensitive",   # pierces iOS Focus/DND, documented level for exactly this kind of alert
        "group": "buybox",
    }
    resp = requests.post(BARK_API, headers={"Content-Type": "application/json; charset=utf-8"},
                          data=json.dumps(payload), timeout=30)
    if resp.status_code == 200:
        try:
            ack = resp.json()
        except ValueError:
            ack = {}
        print(f"[bark] code={ack.get('code')} timestamp={ack.get('timestamp')} {payload['body']}")
        return True
    if resp.status_code in PERMANENT_HTTP:
        # 400/403: retrying an already-rejected request changes nothing, and Bark bans a key/IP after
        # 1,000 erroneous requests in 5 minutes (bark.day.app FAQ, checked 2026-11-27) - blind retries
        # on a documented permanent failure risk that ban far more than they risk a missed alert.
        print(f"[bark] STOP HTTP {resp.status_code} {PERMANENT_HTTP[resp.status_code]}, left unreported")
        return False
    if resp.status_code == STALE_TOKEN_HTTP:
        print("[bark] STOP HTTP 410 APNs rejected the device token - reopen the Bark app once, left unreported")
        return False
    if resp.status_code in (500, 502, 503):
        time.sleep(5)
        resp = requests.post(BARK_API, headers={"Content-Type": "application/json; charset=utf-8"},
                              data=json.dumps(payload), timeout=30)
        if resp.status_code == 200:
            try:
                ack = resp.json()
            except ValueError:
                ack = {}
            print(f"[bark] code={ack.get('code')} timestamp={ack.get('timestamp')} {payload['body']}")
            return True
        print(f"[bark] still HTTP {resp.status_code} after 1 retry, left unreported")
        return False
    print(f"[bark] unexpected HTTP {resp.status_code}, left unreported")
    return False


def main() -> None:
    session = new_session()
    state = _load_state()
    lines = check(session, state)
    sent = post_to_bark(lines)
    _save_state(state)
    print(f"{len(ASINS)} checked, {1 if sent else 0} alert(s) sent")


if __name__ == "__main__":
    main()

Five runs of the script (illustrative ASIN and seller; [bark] = the push sent)

$ python3 buybox_bark_alert.py   # run 1, seed, no alert possible yet
1 checked, 0 alert(s) sent

$ python3 buybox_bark_alert.py   # run 2, Buy Box lost, 1st sighting, not confirmed
1 checked, 0 alert(s) sent

$ python3 buybox_bark_alert.py   # run 3, 2nd sighting confirms it, one push
[bark] code=200 timestamp=1732701234 Amazon Buy Box change, confirmed on 2 checks:
B0EXAMPLE2: LOST, held by Example Outlet (A2OTHERSELLER0, FBA) at 18.49 USD
1 checked, 1 alert(s) sent

$ python3 buybox_bark_alert.py   # run 4, device key revoked, HTTP 403
[bark] STOP HTTP 403 device key invalid or revoked, left unreported
1 checked, 0 alert(s) sent

$ python3 buybox_bark_alert.py   # run 5, Buy Box suppressed, never alerts
1 checked, 0 alert(s) sent

What the script actually POSTs (curl equivalent, illustrative values)

curl -s -X POST https://api.day.app/push \\
  -H "Content-Type: application/json; charset=utf-8" \\
  -d '{"title": "Amazon Buy Box Alert", "device_key": "yC9pV2qf6tN8sJ3dXkRzew",
"level": "timeSensitive", "group": "buybox",
"body": "Amazon Buy Box change, confirmed on 2 checks:
B0EXAMPLE2: LOST, held by Example Outlet (A2OTHERSELLER0, FBA) at 18.49 USD"}'
# HTTP/1.1 200
# {"code": 200, "message": "success", "timestamp": 1732701234}
Blueprint flow: offers check per ASIN, two-check confirmation, then one status-checked POST /push call
A reading has to repeat before it reaches Bark; the device key travels inside the body, not a header.

How do I get a Bark device key?

  1. Install the Bark appInstall Bark from the iOS App Store on the phone that should receive the alert; Bark is iOS-only (on Android, Ntfy or Gotify cover the same job).
  2. Open the app to get the keyOpen Bark; the home screen shows the device's own key and the ready-made URL for the public server, api.day.app.
  3. Send a test pushcurl \"https://api.day.app/<your_key>/Hello%20World\"; a successful call answers {\"code\": 200, \"message\": \"success\"} and the phone shows the notification immediately.
  4. Reset the key if it leaksBark's own FAQ treats a leaked key as a live risk since no header protects it further: reset it from the server list page in the app, which immediately invalidates the old one.

Environment file and a cron entry for a 15-minute check (flock -n prevents overlapping runs)

# .env (keep it out of git: the device key is the ONLY credential, there is no separate auth header)
export SELLERMAGNET_API_KEY="your-key-here"
export BARK_DEVICE_KEY="yC9pV2qf6tN8sJ3dXkRzew"   # shown on the Bark app's home screen
export MY_SELLER_ID="A1MYSELLER0001"              # your sellerId as it appears in offers[]

# crontab -e: every 15 minutes, 3 ASINs = 288 credits a day; flock -n skips a run while the last one still runs
*/15 * * * * cd /opt/buybox && . ./.env && flock -n .lock .venv/bin/python buybox_bark_alert.py >> alert.log 2>&1

Bark's own documentation (bark.day.app, checked 2026-11-27) describes the contract the script relies on: the device key is a body parameter, not a header; a successful call is HTTP 200 and also echoes {code, message, timestamp}; a documented failure is a real HTTP status (400, 403, 410); and more than 1,000 erroneous requests from one source in 5 minutes gets that source banned. A 400 or 403 is a real input problem and must not be retried unchanged, a 410 needs the phone-side app reopened, and only a genuine server fault (500/502/503) gets one retry after a fixed backoff.

What should you check when a LOST alert fires?

The alert tells you who holds the Buy Box and at what total price, not why Amazon featured that offer. Amazon's US help page Becoming the Featured Offer (Seller Central, checked 2026-10-23) lists what it weighs: the total price including shipping, a fast and specific delivery promise, free shipping, free returns and seller performance, and an out-of-stock offer cannot be featured. Its Featured Offer guide on sell.amazon.com adds that fulfilling orders yourself can be just as effective as FBA. Start with the gap between the holder's price and your offer in the message, then your delivery date and stock. The Buy Box price gap guide shows why the lowest price alone does not decide it.

How many credits does a Buy Box alert cost?

One offers call per ASIN per check, so the SellerMagnet cost is the number of ASINs times the number of checks; Bark itself is free and ad-free for this volume, unrelated to SellerMagnet credits (self-hosting the Bark server is an option but adds nothing to the SellerMagnet bill either way). With a 2-check confirmation the worst-case delay before Bark hears about a loss is about two intervals. Errors add to the SellerMagnet bill in different ways: a 404 is billed once and not retried, a 502 or 503 is billed on every attempt, a 500 is refunded, and the free gate errors (400 for a missing parameter, 401, 403) cost nothing. The Buy Box monitoring interval guide compares intervals in more detail, and Pricing lists the plans.

Credits per tracked ASIN by check interval (1 credit per offers call).
Check intervalCredits per dayCredits per 30 daysWorst-case alert delay
Every 15 minutes962,880about 30 minutes
Every hour24720about 2 hours
Every 4 hours6180about 8 hours
Once a day130about 2 days
Blueprint table of credits per tracked ASIN for four check intervals and the alert delay
Shorter intervals cost more credits and cut the delay; the confirmation doubles it.

Frequently Asked Questions

Where does the device key go if there is no auth header?

Inside the JSON body, as the device_key field of the POST to https://api.day.app/push (bark.day.app docs, checked 2026-11-27). Bark also supports the key directly in the URL path (/:key/:body), but either way there is no Authorization, Access-Token or X-*-Auth-Token header anywhere in the request - the only channel in this series with no auth header at all. Anyone who gets the key, in a URL, a log line or a screenshot, can push to that phone.

Does Bark hide the result in a JSON field like Viber, or use the HTTP status like Pushbullet?

Both, which makes it the odd one out in this series. The real outcome is the HTTP status code itself (200 success, 400 bad parameters, 403 key invalid, 410 APNs rejected - bark.day.app docs, checked 2026-11-27), the same convention as Pushbullet or LINE. But a 200 also echoes a JSON {code, message, timestamp} body, with code mirroring the HTTP status. The script checks resp.status_code, never the JSON code field, since the status code alone already decides success or failure.

Why retry a 503 but never a 400 or 403?

A 503 is the server's own problem and the same request can simply succeed on a second try. A 400 (bad parameters) or 403 (key invalid/revoked) is a documented permanent rejection: retrying it unchanged never fixes the request and only adds to the error count. Bark's own FAQ (bark.day.app, checked 2026-11-27) bans a source after more than 1,000 erroneous requests in 5 minutes, so a blind retry loop on a 400/403 risks losing the alert channel entirely, not just wasting one call.

What does HTTP 410 mean here, and why does retrying never help?

410 means Apple's APNs rejected the stored device token: the Bark app on the phone was reinstalled, its storage was cleared, or the token simply went stale. The fix lives on the phone, not in the script: reopen the Bark app once so it re-registers a fresh token with the same device key. No number of server-side retries changes an APNs token the phone has to refresh itself.

Is there a client-set idempotency key here, like Pushbullet's guid?

No. Bark's push payload has no caller-chosen de-dupe field; group only labels pushes for on-device display, it does not suppress a duplicate send at the vendor. A retried send after an unknown-outcome timeout can create a second notification, so the script only retries the one outcome it knows is a pure server fault (500/502/503) and leaves every other failure, including a timeout, for the next scheduled run.

What happens when my SellerMagnet credits run out?

The API answers 401 or 403, which is never billed. The script stops instead of calling the remaining ASINs and does not repeat the attempt until a run completes without a 401 or 403.

Bottom line: compare buyBox.sellerId with your own seller ID, keep a streak per ASIN, and send one Bark POST /push call per run with the device key inside the body - check resp.status_code, since Bark is the one channel here with no separate auth header to get wrong. To see who held the Buy Box and for how long after the fact, use the Buy Box history API; a free account includes 150 credits to try the alert.

Related Articles

Continue exploring topics related to this article.

Terminal window showing the Amazon Buy Box lost alert a Python script sent through Threema Gateway
Amazon API Buy Box Alerts

Amazon Buy Box Lost Alert in Threema: a Bare Message ID, Not JSON

Get an Amazon Buy Box lost alert sent through Threema Gateway: poll the live offer listing for each ASIN, compare the featured offer's sellerId with yours, confirm on a second check and POST one form-encoded message per run to send_simple. A successful send answers HTTP 200 with the new message's id as bare plain text, no JSON, while every failure gets its own HTTP status. Tested Python, one credit per ASIN per check.

Nov 29, 2026 Read
Terminal window showing the Amazon Buy Box lost alert a Python script sent via WeCom
Amazon API Buy Box Alerts

Amazon Buy Box Lost Alert in WeCom: Read errcode, Not HTTP Status

Get an Amazon Buy Box lost alert pushed to WeCom (Enterprise WeChat): poll the live offer listing for each ASIN, compare the featured offer's sellerId with yours, confirm the change on a second check and POST one markdown message per run to a group robot webhook. WeCom always answers HTTP 200; the script reads the errcode field inside the JSON body instead, and caps the message on UTF-8 bytes, not characters. Costs one credit per ASIN per check.

Nov 29, 2026 Read
Terminal window showing the Amazon Buy Box lost alert a Python script posted to Chatwork
Amazon API Buy Box Alerts

Amazon Buy Box Lost Alert in Chatwork: Form Body, Not JSON

Get an Amazon Buy Box lost alert posted straight into Chatwork: poll the live offer listing for each ASIN, compare the featured offer's sellerId with yours, confirm the change on a second check and POST one message per run through Chatwork's Add Message endpoint. Covers the X-ChatWorkToken header auth, the form-urlencoded body other channels get wrong by sending JSON, and the two separate 429 rate limiters. Tested Python, one credit per ASIN per check.

Nov 29, 2026 Read
Back to Blog

Ready to Extract Amazon Data at Scale?

Start building with SellerMagnet API today. Real-time product data, competitive pricing, and review analytics at your fingertips.

150 free API credits • No credit card required • Cancel anytime