Subscribe a batch of addresses
Up to 1,000 subscribers in one call. Up to 100, the work happens at once and the answer reports line by line (200). Past that, the batch goes to the background like an import and the answer is an import to follow (202). One line in error does not lose the others.
POST
/
v1
/
lists
/
{list}
/
subscribers
/
batch
Subscribe a batch of addresses
curl --request POST \
--url https://api.lekalao.com/v1/lists/{list}/subscribers/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscribers": [
{
"email": "ada@example.com",
"tags": [
"client"
]
},
{
"email": "alan@example.com",
"locale": "en"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscribers: [
{email: 'ada@example.com', tags: ['client']},
{email: 'alan@example.com', locale: 'en'}
]
})
};
fetch('https://api.lekalao.com/v1/lists/{list}/subscribers/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lekalao.com/v1/lists/{list}/subscribers/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subscribers' => [
[
'email' => 'ada@example.com',
'tags' => [
'client'
]
],
[
'email' => 'alan@example.com',
'locale' => 'en'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.lekalao.com/v1/lists/{list}/subscribers/batch"
payload = { "subscribers": [
{
"email": "ada@example.com",
"tags": ["client"]
},
{
"email": "alan@example.com",
"locale": "en"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": [
{
"index": 0,
"email": "ada@example.com",
"id": "9d5c2a1e-8f3b-4c7a-9e21-3b8f0c6d4a12",
"outcome": "subscribed"
},
{
"index": 1,
"email": "alan@example.com",
"outcome": "failed",
"message": "This address is blocked."
}
],
"meta": {
"added": 1,
"updated": 0,
"failed": 1
}
}{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "draft",
"file_name": "<string>",
"processed": 123,
"added": 123,
"updated": 123,
"failed": 123,
"errors": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z",
"url": "<string>"
},
"meta": {
"queued": 123
}
}{
"message": "The idempotency key is too long.",
"code": "idempotency_key_too_long",
"doc_url": "https://docs.lekalao.com/errors#idempotency_key_too_long"
}{
"message": "Unauthenticated.",
"code": "unauthenticated",
"doc_url": "https://docs.lekalao.com/errors#unauthenticated"
}{
"message": "This team is suspended. Contact support.",
"code": "team_suspended",
"doc_url": "https://docs.lekalao.com/errors#team_suspended"
}{
"message": "Not found.",
"code": "not_found",
"doc_url": "https://docs.lekalao.com/errors#not_found"
}{
"message": "A request with this idempotency key is already running.",
"code": "idempotency_key_in_use",
"doc_url": "https://docs.lekalao.com/errors#idempotency_key_in_use"
}{
"message": "The email field must be a valid email address.",
"code": "validation_error",
"doc_url": "<string>",
"errors": {},
"problem": "disposable",
"suggestion": "jsmith@example.com"
}{
"message": "Too many requests. Try again in 12 seconds.",
"code": "rate_limited",
"doc_url": "https://docs.lekalao.com/errors#rate_limited"
}Authorizations
An API token. The "read" ability: GET routes only. "read + write": every route.
Headers
Replay a write safely: the same key gives back the first answer for 24 hours (header Idempotent-Replay: true). Read on POST, PUT and PATCH; DELETE ignores it. 255 characters at most.
Maximum string length:
255Path Parameters
The list's identifier (uuid).
Body
application/json
⌘I
Subscribe a batch of addresses
curl --request POST \
--url https://api.lekalao.com/v1/lists/{list}/subscribers/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscribers": [
{
"email": "ada@example.com",
"tags": [
"client"
]
},
{
"email": "alan@example.com",
"locale": "en"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscribers: [
{email: 'ada@example.com', tags: ['client']},
{email: 'alan@example.com', locale: 'en'}
]
})
};
fetch('https://api.lekalao.com/v1/lists/{list}/subscribers/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lekalao.com/v1/lists/{list}/subscribers/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subscribers' => [
[
'email' => 'ada@example.com',
'tags' => [
'client'
]
],
[
'email' => 'alan@example.com',
'locale' => 'en'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.lekalao.com/v1/lists/{list}/subscribers/batch"
payload = { "subscribers": [
{
"email": "ada@example.com",
"tags": ["client"]
},
{
"email": "alan@example.com",
"locale": "en"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": [
{
"index": 0,
"email": "ada@example.com",
"id": "9d5c2a1e-8f3b-4c7a-9e21-3b8f0c6d4a12",
"outcome": "subscribed"
},
{
"index": 1,
"email": "alan@example.com",
"outcome": "failed",
"message": "This address is blocked."
}
],
"meta": {
"added": 1,
"updated": 0,
"failed": 1
}
}{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "draft",
"file_name": "<string>",
"processed": 123,
"added": 123,
"updated": 123,
"failed": 123,
"errors": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z",
"url": "<string>"
},
"meta": {
"queued": 123
}
}{
"message": "The idempotency key is too long.",
"code": "idempotency_key_too_long",
"doc_url": "https://docs.lekalao.com/errors#idempotency_key_too_long"
}{
"message": "Unauthenticated.",
"code": "unauthenticated",
"doc_url": "https://docs.lekalao.com/errors#unauthenticated"
}{
"message": "This team is suspended. Contact support.",
"code": "team_suspended",
"doc_url": "https://docs.lekalao.com/errors#team_suspended"
}{
"message": "Not found.",
"code": "not_found",
"doc_url": "https://docs.lekalao.com/errors#not_found"
}{
"message": "A request with this idempotency key is already running.",
"code": "idempotency_key_in_use",
"doc_url": "https://docs.lekalao.com/errors#idempotency_key_in_use"
}{
"message": "The email field must be a valid email address.",
"code": "validation_error",
"doc_url": "<string>",
"errors": {},
"problem": "disposable",
"suggestion": "jsmith@example.com"
}{
"message": "Too many requests. Try again in 12 seconds.",
"code": "rate_limited",
"doc_url": "https://docs.lekalao.com/errors#rate_limited"
}