The AB Marketing API

The AB Marketing API lets your other systems — your online shop, your app, your CRM — send in their contacts, what those people agreed to, their unsubscribes, and what they did after an email. An API is a way for one program to talk to another; this page is for whoever looks after those systems, and it carries the full reference, so an integration can be built from it alone.

Create a key

  1. Open API from the workspace’s buttons. Only a Manager or an Admin can create or revoke keys.
  2. Say Which system will use it, e.g. Online shop (production). Make one key per system, so each can be revoked on its own.
  3. Click Create key, copy it from Copy this key now into the other system’s secret settings, and click I’ve stored it.

Each key shows when it was created and last used. Revoke refuses that system from then on; what it already sent is kept.

What the API does

Base address https://blz.actionbridge.io. Send the key on every call as Authorization: Bearer mk_… (or X-AB-Key: mk_… if your tool can’t set that header). Requests and answers are JSON.

CallFor
GET /api/marketing/topicsThe workspace’s topics and their ids. Topics are made in the app, never through the API.
POST /api/marketing/contactsUp to 500 contacts per call, each with optional consent per topic, or an unsubscribe, bounce or complaint
POST /api/marketing/eventsUp to 500 events — “bought”, “booked a demo” — which become Acted in your results

Up to 120 calls a minute from one address. Each contact and each event succeeds or is refused on its own, with a reason, so one bad row never stops the rest.

Or: the website tag

If what you want to count happens on your website — a sign-up, a purchase — you may not need anyone to call the API. The website tag is a snippet for your pages that reports those events from the visitor’s browser.

  1. Enter your website’s domains. On the API page, under Website tag, type them in Your website’s domains (one per line, such as example.com; subdomains are included) and click Save domains. A Manager or an Admin can do this.
  2. Paste the snippet into every page, before </head>. It is shown once the domains are saved, with a Copy button.
  3. Tell it the visitor agreed to cookies: when your cookie banner records consent, call abm('consent', 'granted').
  4. Report what they did: abm('event', 'purchase', { id: 'order-1042' }). The id is optional; with it, a repeat counts once.

The key in the snippet is not a secret; it only works from pages on your domains. Replace key issues a new one, and pages with the old snippet stop counting until you paste the new one. Use the API instead for what happens away from your website, such as an order confirmed in your back office.

The Website tag section on the API page, after the domains are saved.
The Website tag section on the API page, after the domains are saved.

The same rules as a person

  • Consent needs a basis — opt-in, customer, business-card or imported-unknown — and an opt-in needs the name of the wording the person saw (noticeVersion). The same meanings as in Topics and consent.
  • Restoring a withdrawal, or lifting a suppression, needs a reason a person can read later.
  • Sending the same thing again changes nothing, so a nightly sync of everyone is fine.
  • A blank field changes nothing: the API can update a name or company but never empty it.
  • Events are only accepted for people the workspace already knows — a contact it holds or someone it has emailed. Others are refused and nothing about them is kept. Send an id (such as the order number) so a retried call records the event once.

Unsubscribing on your own site

If your system keeps track of who wants your email, readers can unsubscribe on your site instead of on ours. Set your unsubscribe address on the Sending page (see Connecting your email service), then send each contact’s unsubscribeToken: your own id for that person, which is put into your address where it says {token}. A reader with no token keeps our unsubscribe link.

  • Accept the one-click request. Gmail’s and Yahoo’s unsubscribe button sends a POST to your address with the body List-Unsubscribe=One-Click (RFC 8058), without showing a page. Your address must accept it and unsubscribe the person without asking anything more.
  • Send the unsubscribe back. Post it as a withdrawal for the topic or as "suppress": "unsubscribed". Until you do, we keep sending to them.
  • Keep the token stable. Sending a different token replaces the stored one; a blank or missing one leaves it as it is, so a token can’t be removed through the API yet.

Reference

GET /api/marketing/topics

{ "topics": [ { "id": "3f1c…", "name": "Product news" } ] }

Archived topics are not listed. Consent is always sent against these ids, never names.

POST /api/marketing/contacts

{
  "contacts": [
    {
      "email": "hana@example.jp",
      "name": "Hana Sato",
      "company": "Example KK",
      "locale": "ja-JP",
      "unsubscribeToken": "c-81f2a9",
      "consent": [
        {
          "topic": "3f1c…",
          "granted": true,
          "basis": "opt-in",
          "noticeVersion": "shop-signup-2025-04",
          "occurredAt": "2025-04-02T09:15:00+09:00"
        }
      ]
    },
    { "email": "left@example.jp", "suppress": "unsubscribed" }
  ]
}

A contact (1 to 500 per call):

