diff --git a/source/includes/rest/_campaigns.md b/source/includes/rest/_campaigns.md index d1d82202491..ac5e3f51b48 100644 --- a/source/includes/rest/_campaigns.md +++ b/source/includes/rest/_campaigns.md @@ -407,6 +407,155 @@ client.pauseCampaign(campaignId) None. +## List all emails in an Email Series Campaign + +> To list the emails in an Email Series Campaign: + +```shell +curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/campaigns/CAMPAIGN_ID/emails" \ + -H 'User-Agent: Your App Name (www.yourapp.com)' \ + -u YOUR_API_KEY: +``` + +```ruby +require "net/http" + +uri = URI("https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/campaigns/CAMPAIGN_ID/emails") + +request = Net::HTTP::Get.new(uri) +request.basic_auth("YOUR_API_KEY", "") +request["User-Agent"] = "Your App Name (www.yourapp.com)" + +response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) +end + +puts response.body +``` + +```javascript +const response = await fetch( + "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/campaigns/CAMPAIGN_ID/emails", + { + headers: { + "User-Agent": "Your App Name (www.yourapp.com)", + "Authorization": "Basic " + Buffer.from("YOUR_API_KEY:").toString("base64") + } + } +); + +const body = await response.json(); +``` + +> The response looks like this: + +```json +# The emails property is an array of email objects. +{ + "links": { + "emails.account": "https://api.getdrip.com/v2/accounts/{emails.account}", + "emails.campaign": "https://api.getdrip.com/v2/{emails.account}/campaigns/{emails.campaign}" + }, + "emails": [{ + "id": "7654321", + "href": "https://api.getdrip.com/v2/9999999/campaigns/123456/emails/7654321", + "sending_delay": 0, + "sending_order": 0, + "subject": "Welcome to the course, {{ subscriber.first_name }}", + "html_body": "

Welcome!

", + "text_body": "Welcome!", + "created_at": "2026-06-21T10:31:58Z", + "open_rate": 0.0, + "click_rate": 0.0, + "links": { + "account": "9999999", + "campaign": "123456" + } + }] +} +``` + +Returns every email in the Email Series Campaign in sending order, including drafts, which are +not sent and are not marked as drafts in the response. The list is not paginated. + +`sending_delay` is how long Drip waits before sending the email, counted from the previous email +or, for the first email, from when the person subscribed unless the campaign has +`start_immediately`. Its unit (minutes, hours, or days) is set in the Email Series Campaign and +is not part of the response. For an email's performance, use +[Fetch email metrics](#fetch-email-metrics). Liquid in `subject`, `html_body`, and `text_body` is +returned as written, not rendered for a subscriber. + +### HTTP Endpoint + +`GET /v2/:account_id/campaigns/:campaign_id/emails` + +### Arguments + +None. + +## Fetch an email in an Email Series Campaign + +> To fetch one email in an Email Series Campaign: + +```shell +curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/campaigns/CAMPAIGN_ID/emails/EMAIL_ID" \ + -H 'User-Agent: Your App Name (www.yourapp.com)' \ + -u YOUR_API_KEY: +``` + +```ruby +require "net/http" + +uri = URI("https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/campaigns/CAMPAIGN_ID/emails/EMAIL_ID") + +request = Net::HTTP::Get.new(uri) +request.basic_auth("YOUR_API_KEY", "") +request["User-Agent"] = "Your App Name (www.yourapp.com)" + +response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) +end + +puts response.body +``` + +```javascript +const response = await fetch( + "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/campaigns/CAMPAIGN_ID/emails/EMAIL_ID", + { + headers: { + "User-Agent": "Your App Name (www.yourapp.com)", + "Authorization": "Basic " + Buffer.from("YOUR_API_KEY:").toString("base64") + } + } +); + +const body = await response.json(); +``` + +> The response looks like this: + +```json +# The emails property is an array of one email object. +{ + "links": { ... }, + "emails": [{ ... }] +} +``` + +Returns one email, with the same properties as +[List all emails in an Email Series Campaign](#list-all-emails-in-an-email-series-campaign). +Responds with a `404 Not Found` if the Email Series Campaign does not exist or the email is not +part of it. + +### HTTP Endpoint + +`GET /v2/:account_id/campaigns/:campaign_id/emails/:email_id` + +### Arguments + +None. + ## List all subscribers subscribed to an Email Series Campaign > To list subscribers on an Email Series Campaign: