Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lettr.com/llms.txt

Use this file to discover all available pages before exploring further.

The client.campaigns service gives you read access to campaigns plus lifecycle actions — send now, schedule, and unschedule. Campaigns are authored in the Lettr app; the API does not expose create, update, or delete. Reads require an API key with the campaigns:read scope; actions require campaigns:write.
use lettr::Lettr;
use lettr::campaigns::{ListCampaignsOptions, ListCampaignEventsOptions, ScheduleCampaignOptions, CampaignStatus, CampaignEventType};

let client = Lettr::new("your-api-key");

List Campaigns

let response = client.campaigns.list(
    ListCampaignsOptions::new().status(CampaignStatus::Sent)
).await?;

for campaign in &response.campaigns {
    println!("{}: {:?} ({} sent)", campaign.name, campaign.status, campaign.sent_count);
}
println!("Page {} of {}", response.pagination.current_page, response.pagination.last_page);

API Reference

GET /campaigns

Get a Campaign

get returns a CampaignDetail with the rendered html_content and engagement stats:
let campaign = client.campaigns.get("campaign-id").await?;
println!("Subject: {:?}", campaign.subject);
println!("Opens: {}, Clicks: {}", campaign.stats.unique_opens, campaign.stats.clicks);

if let Some(html) = &campaign.html_content {
    println!("HTML length: {}", html.len());
}

API Reference

GET /campaigns/

List Campaign Events

Engagement events use cursor-based pagination. Keep requesting with the returned cursor until it is None:
let mut options = ListCampaignEventsOptions::new().event_type(CampaignEventType::Click);
loop {
    let page = client.campaigns.list_events("campaign-id", options.clone()).await?;
    for event in &page.events {
        println!("{} {:?} {}", event.timestamp, event.event_type, event.email);
    }
    match page.next_cursor {
        Some(cursor) => options = options.cursor(cursor),
        None => break,
    }
}

API Reference

GET /campaigns//events

Send / Schedule / Unschedule

// Send a draft campaign now (asynchronous; transitions to "preparing")
client.campaigns.send("campaign-id").await?;

// Schedule for future delivery — ISO 8601 with a timezone offset.
client.campaigns.schedule(
    "campaign-id",
    ScheduleCampaignOptions::new("2026-06-01T09:00:00+00:00"),
).await?;

// Cancel a scheduled send, returning the campaign to draft
client.campaigns.unschedule("campaign-id").await?;
The action methods return Option<Campaign> — the SDK returns Some with the updated campaign, or None if the API omits the payload.

Send

POST /campaigns//send

Schedule

POST /campaigns//schedule

Unschedule

POST /campaigns//unschedule

What’s Next

Audience

Manage the contacts campaigns send to

API Reference

Full campaigns API reference