FieldRequiredNotes
emailyesThe address is the contact. Upper and lower case are the same address.
name, company, localenoFill in or update a contact. A blank or missing field changes nothing. locale is a language tag such as ja-JP or en-US; it picks the signature and footer the person gets (see Connecting your email service). This is the way to change the language of a contact you already hold.
unsubscribeTokennoYour own id for this person, used in your unsubscribe address (see Unsubscribing on your own site above). Up to 500 characters, with no spaces. A different one replaces the stored token; a blank or missing one changes nothing.
consentnoAt most 50 items. See the next table.
suppressnounsubscribed, hard-bounce or complaint. After this nothing is sent to the address, whatever its topics say.
liftSuppressionnotrue to undo a suppression. Needs reason. Not together with suppress.
reasonwith liftSuppressionWhy the address may receive mail again, in words a person can read later.

A consent item:

FieldRequiredNotes
topicyesA topic id from GET /topics.
grantedyestrue: they agreed. false: they withdrew.
basiswhen granted is trueopt-in, customer, business-card or imported-unknown.
noticeVersionwhen basis is opt-inThe name of the wording they agreed to, one you will still recognise later, such as shop-signup-2025-04. A new version for the same topic is recorded as a new agreement.
occurredAtnoWhen it happened in your system (ISO 8601). Kept as evidence; it never reorders history and may not be in the future.
reasonto restore a withdrawalA granted: true after a withdrawal is refused without one.

Bringing unsubscribes across from another tool

Do this first, before any contacts with consent, so nobody who opted out elsewhere is ever mailed.

  • Unsubscribed from everything: { "email": "left@example.jp", "suppress": "unsubscribed" }. An address the workspace has never seen becomes a contact that holds only this suppression, with no consent.
  • Unsubscribed from one topic: { "email": "x@example.jp", "consent": [ { "topic": "3f1c…", "granted": false } ] }. This is recorded for an unknown address too.
  • Nothing brings them back by accident. A CSV import never lifts a suppression and leaves alone any topic a person already has history on. Through the API, lifting needs liftSuppression with a reason, and re-granting a withdrawn topic needs a reason. The person themselves can resubscribe from their preferences page.

The answer

200 with one result per contact, in the order sent:

{
  "ok": true,
  "results": [
    { "email": "hana@example.jp", "status": "created", "error": null,
      "consent": [ { "topic": "3f1c…", "status": "recorded", "error": null } ],
      "suppression": null },
    { "email": "left@example.jp", "status": "created", "error": null,
      "consent": [], "suppression": "recorded" }
  ]
}
statusMeaning
createdA new contact
updatedThe name, company, locale or unsubscribe token changed
unchangedNothing to change
recordedA consent item or a suppression was written
refusedNothing was written for it; see error

suppression is null when the contact said nothing about it, otherwise recorded or unchanged.

POST /api/marketing/events

{
  "events": [
    { "email": "pat@example.com", "name": "purchase", "occurredAt": "2026-11-29T10:15:00Z", "id": "order-1042" },
    { "email": "kim@example.com", "name": "demo booked" }
  ]
}
FieldRequiredNotes
emailyesThe person’s address, as you hold it.
nameyesWhat they did, in a few plain words: letters, digits, spaces and _ - . :, up to 64 characters. Use the same name every time for the same thing.
occurredAtnoISO 8601. Defaults to when we received it; not more than a day in the future.
idnoYour own id for the event, such as the order number, up to 128 characters. A retried call then records it once.

An event counts for the last email the person clicked, if that click came in the 7 days before it; clicks by mail scanners never count. Each person counts once per email. The answer is one result per event, in order, with status (recorded or refused), error, and attributed (whether it counted for an email).

Errors

A refused contact, consent item or event carries one of these codes; the rest of the call still goes through.

CodeMeaning
email-invalidThe address is not one
topic-not-foundThe topic id is not one of this workspace’s
topic-archivedThe topic has been archived
basis-unknowngranted: true with no basis, or one not listed above
notice-version-requiredAn opt-in with no noticeVersion
reason-requiredRestoring a withdrawal or lifting a suppression with no reason
occurred-at-invalidoccurredAt is in the future
cause-unknownsuppress is not one of the three values
suppress-and-liftBoth were sent for one contact
too-many-consent-itemsMore than 50 consent items for one contact
unsubscribe-token-invalidAn unsubscribeToken longer than 500 characters, or with a space or a control character in it. Nothing is written for that contact
event-name-invalidAn event name outside the allowed characters or length
contact-not-foundAn event for someone the workspace neither holds nor has emailed

For the whole call: 400 when the request itself is wrong (no contacts or events, or more than 500); 401 with {"ok":false,"error":"Unknown API key."} for any key that is not accepted (malformed, unknown, revoked, or another product’s); 429 past 120 calls a minute from one address — wait a minute and retry.

Not in the API yet

  • Reading contacts back or learning about unsubscribes made in AB Marketing — the API only takes data in.
  • Erasing a contact — ask in the app.
  • Removing an unsubscribe token — a blank one changes nothing.
Published on 2026-11-29
Last updated on 2026-12-04
Version 6