Headless integration

Everything below is server-to-server. It needs an API key, which must never reach a browser.

1. Authenticate

Create a key in your dashboard and send it as a bearer token. A key can only ever do what your account could: it narrows, it never widens.

curl https://tryme.com/api/v1/eligibility/decide \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"campaignType":"product_page"}'

2. Send events

Batched, up to 100 at a time. An idempotency-key header is required: a network timeout is indistinguishable from a failure, so you will retry, and this makes retrying safe.

curl https://tryme.com/api/v1/events \
  -H "Authorization: Bearer tk_live_..." \
  -H "idempotency-key: 2026-06-01-page-view-8842" \
  -H "Content-Type: application/json" \
  -d '{"events":[{"type":"behavior.product_viewed","payload":{"productId":"prd_123"}}]}'

3. Ask which offer to show

This returns the same decision the embedded widget would make, because it is the same code.

{
  "ok": true,
  "decision": "offer",
  "offerId": "ofr_...",
  "campaignId": "cmp_..."
}

4. Claim on a shopper’s behalf

Also idempotent: two journeys for one shopper is a second sample shipped.

curl https://tryme.com/api/v1/journeys \
  -H "Authorization: Bearer tk_live_..." \
  -H "idempotency-key: order-8842-claim" \
  -H "Content-Type: application/json" \
  -d '{"offerSlug":"harbour-fog-trial","shopper":{"email":"...","line1":"...","city":"...","postalCode":"...","country":"GB"}}'

Prefer to keep shoppers off your own forms? claimUrl in the SDK links to a claim page we render, which works without JavaScript. Claiming takes a name and an address, and our browser code deliberately never touches those.