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.
import lettr "github.com/lettr-com/lettr-go"

client := lettr.NewClient("your-api-key")

List Campaigns

campaigns, err := client.Campaigns.List(ctx, &lettr.ListCampaignsParams{
    Status:  lettr.CampaignStatusSent,
    Page:    1,
    PerPage: 20,
})

API Reference

GET /campaigns

Get a Campaign

Get returns the campaign including its rendered HTML content:
campaign, err := client.Campaigns.Get(ctx, "campaign-id")

API Reference

GET /campaigns/

List Campaign Events

Engagement events use cursor-based pagination. Keep requesting with the returned cursor until it is nil:
params := &lettr.ListCampaignEventsParams{
    EventType: lettr.CampaignEventTypeClick,
    Limit:     50,
}
for {
    page, err := client.Campaigns.ListEvents(ctx, "campaign-id", params)
    if err != nil {
        return err
    }
    for _, event := range page.Data.Events {
        // ... process each event
        _ = event
    }
    if page.Data.NextCursor == nil {
        break
    }
    params.Cursor = *page.Data.NextCursor
}

API Reference

GET /campaigns//events

Send / Schedule / Unschedule

// Send a draft campaign now (asynchronous; transitions to "preparing")
sent, err := client.Campaigns.Send(ctx, "campaign-id")

// Schedule for future delivery — ISO 8601 with a timezone offset.
// Calling Schedule again on a scheduled campaign reschedules it.
scheduled, err := client.Campaigns.Schedule(ctx, "campaign-id", &lettr.ScheduleCampaignRequest{
    ScheduledAt: "2026-06-01T09:00:00+00:00",
})

// Cancel a scheduled send, returning the campaign to draft
_, err = client.Campaigns.Unschedule(ctx, "campaign-id")

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