. . . . .. .. .: . . .. . . .:.. .. .. .. . .. .+... . .. .::..: .. ... ..............:.+. . .. . .:..::::---=. ..:---:. . .=--=-:.-::..=:-:. . .. ..... . . .-. . .:==-----+=-:. :--:.=.-..... . .-===::---:-:::::. ..::-:--:. . .:.=.::--.. . ..... ..:-=== ===.-:: .::::..:: .:.... ..:==-=+=+=-=-=::.+.:.... .:-:::.. ...+... .:.:::-=++::.. .=.. . .. ..-...:..::+====.++=-:+::.... .::::---=::.. ..:::-=+==-+X+===-:.:-+=--::=:: ..::.:. .:..:+::=:::--=+XX+---:...::.... .. ..:.+....:--.::-:---=+X++++==-:::::......::==++--:..:==--=-=--==+X==++=---+-=+==--::. .:::: :-::::--+=--=+XXXXX++=---:=-:.:....=.... .. ..::::-=-::=++==+XX.XX+X+----==.--::.:-=+X+X+===-=X+===----== XXXX++++==++++++==-:....:::.==-=--==XXX=XXXX-X:++==-++=:::--:::::....= ...:.-::-====-.-=++:+XXXXXX+==-==++=----- =XXXXXXXXXXXXX++=---:==+X.XX.+XXXXXX+X+XX++++-:.::--=X++:X =XXXXX++.XX++X++X+++--::--:-::::.:. .-..::.-=====-=-=++:+XXXXXX+==-==++=----- =XXXXXXXXXXXXX++=---:==+X.XX.+XXXXXX+X+XX++++-:.::--=X++:X =XXXXX++.XX++X++X+++--::--:-::::.:.

Campaigns

Automate content distribution with scheduled newsletters.
epuraı

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, or custom.

  • 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, or both.

  • Name
    targetType
    Type
    string
    Description

    Whether the campaign targets a category or specific feed IDs.

  • 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.


POST/v1/campaigns

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, or custom.

  • Name
    targetType
    Type
    string
    Description

    Either category or feed.

  • 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

POST/v1/campaigns
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"
  }'

GET/v1/campaigns

List all campaigns

Retrieve a list of all newsletter campaigns configured for your account.

Request

GET/v1/campaigns
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"
    }
  ]
}

GET/v1/campaigns/:id

Retrieve a campaign

Fetch the full configuration and current status of a specific campaign.

Request

GET/v1/campaigns/camp_123
curl https://api.repur.ai/v1/campaigns/camp_123 \
  -H "X-API-Key: {your_api_key}"

PATCH/v1/campaigns/:id

Update a campaign

Modify the settings of an existing campaign. You can update the title, schedule, recipients, or target content.

Request

PATCH/v1/campaigns/camp_123
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/v1/campaigns/:id

Delete a campaign

Permanently remove a campaign and stop all future scheduled deliveries.

Request

DELETE/v1/campaigns/camp_123
curl -X DELETE https://api.repur.ai/v1/campaigns/camp_123 \
  -H "X-API-Key: {your_api_key}"

POST/v1/campaigns/:id/run

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

POST/v1/campaigns/camp_123/run
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."
}

PATCH/v1/campaigns/:id/toggle

Toggle campaign status

Activate or deactivate a campaign's automated schedule.

Required attributes

  • Name
    isActive
    Type
    boolean
    Description

    true to enable, false to disable.

Request

PATCH/v1/campaigns/camp_123/toggle
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}'

POST/v1/newsletters/test

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

POST/v1/newsletters/test
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" }
  }'

POST/v1/newsletters/generate-html

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

POST/v1/newsletters/generate-html
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
  }
}