Skip to main content
The usual case: your shop subscribes its customers to the “Customers” list, tags them by what they buy, and passes unsubscribes back.
Every example uses $LEKALAO_TOKEN (a Read and write token) and $LIST, the id of the list. A list’s id is in GET /api/v1/lists.

Subscribe one person

Answer 201:
Keep the id in your own database: it is what names the person in later calls.

What happens, case by case

skip_confirmation and bringing back people who unsubscribed are your responsibility. Subscribe directly only people whose consent you hold, and do not send someone who unsubscribed back to Lekalao: listen to the subscriber.unsubscribed webhook to keep your own database honest.
Addresses are stored in lower case, without surrounding spaces.

Subscribe in a batch

Up to 1,000 people in one call, for a nightly synchronisation for example:
Up to 100 lines, the answer comes back at once, line by line:
One refused line does not spoil the others. If all of them fail, the code is 422. Past 100 lines, the batch goes to the background like an import. The answer is 202 with the import to follow:
Poll GET /api/v1/imports/{id} until status is completed or failed. The added, updated and failed counters and the detail of the errors are there. replace_tags: true replaces each person’s tags with those of their line instead of adding them.

Import a file

For a CSV or Excel file that is already prepared, send it as it is:
Without mapping, columns are recognised from their headers. Imported people are subscribed without a confirmation e-mail, and those who had unsubscribed come back only when resubscribe_unsubscribed is true. See Import and export.

Find someone

GET /api/v1/subscribers/{id} reads one person.

Update

  • A field left out, or null, changes nothing.
  • attributes, when sent, replaces every attribute.
  • tags, when sent, replaces every tag.

Add and remove tags

To add or remove without knowing the other tags:
A tag the list does not have yet is created. Adding a tag can start an automation. The tags of a list are read with GET /api/v1/lists/{id}/tags and created in advance with POST /api/v1/lists/{id}/tags.

Unsubscribe, subscribe again, delete

In PHP

In JavaScript (Node)