Subscriber API

Keep your newsletter's subscriber list in sync with your shop, CRM or signup forms: add and remove subscribers, and report bounces of mail you send yourself.

All endpoints are POST requests with a JSON body and the API-KEY / API-SECRET headers (see Authentication). Field names use camelCase, as in earlier versions of this API.

Add a subscriber

POST https://obanox.com/api/v1/{slug}/add-subscriber

Body fields

FieldTypeRequiredDescription
emailstringyesEmail address. Max. 120 characters. Not case-sensitive.
firstNamestringnoMax. 40 characters; longer names are cut.
lastNamestringnoMax. 40 characters; longer names are cut.
isVerifiedbooleannotrue: you already have the person's consent; they are active right away. Default false: they get a confirmation email first, see Double opt-in.
birthDaystringno22.01.1993 or 1993-01-22.
segmentsarray of stringsnoUp to 5 segment names, max. 40 characters each, e.g. ["Buyer", "Hamburg"]. Names differing only in upper/lower case count as one. Commas are replaced by spaces. A list has at most 100 different segments; new names beyond that are not saved.
curl -X POST "https://obanox.com/api/v1/my-newsletter/add-subscriber" \
  -H "Content-Type: application/json" \
  -H "API-KEY: your-api-key" \
  -H "API-SECRET: your-api-secret" \
  -d '{
    "email": "[email protected]",
    "firstName": "Max",
    "lastName": "Mustermann",
    "segments": ["Buyer", "Hamburg"]
  }'
<?php
$ch = curl_init('https://obanox.com/api/v1/my-newsletter/add-subscriber');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'email'     => '[email protected]',
        'firstName' => 'Max',
        'segments'  => ['Buyer', 'Hamburg'],
    ]),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 10,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'API-KEY: ' . getenv('OBANOX_API_KEY'),
        'API-SECRET: ' . getenv('OBANOX_API_SECRET'),
    ],
]);
$result = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

if ($status >= 300) {
    // handle $result['error'], see "Errors"
}
const response = await fetch('https://obanox.com/api/v1/my-newsletter/add-subscriber', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'API-KEY': process.env.OBANOX_API_KEY,
    'API-SECRET': process.env.OBANOX_API_SECRET,
  },
  body: JSON.stringify({
    email: '[email protected]',
    firstName: 'Max',
    segments: ['Buyer', 'Hamburg'],
  }),
});
const result = await response.json();
import os
import requests

response = requests.post(
    "https://obanox.com/api/v1/my-newsletter/add-subscriber",
    headers={
        "API-KEY": os.environ["OBANOX_API_KEY"],
        "API-SECRET": os.environ["OBANOX_API_SECRET"],
    },
    json={
        "email": "[email protected]",
        "firstName": "Max",
        "segments": ["Buyer", "Hamburg"],
    },
    timeout=10,
)
result = response.json()

201 Created for a new subscriber, 200 OK when the address is already on the list ("created": false):

{
  "success": true,
  "message": "+ok",
  "id": 1341,
  "status": "pending",
  "created": true,
  "segments": ["Buyer", "Hamburg"]
}

segments lists the segments that were saved. Names that were not saved (too long, more than 5, or the list's limit of 100 segments reached) are listed in droppedSegments, which is only present then; the subscriber is added anyway.

Existing subscribers are not changed: name, birthday and segments stay as they are. status is one of active, pending (waiting for confirmation), unsubscribed, soft_bounce and hard_bounce.

  • Without isVerified (or false) the subscriber is pending and gets an email asking to confirm. Only after the click are they active and receive your posts (and your welcome email, if enabled).
  • Adding a pending, unsubscribed or soft-bounced address again sends a new confirmation email (at most one every 10 minutes). Active and hard-bounced subscribers are left alone.
  • With "isVerified": true you confirm that the person agreed to receive your newsletter, e.g. through your own double opt-in. They are active at once and no email is sent. An unsubscribed person is not re-subscribed this way, as long as they are still on the list. After remove-subscriber the address is gone, and adding it again counts as a new subscription.
  • While your newsletter is paused or your account's email address isn't confirmed, new subscribers are still stored as pending. Their confirmation email is sent as soon as the newsletter can send again, if that happens within 7 days.

Remove a subscriber

POST https://obanox.com/api/v1/{slug}/remove-subscriber

Deletes the subscriber completely, including an unsubscribed or bounced status. Identify them by email or by unsubscribeKey (the key in their personal unsubscribe link); with both, both must match.

{ "email": "[email protected]" }

200 OK with "removed": true, or "removed": false when no such subscriber exists. Removing someone who isn't on the list is no error.

To respect an unsubscribe request, prefer the unsubscribe link in your emails: it keeps the address as unsubscribed, so it can't be added back by mistake. A removed address can be added again, also with "isVerified": true, so only do that with fresh consent.

Report bounces

Mail sent through obanox is checked for bounces automatically. If you send to your subscribers through your own mail server, report its bounces here so obanox stops mailing those addresses.

EndpointEffect
POST /api/v1/{slug}/hard-bounceActive or soft-bounced subscriber → hard_bounce: the address doesn't exist; no more emails.
POST /api/v1/{slug}/soft-bounceActive subscriber → soft_bounce: temporary problem, e.g. full mailbox; no more emails until the bounce is removed. Never replaces a hard bounce.
POST /api/v1/{slug}/remove-bounceSoft- or hard-bounced subscriber → active again. Only remove a hard bounce when you know the address works again.
{ "email": "[email protected]" }

All three return 200 OK with "updated": true when the status changed. Other cases are no error and return "updated": false: unknown addresses, and subscribers in another status. Pending subscribers stay pending (they haven't confirmed, so they get no posts to bounce) and unsubscribed ones stay unsubscribed.

Responses

For compatibility with earlier versions, every response has success (true / false) and a message. Errors additionally have error, like the other obanox APIs. Rely on the HTTP status code.

Errors

{
  "success": false,
  "message": "Missing required fields: email",
  "error": "Missing required fields: email"
}
StatuserrorWhat it means
401Invalid api-key or api-secret.Headers missing or wrong.
403Access to this list denied.The slug doesn't exist or belongs to another account.
404Unknown API endpoint. …The path is wrong.
422The body must be a JSON object.The body isn't valid JSON.
422Missing required fields: …email (or for removing: email or unsubscribeKey) is missing.
422… is not a valid email address.The email is invalid or longer than 120 characters.
422Missing or invalid fields: …E.g. birthDay isn't a real date, or segments isn't a list.
Changed from earlier versions: wrong credentials now return 401 and a foreign list 403 (before: 422 for every error), and successful removals and bounces return 200. Without isVerified, new subscribers now receive a confirmation email; before, they stayed pending without one. Bounce reports only change active or bounced subscribers.