# offerswap.com > OfferSwap is a branded short-link service with mobile deep linking and click/page-view analytics. Short links live at `https://offerswap.com/{code}`; the management API lives at `https://app.offerswap.com/api/*`. OfferSwap was called BuyGoLinks until 2026-11-20. Every `buygolinks.com` short link, campaign link, `/click` button, `t.js` tag and postback URL, and every call to `https://app.buygolinks.com/api/*`, keeps working unchanged. New links show on `offerswap.com`. The API is JSON over HTTPS. Authenticate with a personal access token (format `bgl_<24 base62>`) sent as `Authorization: Bearer `. Create tokens via `POST /api/api-keys`. Supabase JWTs also work but are scoped to UI sessions and expire fast. Prefer personal access tokens for any programmatic use. Short links redirect to exactly the destination URL you provide. OfferSwap does not rewrite or geo-route them. To earn affiliate commission on an Amazon link, include your own Associates tag in the destination URL (e.g. `?tag=yourtag-20`); it passes through untouched. On a phone, an Amazon link opens the Amazon app (falling back to the website), and a tap inside Facebook's or Instagram's own browser moves to Safari or Chrome first, because those browsers cannot open apps. ## Docs - [API reference (HTML)](https://docs.offerswap.com/): human-readable reference for every endpoint. - [OpenAPI 3.1 spec](https://docs.offerswap.com/openapi.yaml): machine-readable spec covering all endpoints, request/response shapes, and error codes. Import into Postman, OpenAI Custom GPT actions, or any OpenAPI client. - [Full reference (single markdown file)](https://docs.offerswap.com/llms-full.txt): every endpoint inlined in one file, optimized for LLM ingestion in a single fetch. ## Core concepts - [Links](https://docs.offerswap.com/#links): create, list, edit, archive short links. The destination URL is passed through untouched (include your own affiliate tag). Optional per-link custom alias on a custom domain (e.g. `click.example.com/summer-sale`). - [Statistics](https://docs.offerswap.com/#statistics): aggregated click stats (by day, country, device, browser, referrer, hour, weekday) for the account or a single link. This covers branded short-link CLICKS only. It does NOT include Tracker page views or campaign traffic. For PAGE VIEWS use the Tracker Dashboard / Properties endpoints below. For a complete "clicks AND page views" picture, read both `GET /api/stats/overview` (link clicks) and `GET /api/tracker/overview` (page views + campaign visits), because they're separate event streams. `GET /api/stats/links?days=30` lists every link with its clicks in a window. `POST /api/links/{id}/campaign` turns a link into a campaign on the same URL (`GET` previews it). An offer has no link of its own: `GET /api/offers` lists the campaign links that reach each one (`campaigns`), and `POST /api/offers/{id}/campaign` makes one (the offer's "Create campaign" button). - [Collections](https://docs.offerswap.com/#collections): group links into folders. Optional rotator alias `/c/{alias}` randomly picks one member per visit. - [Tracking pixels](https://docs.offerswap.com/#tracking-pixels): Meta/TikTok/Google pixels. A pixel never goes on a page and never fires on its own: a short link fires one only when it was picked for that link (on the deep-link interstitial), and a campaign sends only the events it picked in `pixel_events`. Each pixel has a `default_event` (e.g. Facebook `Purchase`, TikTok `CompletePayment`) chosen from the platform's catalog; the event can be overridden per-link. Facebook/TikTok pixels can also store a server-side Conversions API token (`capi_token`, never returned; `capi_token_tail` shows its last four) so a campaign's events fire server-to-server even when the buyer is on the advertiser's own site. Saving a Facebook pixel's id or token returns `meta_check`: Meta's answer to an empty event batch, so nothing is recorded, saying whether the token can send to that dataset. A pixel can also hold a Meta `test_event_code` (its events then land in Test events and never count), reports `last_sent_at` / `last_error` for its last server send, and `POST /api/tracking-pixels/{id}/test` sends one test event. - [Custom domains](https://docs.offerswap.com/#domains): serve short links from your own hostname (e.g. `go.acme.com`) via Cloudflare for SaaS. Paid plans only. `GET /api/domains/{id}/dns` detects the DNS host. In the app, the Connect Cloudflare button adds the CNAME after the user approves on Cloudflare. Without a browser, `POST /api/domains/{id}/connect-cloudflare` does it with a one-time token. - [API keys](https://docs.offerswap.com/#api-keys): personal access tokens for programmatic access. ## Tracker (affiliate-style campaigns) - [Campaigns](https://docs.offerswap.com/#campaigns): one campaign = one tracked short link + N offers (weighted) + N optional landers (weighted) + one pixel. Sales come back on the account's one postback URL. Mints a `click_id` per visit and threads it through landers, outbound clicks, and conversions. A lander the ad links straight to is marked `direct`, so the campaign link goes on to its offers instead of back to the page. A campaign references one saved traffic source (`traffic_source_id`) and has an optional `conversion_pixel_id` + `conversion_event`: when the campaign converts (via the postback, the pixel beacon, or a property tag), OfferSwap fires that ad-platform pixel **server-side via its CAPI token** (the buyer is on the advertiser's own site where a browser pixel can't run, so a pixel without a CAPI token does nothing here), so the conversion reaches the ad platform's optimizer. Which events reach the pixel is the campaign's `pixel_events`: keyed by `conversion` (a sale), a traffic event (`lander_view`: the campaign's landing page shown, or a view of a direct lander from the property tag; `visit`: the ad click reaching the campaign link; `offer_click`: the tap that leaves for the offer) or a custom event slug, each `{ event, first_only? }`, for example `{"conversion":{"event":"Purchase","first_only":true},"upsell":{"event":"Purchase"},"initiate_checkout":{"event":"InitiateCheckout"}}`. A missing key is not sent, bot traffic is never sent, `first_only` sends only the click's first event of that kind, refunds and re-fired orders are never sent, and every event gets its own `event_id`, so a sale and an upsell on one click both count. Null keeps the old rule: sales only, as `conversion_event`. Add `&email=` with the buyer's email to the postback URL so the platform can match the sale: it is hashed before it is sent and never stored. Visits keep Meta's `fbc` (the `_fbc` cookie, or built from the ad's `fbclid`) and `fbp` (`_fbp`) for the same reason. The VALUE reported back for a sale is controlled by `report_value_mode`: `payout` (the real payout), `fixed` (a set number like `$1`), or `adjusted` (real payout minus `report_value_adjust_pct`% and/or `report_value_adjust_flat`), so the operator can withhold their margin from what the platform optimizes against. Routing is editable as an **n8n-style flow graph** (`GET`/`PUT /api/campaigns/{id}/flow`): a `source` node fans out (weighted) to `lander` and/or `offer` nodes, and landers fan out to offers, so a specific lander can route to its own specific offers and you can split-test or divert traffic to another offer visually. A `rule` node (Voluum style rule paths) sends the visitors it matches down its own branches, by country, region, city, device, OS, browser, in-app browser, language, IP range, ISP, referrer domain, URL parameter, time of day or weekday, and everyone else keeps to the plain edges. The flat offer/lander pools are re-derived from the graph on save; campaigns with an unwired graph fall back to flat-pool routing. Every campaign response includes a **`click_url`** (`https://{host}/click`): the single, campaign-agnostic lander click URL the operator pastes into the lander's CTA button. It's the SAME on every campaign, so one lander can be reused across many; the campaign is resolved at click time from the visitor's `bgl_clk_{code}` cookie (short-link traffic) or from the ad's `?utm_campaign={slug}` (matched against any of the campaign's direct-link tags) that the lander forwards onto the CTA (direct-link traffic). The public `/click` endpoint ALWAYS resolves to an offer chosen by the flow graph (reusing the visitor's existing `click_id` + remembered lander branch when present), never a lander, never a dead page, so you change which offer the lander hits by rewiring the flow, not by editing the lander. Two fields support direct-linking and resilience: **`direct_slugs`** lets a campaign claim MULTIPLE direct-link tags: an array of strings or `{ slug, label }` objects, each routing through the campaign's flow, so you can run traffic STRAIGHT to a lander with no tracker hop (put `?utm_campaign={slug}` on the ad URL; the lander forwards it onto the CTA so `/click` resolves the campaign, and the property tag `/t.js` stitches the page view too). Multiple tags make it easy to migrate an older campaign onto a new BGL campaign, or turn a lander already receiving direct traffic into a campaign without renaming its ad URLs. Each `slug` is unique per owner (a collision returns 409 `direct_slug_taken`); `slug` is the sanitized lowercased-alnum+dashes value matched against incoming `utm_campaign`, `label` is the friendly display value (e.g. "ABO Testing Campaign"). The legacy single **`direct_slug`** field is deprecated but still accepted (it's added to the tag set, and responses mirror it to the OLDEST slug for back-compat). **App opening on phones:** an offer that belongs to an app (Amazon, and every app short links open) opens that app on a phone, falling back to its website when the app is not installed; inside Facebook's or Instagram's own browser, which blocks apps, the tap first moves to Safari or Chrome. Each landing page and offer in the flow picks for itself with **`phone_open`**: `browser` (leave Facebook's browser for Safari or Chrome at that step: the ad tap for a landing page, the button tap for an offer), `stay`, or `app`; null keeps the default. Short links take `phone_open` too. Lastly, **`fallback_url`** is the never-dead-end guarantee: if the flow ever yields no live offer, the click goes there (or to the platform default) instead of an error page. - [Traffic sources](https://docs.offerswap.com/#traffic-sources): the platforms you buy traffic from (Facebook, TikTok, Google, …). Each is a user-managed row with a `name`, optional `platform`, and `token_params` mapping the source's click macros (e.g. `{{campaign.id}}`) onto the Google UTM params the resolver captures (`utm_source/medium/campaign/term/content`), so a campaign's short URL is pre-filled and reports label the UTM columns. Campaigns reference one via `traffic_source_id`. - [Offers](https://docs.offerswap.com/#offers): destination URLs, optionally tied to an affiliate network (so the network's expected conversion-param name is used in outbound redirects). An offer never gets a short link of its own: the link that goes in an ad is the campaign's, and the campaign picks the domain. An offer made before that rule may still have a short link on its URL; renaming either one renames the other. - [Landers](https://docs.offerswap.com/#landers): the user's own landing pages. Install the campaign's `p.js` pixel for impressions / time-on-page / outbound clicks. Set `window.bglConversion = true` on a thank-you page to fire a conversion event from the browser. Any page already seen on one of the user's Properties can be turned into a lander: `GET /api/property-pages` lists them, and the campaign flow's lander picker offers them under "From your Properties". - [Affiliate networks](https://docs.offerswap.com/#affiliate-networks): a network sets `conversion_param`, the name its offer URLs read the click id from. Its sales come back on the account's one postback URL (below); networks have no postback URL of their own. An Amazon network can carry an `amazon_tag` (e.g. `yourtagid-20`). Set it and every Amazon link the user adds is auto-tagged into an affiliate link (`?tag={amazon_tag}`) at click time. - [Postback URL](https://docs.offerswap.com/#affiliate-networks): every account has ONE **postback URL**, and it is the only one (Voluum-style): `https://offerswap.com/postback/u/{token}?clickid={clickid}&payout={payout}¤cy={currency}&txid={txid}` (returned as `postback_url` on `GET /api/me`). It matches the click by `clickid` alone (alias `cid`) and credits whichever campaign the click belongs to, so it works for every campaign and every network without ever being updated: networks, webhooks (n8n, Zapier, store order webhooks), anything. Campaigns and networks have no postback URL of their own. Old campaign (`/postback/{token}`) and network (`/postback/n/{token}`) links from before 2026-11-07 still record sales and behave exactly like this one. Conversions are deduped by `txid`: at most one conversion per (account, txid). A re-fired postback with the same txid is ignored, and a re-fire carrying a different payout updates the stored conversion's revenue instead of creating a second one. Postbacks without a txid are always recorded. A sale that arrives with no `payout` books the payout of the offer its click went to, when that offer has one set (Voluum-style); a sent payout always wins, and upsells and custom events never use it. An optional `email` (alias `em`) is hashed and sent to the campaign's ad platform pixel for matching, and never stored. - [Postback events](https://docs.offerswap.com/#affiliate-networks): `event=` on any postback URL says what happened. No event is a sale. `event=refund` and `event=chargeback` are built in and subtract from revenue. Anything else, such as `event=add_to_cart`, `event=upsell` or `event=lead`, is a custom event the user defines at `/api/custom-events`, and each gets its own column in campaign reports. - [Campaign report](https://docs.offerswap.com/#campaigns): `GET /api/campaigns/{id}/stats?group=utm_campaign,utm_medium,offer` stacks up to 3 dimensions into a tree at `report.rows`. Extra params on the inbound link are kept as custom tokens and group as `param:`. - [Split tests](https://docs.offerswap.com/#split-tests): `POST /api/split-tests/scan` finds a landing page's headlines, buttons and images; `POST /api/split-tests` makes a test of up to 3 variants (text, images, button colors); the property tag swaps them per visitor while a revenue bandit moves traffic to the variant making the most money per visitor. `POST /api/split-tests/generate` writes variants with AI (AI credits per plan). - [Report views](https://docs.offerswap.com/#campaigns): `/api/report-views` saves named column layouts (which report columns show, in what order) on the account, and `PUT /api/report-views/active` picks the one reports open on (`fewer`, `all`, or a view id). - [Time zone](https://docs.offerswap.com/#campaigns): reports count days, weekdays and hours in the account's time zone (an IANA name such as `America/New_York`). Read it as `timezone` on `GET /api/me`, set it with `PATCH /api/me {"timezone": "America/New_York"}` (or `null` to clear). `GET /api/campaigns/{id}/stats`, `GET /api/tracker/overview` and `GET /api/properties/{id}/stats` take `?tz=` to override it for one call and echo the zone they used as `timezone`. With no zone set and no `tz`, they count in UTC. - [Properties](https://docs.offerswap.com/#properties): GTM/GA-style site containers. One universal tag `` installed on every page of a site auto-reports pageviews, time-on-page, scroll depth, outbound clicks, and conversions. The tag also **auto-detects Google UTM tags** (`utm_source/medium/campaign/term/content`) off the landing URL and persists them for the visit, so paid-traffic campaigns show up with zero setup. The tag is served from the user's own custom domain (required, because a cross-site tag on offerswap.com gets its visitor cookie partitioned/blocked on iOS/Safari), so properties require an active custom domain. Page events auto-attribute to a campaign when the visitor arrives carrying that campaign's click; otherwise they're organic. Set `window.bglConversion = true` (optionally `window.bglRevenue`) or call `window.bglFireConversion(revenue)` to record a sale. Linked to campaigns many-to-many for reporting. Page views are metered per plan (Free 10k / Small 100k / Medium 1M / Large 10M per month); over the cap, new page views stop recording until the monthly reset, while link clicks (the Links section) stay unlimited and conversions keep recording. - [Dashboard](https://docs.offerswap.com/#tracker-dashboard): a unified, real-time view across BOTH streams (sites + campaigns). `GET /api/tracker/overview?days=14` returns combined totals, a daily activity series, country/device/browser breakdowns, per-property and per-campaign rollups (each campaign with `lander_views` and `direct_lander`), a per-UTM-campaign rollup (auto-detected `utm_*` tags), and the 50 most recent events. `GET /api/tracker/events` is a searchable / filterable / sortable UTM event log (`q`, `stream`, `event`, exact `utm_*` filters, `sort`+`dir`, pagination) returning events + `facets` + `total`. Both event tables are Supabase-Realtime-enabled so the dashboard updates live. `GET /api/tracker/realtime` is the last 30 minutes across everything, Google Analytics Realtime style: active people in the last 30 and 5 minutes, a count per minute, by campaign, by page, the funnel step by step, people per city with coordinates, and gross revenue since midnight (`revenue_today`, before refunds and chargebacks; `net_revenue_today` after them). `GET /api/observed-campaign-tags` lists the distinct `utm_campaign` values actually seen arriving on your properties (each with source/medium/lander, a sanitized `slug`, and whether any of a campaign's direct-link tags already claims each; `claimed_by` is matched by slug across all of a campaign's tags). The campaign editor's direct-link-tag picker uses it so an already-running direct-link campaign can be wired to the right BGL campaign by picking real tags instead of guessing slugs. For a single campaign's Voluum-style drill-down report, `GET /api/campaigns/{id}/stats` (rolling `days` or explicit `from`/`to`) returns totals plus `breakdowns`: grouped rows (visits / clicks / conversions / revenue / ctr / cr / epc) by utm_campaign, utm_source, utm_content, utm_term, lander (the page the click came from, host+path), offer, country, device, and day, with downstream events attributed to the utm values of the visit that minted their click_id (and visits attributed to the offer their click routed to). Any dimension doubles as a drill-down filter query param (`?utm_campaign=…` then read `breakdowns.offer` to see which split-test offer converts for that ad); filters combine and narrow the whole report. ## Resolver - Public, no auth: `GET https://offerswap.com/{code}` redirects (or returns a mobile deep-link page) and logs the click. Each click records country (CF-IPCountry), device, browser, referrer, language.