Subscribers
Subscribers are the core entity in SubscribeFlow. Each subscriber has an email address, a status, optional metadata, and zero or more tags.
Create a subscriber
Info
If you pass tag names that do not exist yet, SubscribeFlow creates them automatically.
Get a subscriber
Retrieve a subscriber by ID or by email address.
List subscribers with pagination
SubscribeFlow uses cursor-based pagination. Every list response includes a next_cursor value. Pass it to the next request to fetch the following page.
let { items, cursor } = await client.subscribers.list({
limit: 50,
status: 'active',
});
for (const subscriber of items) {
console.log(subscriber.email);
}
// Fetch the next page
while (cursor) {
const result = await client.subscribers.list({ cursor, limit: 50 });
items = result.items;
cursor = result.cursor;
for (const subscriber of items) {
console.log(subscriber.email);
}
}
Update a subscriber
You can update the email address, status, or metadata of an existing subscriber.
Delete a subscriber
Deleting a subscriber removes all associated data permanently. This is the recommended way to fulfil DSGVO/DSG deletion requests.
Warning
Deletion is irreversible. All subscriber data, tag associations, and event history are permanently removed.
Manage tags
Add or remove tags from an existing subscriber without replacing the full tag list.
Add tags
Remove a tag
Hands-On: Import your first 100 subscribers
Use a loop to batch-create subscribers from a CSV or list. The example below reads a simple list and creates each subscriber with an imported tag.
import asyncio
from subscribeflow import SubscribeFlowClient
emails = [
"alice@example.com",
"bob@example.com",
# ... up to 100 emails
]
async def main():
async with SubscribeFlowClient(api_key="sf_live_...") as client:
for email in emails:
subscriber = await client.subscribers.create(
email=email,
tags=["imported"],
metadata={"source": "csv-import"},
)
print(f"Imported: {subscriber.email}")
asyncio.run(main())
import { SubscribeFlowClient } from '@subscribeflow/sdk';
const client = new SubscribeFlowClient({
apiKey: 'sf_live_...',
});
const emails = [
'alice@example.com',
'bob@example.com',
// ... up to 100 emails
];
for (const email of emails) {
const subscriber = await client.subscribers.create({
email,
tags: ['imported'],
metadata: { source: 'csv-import' },
});
console.log('Imported:', subscriber.email);
}
# Loop through a list of emails
for EMAIL in alice@example.com bob@example.com; do
curl -X POST https://api.subscribeflow.net/api/v1/subscribers \
-H "X-API-Key: sf_live_..." \
-H "Content-Type: application/json" \
-d "{\"email\": \"$EMAIL\", \"tags\": [\"imported\"], \"metadata\": {\"source\": \"csv-import\"}}"
echo
done