GET /account
Balance of runs.
Example request
curl "https://app.buyergap.com/api/v1/account" \ -H "Authorization: Bearer $BUYERGAP_KEY"
Example answer
{
"mode": "live",
"balance": 12
}Start visits and A/B experiments from your own programs. Requests and answers are JSON.
Base address: https://app.buyergap.com/api/v1. For code generators: openapi.json.
BuyerGap works inside Claude, ChatGPT, Cursor and other apps that support MCP. Connect once, then just ask in plain words. The app adds your site, picks customers, starts visits and explains the reports.
Server address: https://app.buyergap.com/mcp
| App | How to connect |
|---|---|
| Claude (claude.ai, desktop and mobile) | Settings, Connectors, Add custom connector. Name: BuyerGap, address: the server address above. Press Connect, sign in to BuyerGap and press Allow. |
| ChatGPT | In Settings, Apps & Connectors, Advanced settings, turn on Developer mode. Then Create a connector: name BuyerGap, address above, authentication OAuth. Sign in to BuyerGap and press Allow. Your plan must allow custom connectors. |
| Claude Code | In a terminal: claude mcp add --transport http buyergap https://app.buyergap.com/mcp, then type /mcp in Claude Code and sign in. |
| Cursor, VS Code, Windsurf and others | Add a remote (HTTP) MCP server with the address above. Apps that cannot sign in with OAuth can send an API key: header Authorization: Bearer bg_live_… (create the key in Account). |
~/.cursor/mcp.json){
"mcpServers": {
"buyergap": {
"url": "https://app.buyergap.com/mcp"
}
}
}With a key instead of signing in:
{
"mcpServers": {
"buyergap": {
"url": "https://app.buyergap.com/mcp",
"headers": {
"Authorization": "Bearer bg_live_..."
}
}
}
}Every visit uses 1 run from your balance. Before it starts visits, an experiment or watching, the app tells you how many runs it needs and waits for your yes. When watching starts, we also email you with a Stop button. You can disconnect an app at any time in Account. To try without spending anything, connect with a sandbox key (bg_test_…).
Sites change every week: a new banner, a checkout update, a plugin. Watching sends the same customers on a schedule and tells you when something they need got harder (or easier) to find.
POST /watches. Pick 1 to 5 customers, phone and/or computer, and how often: every day, week or month.curl -X POST "https://app.buyergap.com/api/v1/watches/$WATCH_ID/check" -H "Authorization: Bearer $BUYERGAP_KEY" -H "Idempotency-Key: release-$GIT_SHA"
Pause or stop at any time: in the app, on the Watching page, or with POST /watches/{id}/pause and /stop. When your balance is too small, a round is skipped and we tell you once.
Prefer that we choose the customers, connect it to your releases and look after it? We can do it for you.
ready.export BUYERGAP_KEY=bg_test_...
# 1. Add a site
curl -X POST "https://app.buyergap.com/api/v1/sites" \
-H "Authorization: Bearer $BUYERGAP_KEY" -H "Content-Type: application/json" \
-d '{"url":"https://normal.sandbox.example/"}'
# 2. Repeat until "status" is "ready"; note a persona id
curl "https://app.buyergap.com/api/v1/sites/$SITE_ID" -H "Authorization: Bearer $BUYERGAP_KEY"
# 3. Start a run, then repeat the GET until "status" is "ready"
curl -X POST "https://app.buyergap.com/api/v1/runs" \
-H "Authorization: Bearer $BUYERGAP_KEY" -H "Content-Type: application/json" \
-d '{"site_id":"'$SITE_ID'","persona_id":"'$PERSONA_ID'","device":"mobile"}'
curl "https://app.buyergap.com/api/v1/runs/$RUN_ID" -H "Authorization: Bearer $BUYERGAP_KEY"Send the key with every request: Authorization: Bearer bg_live_.... Keep it on your server. We store only a fingerprint, so a lost key cannot be shown again: revoke it and create another.
| Key | What it does |
|---|---|
bg_test_… | Sandbox. Separate data, nothing is visited, no run is spent. You start with 100 sandbox runs. |
bg_live_… | Real visits. Spends your balance. |
Every answer has the header BuyerGap-Mode.
POST /sites and wait until it is ready. The answer lists its personas.POST /experiments. Each variant needs its own public address: a preview address, or a parameter such as ?variant=b. Variants chosen by a cookie are not supported.GET /experiments/{id} until status is finished.result.comparisons[].verdict: variant_better, control_better, no_clear_difference, not_enough_data or inconclusive.A run is one persona on one device. The balance is a number of runs.
/accountBalance of runs.
curl "https://app.buyergap.com/api/v1/account" \ -H "Authorization: Bearer $BUYERGAP_KEY"
{
"mode": "live",
"balance": 12
}/billing/packsPacks of runs and their prices.
curl "https://app.buyergap.com/api/v1/billing/packs" \ -H "Authorization: Bearer $BUYERGAP_KEY"
/billing/checkoutAddress of the payment page for a pack. A person pays there; the runs appear in the balance after payment.
{
"pack_id": "price_..."
}curl -X POST "https://app.buyergap.com/api/v1/billing/checkout" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{"pack_id":"price_..."}'A site is read once. Studying it and suggesting three personas is free for your first site and uses 1 run for later ones.
/sitesAdd a site. personas "suggest" studies it and suggests three customers (the first site is free, later ones may cost runs, see runs_charged); "own" only checks that it opens, free. Repeat the GET until status is "ready".
{
"url": "https://yourshop.com",
"personas": "suggest"
}curl -X POST "https://app.buyergap.com/api/v1/sites" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Idempotency-Key: any-unique-text" \
-H "Content-Type: application/json" \
-d '{"url":"https://yourshop.com","personas":"suggest"}'/sites/{id}Site status and its personas.
curl "https://app.buyergap.com/api/v1/sites/$ID" \ -H "Authorization: Bearer $BUYERGAP_KEY"
{
"id": "b5c1c8f2-0d5e-4b8e-9a57-1f2f3c4d5e6f",
"url": "https://yourshop.com/",
"status": "ready",
"error": null,
"personas": [
{
"id": "b5c1c8f2-0d5e-4b8e-9a57-1f2f3c4d5e6f",
"name": "Dana, gift buyer",
"description": "Buys a present for a friend.",
"goal": "Decide whether a gift can arrive by Friday.",
"motivation": "A safe choice that arrives on time.",
"concern": "Can it be exchanged?",
"requirements": [
"Delivery time",
"Return rules"
],
"origin": "suggested"
}
]
}/sitesYour sites with the names of their personas.
curl "https://app.buyergap.com/api/v1/sites" \ -H "Authorization: Bearer $BUYERGAP_KEY"
Every persona belongs to one site. Use the suggested ones, take some from the library or write your own.
/personas/libraryReady-made personas. Send one of them, changed or not, to POST /sites/{id}/personas. Free.
curl "https://app.buyergap.com/api/v1/personas/library" \ -H "Authorization: Bearer $BUYERGAP_KEY"
/sites/{id}/personasAdd a persona: your own or one from the library.
{
"name": "Dana, gift buyer",
"description": "...",
"goal": "...",
"motivation": "...",
"concern": "...",
"requirements": [
"Delivery time"
]
}curl -X POST "https://app.buyergap.com/api/v1/sites/$ID/personas" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Dana, gift buyer","description":"...","goal":"...","motivation":"...","concern":"...","requirements":["Delivery time"]}'/sites/{id}/personas/{persona_id}Change a persona; send only the fields to change. A persona of yours changes on every site it is on.
{
"goal": "..."
}curl -X POST "https://app.buyergap.com/api/v1/sites/$ID/personas/$PERSONA_ID" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{"goal":"..."}'/sites/{id}/personas/{persona_id}/deleteTake a persona off this site. Finished reports stay.
curl -X POST "https://app.buyergap.com/api/v1/sites/$ID/personas/$PERSONA_ID/delete" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'A visit takes about 15 minutes. A visit that fails, is blocked or stops early goes back to your balance.
/runsYour latest runs, newest first. Query: site_id, limit (up to 100).
curl "https://app.buyergap.com/api/v1/runs" \ -H "Authorization: Bearer $BUYERGAP_KEY"
/runsStart one run (1 run from the balance).
{
"site_id": "...",
"persona_id": "...",
"device": "mobile",
"url": "optional other page"
}curl -X POST "https://app.buyergap.com/api/v1/runs" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Idempotency-Key: any-unique-text" \
-H "Content-Type: application/json" \
-d '{"site_id":"...","persona_id":"...","device":"mobile","url":"optional other page"}'/runs/{id}Run status and report.
curl "https://app.buyergap.com/api/v1/runs/$ID" \ -H "Authorization: Bearer $BUYERGAP_KEY"
{
"id": "b5c1c8f2-0d5e-4b8e-9a57-1f2f3c4d5e6f",
"site_id": "b5c1c8f2-0d5e-4b8e-9a57-1f2f3c4d5e6f",
"experiment_id": null,
"variant": null,
"persona": "Dana, gift buyer",
"device": "mobile",
"status": "ready",
"charged": true,
"engine": "app-4c01cb0",
"created_at": "2026-12-01T11:36:20.000Z",
"finished_at": "2026-12-01T11:58:02.000Z",
"report": {
"summary": "Dana found the price but not the delivery date.",
"verdict": "Left without buying.",
"note": null,
"steps": 24,
"pages_checked": 18,
"needs": [
{
"need": "Delivery time",
"status": "not_found",
"detail": "No date on the product page.",
"url": "https://yourshop.com/mug"
}
],
"recommendations": [
{
"id": 1,
"title": "Show the delivery date on the product page",
"saw": "The page shows a price and no date.",
"why": "Dana needs it by Friday.",
"todo": [
"Add the date next to the button"
],
"priority": 1,
"kind": "fix",
"url": "https://yourshop.com/mug",
"step": 7,
"screenshot": "https://app.buyergap.com/api/v1/runs/…/frames/0007-original.png"
}
],
"pdf": "https://app.buyergap.com/api/v1/runs/…/pdf"
}
}/runs/{id}/cancelCancel a run that has not started; it is returned.
curl -X POST "https://app.buyergap.com/api/v1/runs/$ID/cancel" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'/runs/{id}/pdfReport as PDF.
curl "https://app.buyergap.com/api/v1/runs/$ID/pdf" \ -H "Authorization: Bearer $BUYERGAP_KEY"
/runs/{id}/frames/{file}Screenshot of a recommendation.
curl "https://app.buyergap.com/api/v1/runs/$ID/frames/$FILE" \ -H "Authorization: Bearer $BUYERGAP_KEY"
| Status | Meaning | Charged |
|---|---|---|
queued | Waiting | |
visiting, checking, building | In progress | |
ready | The report is complete | yes |
partial | The visit stopped early; what was seen is in the report | returned |
blocked | The site stopped our browser | returned |
failed, cancelled | No report | returned |
The same personas visit 2 to 4 addresses. The first variant is the control.
/experimentsCompare 2 to 4 addresses with the same personas. The first variant is the control. Runs = variants x personas x devices x repeats.
{
"site_id": "...",
"name": "New pricing page",
"variants": [
{
"name": "A",
"url": "https://yourshop.com/pricing"
},
{
"name": "B",
"url": "https://preview.yourshop.com/pricing"
}
],
"persona_ids": [
"...",
"...",
"..."
],
"devices": [
"desktop",
"mobile"
],
"repeats": 1,
"webhook_url": "https://your.system/hook"
}curl -X POST "https://app.buyergap.com/api/v1/experiments" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Idempotency-Key: any-unique-text" \
-H "Content-Type: application/json" \
-d '{"site_id":"...","name":"New pricing page","variants":[{"name":"A","url":"https://yourshop.com/pricing"},{"name":"B","url":"https://preview.yourshop.com/pricing"}],"persona_ids":["...","...","..."],"devices":["desktop","mobile"],"repeats":1,"webhook_url":"https://your.system/hook"}'/experiments/{id}Progress, runs and the result.
curl "https://app.buyergap.com/api/v1/experiments/$ID" \ -H "Authorization: Bearer $BUYERGAP_KEY"
{
"id": "b5c1c8f2-0d5e-4b8e-9a57-1f2f3c4d5e6f",
"name": "New pricing page",
"site_id": "b5c1c8f2-0d5e-4b8e-9a57-1f2f3c4d5e6f",
"status": "finished",
"variants": [
{
"name": "A",
"url": "https://yourshop.com/pricing"
},
{
"name": "B",
"url": "https://preview.yourshop.com/pricing"
}
],
"devices": [
"desktop",
"mobile"
],
"repeats": 1,
"progress": {
"total": 12,
"finished": 12,
"ready": 12
},
"created_at": "2026-12-01T09:00:00.000Z",
"finished_at": "2026-12-01T13:10:00.000Z",
"result": {
"comparisons": [
{
"control": "A",
"variant": "B",
"verdict": "variant_better",
"pairs": 6,
"variant_better_in": 6,
"control_better_in": 0,
"equal_in": 0,
"mean_difference": 0.31,
"p_value": 0.031
}
]
},
"runs": []
}/experiments/{id}/cancelCancel the runs that have not started; they are returned.
curl -X POST "https://app.buyergap.com/api/v1/experiments/$ID/cancel" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'The same personas visit a site every day, week or month; each round is compared with the one before.
/watchesWatch a site: the same personas visit it every day, week or month, and you hear when something changed. The first round starts at once. Each round uses runs_per_round runs. Send dry_run: true first to see the cost.
{
"site_id": "...",
"persona_ids": [
"...",
"..."
],
"devices": [
"mobile"
],
"every": "week",
"notify": "changes",
"url": "optional page to start from",
"webhook_url": "https://your.system/hook"
}curl -X POST "https://app.buyergap.com/api/v1/watches" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{"site_id":"...","persona_ids":["...","..."],"devices":["mobile"],"every":"week","notify":"changes","url":"optional page to start from","webhook_url":"https://your.system/hook"}'/watchesYour watches that are not stopped.
curl "https://app.buyergap.com/api/v1/watches" \ -H "Authorization: Bearer $BUYERGAP_KEY"
/watches/{id}A watch and its last rounds: what got worse or better since the round before. Query: rounds (up to 20).
curl "https://app.buyergap.com/api/v1/watches/$ID" \ -H "Authorization: Bearer $BUYERGAP_KEY"
/watches/{id}/checkStart a round now, for example after a release (uses runs_per_round runs). The schedule does not change.
curl -X POST "https://app.buyergap.com/api/v1/watches/$ID/check" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'/watches/{id}/pausePause: no rounds until you resume.
curl -X POST "https://app.buyergap.com/api/v1/watches/$ID/pause" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'/watches/{id}/resumeResume a paused watch; the next round is one period away.
curl -X POST "https://app.buyergap.com/api/v1/watches/$ID/resume" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'/watches/{id}/stopStop for good. Runs not started yet are returned.
curl -X POST "https://app.buyergap.com/api/v1/watches/$ID/stop" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{}'Only for keys that start with bg_test_.
/sandbox/balanceSandbox keys only: set the sandbox balance, for example 0 to see the not_enough_runs error.
{
"balance": 0
}curl -X POST "https://app.buyergap.com/api/v1/sandbox/balance" \
-H "Authorization: Bearer $BUYERGAP_KEY" \
-H "Content-Type: application/json" \
-d '{"balance":0}'The address decides what happens, so you can test every case:
| Address | Outcome |
|---|---|
https://better.sandbox.example/ | finds everything |
https://worse.sandbox.example/ | finds nothing |
https://fail.sandbox.example/ | the visit fails and is returned |
https://blocked.sandbox.example/ | the site blocks the visit, returned |
https://partial.sandbox.example/ | the visit stops early, returned |
| any other address | a mixed report |
A site is ready in about 5 seconds, a run in about 15.
Give webhook_url when you create an experiment or a watch. We send a POST when the experiment ends or a round of the watch is done (type watch.round) and try 6 times in about 9 hours. The header BuyerGap-Signature: t=TIME,v1=HEX proves it is ours: HEX is HMAC-SHA256 of TIME.BODY with the webhook_secret from the answer to POST /experiments. Check it before you trust the body:
import { createHmac, timingSafeEqual } from 'node:crypto';
function isFromBuyerGap(rawBody, header, secret) {
const t = /t=(\d+)/.exec(header)?.[1], v1 = /v1=([0-9a-f]+)/.exec(header)?.[1];
if (!t || !v1 || Math.abs(Date.now() / 1000 - t) > 300) return false;
const want = createHmac('sha256', secret).update(t + '.' + rawBody).digest();
const got = Buffer.from(v1, 'hex');
return got.length === want.length && timingSafeEqual(got, want);
}{
"error": {
"code": "not_enough_runs",
"message": "You need 12 runs and have 3."
}
}| HTTP | Code | What to do |
|---|---|---|
| 400 | invalid_request | Fix the request; the message says what is wrong |
| 401 | unauthorized | Check the key |
| 402 | not_enough_runs | Buy runs |
| 403 | forbidden | The account is paused, or the request needs another kind of key |
| 404 | not_found | The id is wrong or belongs to another account |
| 409 | site_not_ready, conflict, idempotency_conflict | Wait, or use a new Idempotency-Key |
| 429 | too_many_requests | Wait a minute |
| 500 | server_error | Repeat with the same Idempotency-Key |
Idempotency-Key with every POST that spends runs. A repeated request gets the first answer and is not charged again.