API reference

Everything under /api/v1. Generated from the surface the API actually serves, so it cannot describe an endpoint that does not exist.

Versioning

Adding a field or an endpoint is additive and does not bump the version. Removing one, renaming one, or changing what an existing field means does. You are outside our control and cannot be migrated, which is why the line is drawn there.

Scopes

ScopeCovers
events.read events.writeSend behaviour and commerce events, and read what you have sent.
eligibility.read eligibility.writeAsk which offer a shopper should see.
offers.read offers.writeRead and manage campaigns, offers and their rules.
trials.read trials.writeRead and manage trial products, journeys and fulfilment.
credits.read credits.writeRead and issue trial credit.
referrals.read referrals.writeRead and create referral links.
analytics.read analytics.writeRead attribution, profit and experiment results.
webhooks.read webhooks.writeManage where we send you events.

write does not imply read. A key that may issue credit but not list it is a real and useful thing.

Rate limits

Per key, per minute. Limits follow cost, not resource: the eligibility call sits between a shopper and a page, and throttling it to protect the reports would cost you sales.

TierPer minute
hot600
standard120
expensive20

Errors

Every error is { ok: false, code, error } with an optional details. Branch on code; the sentence is for your logs. A 409 means the request was fine and the state refused it, which is different from a 400 when you are deciding whether to retry.

CodeStatusMeaning
unauthorized401That key is not valid.
forbidden_scope403This key is missing a scope this endpoint needs.
rate_limited429Too many requests.
invalid_request400The request body is not what this endpoint expects.
idempotency_key_required400This endpoint needs an idempotency key.
batch_too_large400Too many items in one request.
not_found404No such thing, or not yours.
offer_not_available409That offer is not running.
not_eligible409This shopper is not eligible for that offer.
already_claimed409This shopper already has that trial.
trial_sold_out409That trial has run out.
blocked_by_risk409That claim was stopped.
invalid_address400The shipping address could not be used.
credit_exhausted409That credit has nothing left on it.
credit_expired409That credit has expired.
internal_error500Something went wrong on our side.

Endpoints

events

EndpointScopeRateIdempotent
POST /api/v1/events
Send one or more events. Behaviour, commerce or custom.
events.writehotyes
GET /api/v1/events
Read events you have sent, newest first.
events.readstandard·

eligibility

EndpointScopeRateIdempotent
POST /api/v1/eligibility/decide
Which offer, if any, this shopper should be shown.
eligibility.readhot·

offers

EndpointScopeRateIdempotent
GET /api/v1/offers
List offers.
offers.readstandard·
GET /api/v1/offers/:id
One offer, with its rules.
offers.readstandard·
POST /api/v1/offers
Create an offer.
offers.writestandard·
PATCH /api/v1/offers/:id
Change an offer, or publish and pause it.
offers.writestandard·
GET /api/v1/campaigns
List campaigns.
offers.readstandard·

trials

EndpointScopeRateIdempotent
GET /api/v1/trials
List trial products and their stock.
trials.readstandard·
GET /api/v1/journeys
Trial journeys, filterable by state.
trials.readstandard·
POST /api/v1/journeys
Claim a trial on a shopper’s behalf.
trials.writestandardyes
POST /api/v1/journeys/:id/fulfillment
Record shipping or delivery yourself.
trials.writestandardyes

credits

EndpointScopeRateIdempotent
GET /api/v1/credits
Trial credit and what remains of it.
credits.readstandard·
POST /api/v1/credits
Issue credit to a shopper.
credits.writestandardyes

referrals

EndpointScopeRateIdempotent
GET /api/v1/referrals
Referral links and how they have performed.
referrals.readstandard·
POST /api/v1/referrals
Create a referral link for a shopper.
referrals.writestandardyes

analytics

EndpointScopeRateIdempotent
GET /api/v1/analytics/programme
Revenue, cost and contribution profit over a period.
analytics.readexpensive·
GET /api/v1/analytics/attribution
Attributed orders and why each was attributed.
analytics.readexpensive·
GET /api/v1/analytics/experiments/:id
An experiment’s cohorts and incrementality.
analytics.readexpensive·

webhooks

EndpointScopeRateIdempotent
GET /api/v1/webhooks
Where we currently send your events.
webhooks.readstandard·
POST /api/v1/webhooks
Subscribe an endpoint to event types.
webhooks.writestandard·
DELETE /api/v1/webhooks/:id
Stop sending to an endpoint.
webhooks.writestandard·