Synchronising subscribers through the API
With an API connection, sign-ups from your webshop, CRM or website automatically end up in the right list.
Retrieving and storing fields
You pass custom fields under custom_fields, using the field’s custom_name as the key. This name sometimes differs from what you might expect: the field called ‘First name’ in the application is usually called voornaam in the API. Therefore, retrieve these names once and store them in your own code.
Do not retrieve the field names with every sign-up, but store them in your own system and refresh them, for example, once a day. Fields rarely change, and every call counts towards your limit of 30 requests per minute (120 on a paid account). With a busy webshop, you would otherwise quickly use up your limit requesting data you already had.
Adding and updating a subscriber
Include the email address, the IP-address and your custom fields
The IP-address is required: it records where the sign-up came from. You need this to prove that someone signed up themselves.
Unsubscribing or deleting a subscriber
If someone unsubscribes via your own site, it is best to set the subscriber to unsubscribed. Only use delete if someone asks to have their data completely erased.
Synchronising an entire list at once
If you synchronise per subscriber, it will take a long time when you have thousands of subscribers and you will hit the rate limit. Instead, use Synchronise list (bulk): this allows you to send up to 500,000 subscribers as JSON in a single call.
With the PHP library, you send the same content as an array:
With the unsubscribe_excluded action, you unsubscribe everyone who is not included in your submission. Only use this if your system is the source of truth, and not if you are only submitting a part of your file.
Bulk is not enabled by default. It is only available for paid accounts, and Laposta has to enable it per account. If you receive a 401 with “Not permitted to issue bulk requests (1)”, please contact the helpdesk at helpdesk@laposta.nl and state your account number.
What should you watch out for?
- You cannot empty a multiple-choice field by sending an empty list. If you send an empty list for a
select_multiplefield, the existing choices are not cleared. See: Common mistakes. - If you send a label as plain text, all existing labels are cleared. Send
"labels": ["Customer"]and not"labels": "Customer". If you do it wrong, you will simply receive a200withedited_countwithout an error message, but all labels will be empty. See: Common mistakes. - An unknown ID does not return a
404, but a400with code203. Make sure to test for that. - The limit is tighter than you might think on a free account: 30 requests per minute. Build in a delay based on the
Retry-Afterheader instead of retrying immediately.