> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.beehiiv.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.beehiiv.com/_mcp/server.

# List automation emails

GET https://api.beehiiv.com/v2/publications/{publicationId}/automations/{automationId}/emails

Retrieve all emails belonging to a specific automation, including engagement statistics for each email.

Reference: https://developers.beehiiv.com/api-reference/automations/list-emails

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `publicationId` (string, required) — The prefixed ID of the publication object
- `automationId` (string, required) — The prefixed ID of the automation object

### Query parameters

- `limit` (integer, optional) — A limit on the number of objects to be returned. The limit can range between 1 and 100, and the default is 10.
- `cursor` (string, optional) — **Cursor-based pagination (recommended)**: Use this opaque cursor token to fetch the next page of results. Obtain it from the `next_cursor` field of a previous response.
- `page` (integer, optional) — **Deprecated**: Use `cursor` instead. Pagination returns the results in pages. Limited to 100 pages maximum.

## Response

### 200

OK

- `data` (list of AutomationEmail, required)
- `limit` (integer, optional) — The limit placed on the results. If no limit was specified in the request, this defaults to 10.
- `has_more` (boolean, optional) — **Cursor pagination only**: Indicates whether there are more results available after the current page.
- `next_cursor` (string, optional) — **Cursor pagination only**: The cursor token to use for fetching the next page of results. This will be null if has_more is false.
- `page` (integer, optional, default: 1) — **Offset pagination only**: The page number the results are from. Only present when using deprecated offset-based pagination.
- `total_results` (integer, optional) — The total number of results from all pages.
- `total_pages` (integer, optional) — The total number of pages.

## Errors

### 400 Bad Request Error

Bad Request

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 401 Unauthorized Error

Unauthorized. The API key or OAuth access token is missing, invalid, or expired.

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 404 Not Found Error

Resource Not Found

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 429 Too Many Requests Error

Rate Limit Exceeded

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 500 Internal Server Error

Internal Server Error

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

## Types

### AutomationEmail

An email message within an automation. When a step runs an A/B test, each variant email is listed as a separate entry alongside the step's original email.

- `id` (string, required) — The unique ID of the email message
- `automation_step_id` (string, required) — The unique ID of the automation step this email belongs to
- `subject_line` (string, required) — The email subject line
- `preview_text` (string, required) — The email preview text
- `status` (string, required) — The status of the email message. `active` - The email is active and will be sent. `inactive` - The email is inactive.
- `created_at` (integer, required) — The time the email was created. Measured in seconds since the Unix epoch
- `automation_step_email_variant_id` (string, optional) — The unique ID of the A/B test variant this email belongs to. Null for the step's original email.
- `first_sent_at` (integer, optional) — The time the email was first sent. Measured in seconds since the Unix epoch
- `last_sent_at` (integer, optional) — The time the email was last sent. Measured in seconds since the Unix epoch
- `stats` (AutomationEmailStats, optional) — Statistics for an automation email message.

### ErrorDetail

- `message` (string, required)
- `code` (string, required)

### AutomationEmailStats

Statistics for an automation email message.

- `email` (AutomationEmailStatsEmail, optional) — Stats scoped to email recipients
- `clicks` (list of AutomationEmailStatsClicks, optional) — An array of click statistics for each URL in the email

### AutomationEmailStatsEmail

Email engagement statistics for an automation email.

- `recipients` (integer, optional, default: 0) — Total number of email recipients
- `delivered` (integer, optional, default: 0) — Total number of emails delivered
- `opens` (integer, optional, default: 0) — Total number of email opens
- `unique_opens` (integer, optional, default: 0) — Total number of unique email opens
- `open_rate` (double, optional) — The percentage of emails that have been opened
- `clicks` (integer, optional, default: 0) — Total number of email clicks
- `unique_clicks` (integer, optional, default: 0) — Unique number of email clicks
- `click_rate` (double, optional) — The percentage of emails that have been clicked
- `unsubscribes` (integer, optional, default: 0) — Total number of email unsubscribes
- `spam_reports` (integer, optional, default: 0) — The number of subscribers that reported this email as spam

### AutomationEmailStatsClicks

- `url` (string, optional) — The URL the stats are for
- `total_clicks` (integer, optional)
- `total_unique_clicks` (integer, optional)
- `total_click_through_rate` (double, optional) — The percentage of clicks on the URL compared to the total number of unique opens

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "automation_step_id": "00000000-0000-0000-0000-000000000000",
      "subject_line": "Welcome to our newsletter!",
      "preview_text": "Here's what to expect...",
      "status": "active",
      "created_at": 1699900000,
      "first_sent_at": 1700000000,
      "last_sent_at": 1700100000,
      "stats": {
        "email": {
          "recipients": 500,
          "delivered": 490,
          "opens": 250,
          "unique_opens": 200,
          "open_rate": 40.82,
          "clicks": 100,
          "unique_clicks": 75,
          "click_rate": 37.5,
          "unsubscribes": 2,
          "spam_reports": 1
        },
        "clicks": [
          {
            "url": "https://example.com/link",
            "total_clicks": 80,
            "total_unique_clicks": 60,
            "total_click_through_rate": 30
          }
        ]
      }
    }
  ],
  "limit": 10,
  "has_more": false,
  "next_cursor": null
}
```

**SDK Code**

```python
import requests

url = "https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beehiiv.com/v2/publications/pub_00000000-0000-0000-0000-000000000000/automations/aut_00000000-0000-0000-0000-000000000000/emails")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```