Add or update up to 1,000 subscribers
On this page
POST
/v1/subscribers/bulkbulk_upsert_subscribers| Risk | bulk |
| Authentication | API key or OAuth access token |
| Scopes | subscribers:write |
| Idempotency | required: send an Idempotency-Key header |
| Dry run | yes: add dry_run=true to the query |
| Success status | 200 |
| Response type | application/json |
What it does#
- Use when: You send a batch of readers; each item is an upsert_subscriber body.
- Do not use when: you add one reader (call upsert_subscriber) or import a purchased list (not accepted).
- Side effects: Creates subscribers; Queues confirmation emails; Over 100 items becomes an async operation.
- Reversible: Yes, call unsubscribe_subscriber per reader.
- Required scope: subscribers:write.
- Idempotency: required (Idempotency-Key header).
- Typical next step: call get_operation if the answer was 202.
Scopes#
subscribers:write: Add subscribers with double opt-in, update them, unsubscribe them, and change their lists and tags.
Side effects#
- Creates subscribers
- Queues confirmation emails
- Over 100 items becomes an async operation
Request#
Path parameters#
None.
Query parameters#
None.
Every mutation also accepts dry_run=true: it runs every check and returns {"dry_run": true, "would": {...}} without writing anything.
Body (application/json)#
| Field | Type | Required | Description |
|---|---|---|---|
items | array of any, max 1000 items | yes |
Response#
| Field | Type | Required | Description |
|---|---|---|---|
results | array of object | yes | |
results[].index | integer, min -9007199254740991, max 9007199254740991 | yes | Position of the item in the request |
results[].status | one of "added_pending", "confirmation_resent", "added_confirmed", "updated", "unchanged", "already_subscribed", "already_pending", "cannot_resubscribe", "invalid", "plan_limit", "daily_limit", "unavailable", "not_found", "unknown", "canceled" | yes | |
results[].email | string | no | |
results[].subscriber_id | string | no | |
results[].code | string | no | |
results[].message | string | no | |
counts | object | yes |
Examples#
one item#
Request:
curl -X POST 'https://api.seemly.com/v1/subscribers/bulk' \
-H "Authorization: Bearer $SEEMLY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"email": "[email protected]",
"tags": [
"launch"
]
}
]
}'const response = await fetch("https://api.seemly.com/v1/subscribers/bulk", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SEEMLY_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"items": [
{
"email": "[email protected]",
"tags": [
"launch"
]
}
]
}),
});
const result = await response.json();
console.log(response.status, result);import os
import uuid
import requests
response = requests.post(
"https://api.seemly.com/v1/subscribers/bulk",
headers={
"Authorization": f"Bearer {os.environ['SEEMLY_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"items": [
{
"email": "[email protected]",
"tags": [
"launch",
],
},
],
},
)
print(response.status_code, response.json())Response: 200:
{
"results": [
{
"index": 0,
"status": "added_pending",
"email": "[email protected]",
"subscriber_id": "sub_0123456789abcdefghjkmnpq",
"message": "Added."
}
],
"counts": {
"added_pending": 1
}
}Errors#
Every error is an application/problem+json body with a code, a fix sentence and next_actions. See reading a problem response.