{"openapi":"3.1.0","info":{"title":"BuyerGap API","version":"1"},"servers":[{"url":"https://app.buyergap.com/api/v1"}],"components":{"securitySchemes":{"key":{"type":"http","scheme":"bearer"}}},"paths":{"/account":{"get":{"summary":"Balance of runs.","security":[{"key":[]}],"parameters":[],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/billing/packs":{"get":{"summary":"Packs of runs and their prices.","security":[{"key":[]}],"parameters":[],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/billing/checkout":{"post":{"summary":"Address of the payment page for a pack. A person pays there; the runs appear in the balance after payment.","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"pack_id":"price_..."}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/sandbox/balance":{"post":{"summary":"Sandbox keys only: set the sandbox balance, for example 0 to see the not_enough_runs error.","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"balance":0}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/sites":{"post":{"summary":"Add 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\".","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"url":"https://yourshop.com","personas":"suggest"}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}},"get":{"summary":"Your sites with the names of their personas.","security":[{"key":[]}],"parameters":[],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/sites/{id}":{"get":{"summary":"Site status and its personas.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/personas/library":{"get":{"summary":"Ready-made personas. Send one of them, changed or not, to POST /sites/{id}/personas. Free.","security":[{"key":[]}],"parameters":[],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/sites/{id}/personas":{"post":{"summary":"Add a persona: your own or one from the library.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"name":"Dana, gift buyer","description":"...","goal":"...","motivation":"...","concern":"...","requirements":["Delivery time"]}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/sites/{id}/personas/{persona_id}":{"post":{"summary":"Change a persona; send only the fields to change. A persona of yours changes on every site it is on.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"goal":"..."}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/sites/{id}/personas/{persona_id}/delete":{"post":{"summary":"Take a persona off this site. Finished reports stay.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/runs":{"get":{"summary":"Your latest runs, newest first. Query: site_id, limit (up to 100).","security":[{"key":[]}],"parameters":[],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}},"post":{"summary":"Start one run (1 run from the balance).","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"site_id":"...","persona_id":"...","device":"mobile","url":"optional other page"}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/runs/{id}":{"get":{"summary":"Run status and report.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/runs/{id}/cancel":{"post":{"summary":"Cancel a run that has not started; it is returned.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/runs/{id}/pdf":{"get":{"summary":"Report as PDF.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/runs/{id}/frames/{file}":{"get":{"summary":"Screenshot of a recommendation.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"file","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/experiments":{"post":{"summary":"Compare 2 to 4 addresses with the same personas. The first variant is the control. Runs = variants x personas x devices x repeats.","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"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"}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/experiments/{id}":{"get":{"summary":"Progress, runs and the result.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/experiments/{id}/cancel":{"post":{"summary":"Cancel the runs that have not started; they are returned.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/watches":{"post":{"summary":"Watch 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.","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"site_id":"...","persona_ids":["...","..."],"devices":["mobile"],"every":"week","notify":"changes","url":"optional page to start from","webhook_url":"https://your.system/hook"}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}},"get":{"summary":"Your watches that are not stopped.","security":[{"key":[]}],"parameters":[],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/watches/{id}":{"get":{"summary":"A watch and its last rounds: what got worse or better since the round before. Query: rounds (up to 20).","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/watches/{id}/check":{"post":{"summary":"Start a round now, for example after a release (uses runs_per_round runs). The schedule does not change.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/watches/{id}/pause":{"post":{"summary":"Pause: no rounds until you resume.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/watches/{id}/resume":{"post":{"summary":"Resume a paused watch; the next round is one period away.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}},"/watches/{id}/stop":{"post":{"summary":"Stop for good. Runs not started yet are returned.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{}}}},"responses":{"2XX":{"description":"OK"},"4XX":{"description":"Error: {\"error\":{\"code\",\"message\"}}"}}}}}}