Campaigns API
Campaigns allow you to automatically bundle and send feed content to email recipients based on a schedule. You can target specific feeds or entire categories and choose from multiple premium templates.
The campaign model
The campaign model defines the schedule, audience, and content source for your newsletters.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the campaign.
- Name
title- Type
- string
- Description
The title of the newsletter campaign.
- Name
schedule- Type
- string
- Description
The frequency of the newsletter:
daily,weekly, orcustom.
- Name
customDays- Type
- array
- Description
If schedule is
custom, an array of numbers (0-6) representing days of the week.
- Name
deliverySchedule- Type
- string
- Description
The time of day for delivery:
morning,evening, orboth.
- Name
targetType- Type
- string
- Description
Whether the campaign targets a
categoryor specificfeedIDs.
- Name
targetIds- Type
- array
- Description
Array of category or feed IDs that serve as the content source.
- Name
recipients- Type
- array
- Description
List of email addresses that will receive the newsletter.
- Name
isActive- Type
- boolean
- Description
Whether the campaign is currently active and scheduled to run.
- Name
lastRunAt- Type
- timestamp
- Description
The last time the campaign was successfully executed.
- Name
nextRunAt- Type
- timestamp
- Description
The scheduled time for the next newsletter delivery.
Create a campaign
Create a new automated newsletter campaign. You can target content by category or by specific feed IDs.
Required attributes
- Name
title- Type
- string
- Description
A title for the campaign.
- Name
schedule- Type
- string
- Description
Frequency:
daily,weekly, orcustom.
- Name
targetType- Type
- string
- Description
Either
categoryorfeed.
- Name
targetIds- Type
- array
- Description
Array of IDs for the target category or feeds.
- Name
recipients- Type
- array
- Description
Array of recipient email addresses.
Request
curl -X POST https://api.repur.ai/v1/campaigns \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"title": "Daily Tech Digest",
"schedule": "daily",
"targetType": "category",
"targetIds": ["cat_123"],
"recipients": ["user@example.com"],
"deliverySchedule": "morning"
}'
List all campaigns
Retrieve a list of all newsletter campaigns configured for your account.
Request
curl https://api.repur.ai/v1/campaigns \
-H "X-API-Key: {your_api_key}"
{
"success": true,
"data": [
{
"id": "camp_123",
"title": "Daily Tech Digest",
"isActive": true,
"nextRunAt": "2024-03-15T07:00:00Z"
}
]
}
Retrieve a campaign
Fetch the full configuration and current status of a specific campaign.
Request
curl https://api.repur.ai/v1/campaigns/camp_123 \
-H "X-API-Key: {your_api_key}"
Update a campaign
Modify the settings of an existing campaign. You can update the title, schedule, recipients, or target content.
Request
curl -X PATCH https://api.repur.ai/v1/campaigns/camp_123 \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"title": "Weekly Engineering Insights",
"schedule": "weekly"
}'
Delete a campaign
Permanently remove a campaign and stop all future scheduled deliveries.
Request
curl -X DELETE https://api.repur.ai/v1/campaigns/camp_123 \
-H "X-API-Key: {your_api_key}"
Run campaign now
Trigger an immediate run of a campaign, bypassing the schedule. This will collect items from the last 24 hours and send them to all recipients.
Request
curl -X POST https://api.repur.ai/v1/campaigns/camp_123/run \
-H "X-API-Key: {your_api_key}"
{
"success": true,
"message": "Campaign processed: Sent 12 items."
}
Toggle campaign status
Activate or deactivate a campaign's automated schedule.
Required attributes
- Name
isActive- Type
- boolean
- Description
trueto enable,falseto disable.
Request
curl -X PATCH https://api.repur.ai/v1/campaigns/camp_123/toggle \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'
Send test newsletter
Send a preview of a newsletter to a specific email address. This is useful for testing layout and content before live delivery.
Required attributes
- Name
targetEmail- Type
- string
- Description
The email address to send the test to.
- Name
htmlContent- Type
- string
- Description
The full HTML content of the newsletter.
- Name
campaign- Type
- object
- Description
The campaign configuration object.
Request
curl -X POST https://api.repur.ai/v1/newsletters/test \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"targetEmail": "test@example.com",
"htmlContent": "<h1>Hello</h1>",
"campaign": { "title": "Test" }
}'
Generate newsletter HTML
Generate the final HTML for a newsletter using our premium templates.
Required attributes
- Name
items- Type
- array
- Description
List of newsletter items.
- Name
title- Type
- string
- Description
The primary title of the newsletter.
Request
curl -X POST https://api.repur.ai/v1/newsletters/generate-html \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"items": [],
"title": "My Newsletter"
}'
</CodeGroup>
</Col>
</Row>
---
## Check email configuration {{ tag: 'GET', label: '/v1/newsletters/config' }}
<Row>
<Col>
Check if the SMTP server and email credentials are correctly configured in the system. This must be true for campaigns and test emails to work.
</Col>
<Col sticky>
<CodeGroup title="Request" tag="GET" label="/v1/newsletters/config">
```bash {{ title: 'cURL' }}
curl https://api.repur.ai/v1/newsletters/config \
-H "X-API-Key: {your_api_key}"
{
"success": true,
"data": {
"isConfigured": true
}
}