Skip to main content
Solved

Send level data from email activities endpoint

  • April 3, 2026
  • 7 replies
  • 42 views

wineandsong

I’m trying to retreive raw data for each email a contact has been sent. This would result in a large table with millions of rows, since we send millions of emails.

I thought that email activities would be the end point that need for this and wrote a python script (below). This ran for a while and when it concluded I had only tens of thousands of rows, not millions as expected.

Have I misunderstood what email activities is? How can I retreive send level data per contact_id? One record per instance of an email being sent across any and all campaigns.

import requests
import pandas as pd
import sys

if len(sys.argv) < 2:
print("Usage: python email_activities.py <API_KEY>")
sys.exit(1)

API_KEY = sys.argv[1]
BASE_URL = "https://<our org name>.api-us1.com/api/3"

headers = {
"Api-Token": API_KEY,
"Accept": "application/json"
}

all_activities = []
offset = 0
limit = 100

while True:
response = requests.get(
f"{BASE_URL}/emailActivities",
headers=headers,
params={"limit": limit, "offset": offset}
)
data = response.json()
activities = data.get("emailActivities", [])
if not activities:
break
all_activities.extend(activities)
print(f"Fetched {len(all_activities)} records so far...")
offset += limit

print(f"\nTotal records: {len(all_activities)}")

df = pd.DataFrame(all_activities)
df.to_csv("email_activities.csv", index=False)
print("Saved to email_activities.csv")
print(f"\nColumns: {list(df.columns)}")
print(f"\n{df.head()}")

 

Best answer by Ryan_ActiveCampaign

Our Solutions Team felt that leveraging Webhooks would be the best and most direct way to get what you need on a continued basis to build a data warehouse more seamlessly. Just for reference, you can find information about what is possible via a webhook here:

https://help.activecampaign.com/hc/en-us/articles/115001403484-Use-ActiveCampaign-webhooks

I took your reply and reconvened with the team and was advised that we don’t have an endpoint that supports time-based activities like that across all contacts. Activities can be retrieved at the per-contact or per-campaign level.

 

You can filter campaigns by send date using: 

https://developers.activecampaign.com/reference/list-all-campaigns

And would then need to use those campaign IDs to pull results for each campaign independently. So some degree of cross-referencing would be needed to reach the end goal. 

 

My hope is that if you are focusing efforts on a modest window of time like 24 hours, that this multi-step process will be effective at getting you the data you need, though I can see where this would not be quite as ideal for a larger window of time if the volume of sends in high.

7 replies

Ryan_ActiveCampaign
Forum|alt.badge.img

Hi wineandsong! I’d be glad to help look into this for you. To help make sure that I am fully understanding what information you are looking for, can you expand a bit on exactly what information you are trying to obtain when you say “raw data for each email a contact has been sent.” Do you mean that you are looking for the campaign ID and send details such as date/time? Or is there more specific information that you’re trying to pull? Once I have a clear vision on what you’re looking for, I’ll do some digging and see what the best way to get that via API would be! 


wineandsong
  • Author
  • New Participant
  • April 3, 2026

Hi ​@Ryan_ActiveCampaign, thanks. I’m looking for raw send data including contact id, timestamp, name of email/subject, campaign, automation name. Is this possible?

 

Each row would be a case of an email having been sent to a contact.


Ryan_ActiveCampaign
Forum|alt.badge.img

@wineandsong I’m doing some poking around to see if this is possible and will get back to you as soon as I’ve got an answer 🧠 


Ryan_ActiveCampaign
Forum|alt.badge.img

@wineandsong Thanks for your patience while I researched this item. I conferred with a member of one of our internal teams and was able to confirm that a better endpoint to use would be:

https://developers.activecampaign.com/reference/list-contact-activities

 

Another option is in our  V1 API and can retrieve the list of contacts that engaged with each campaign (each event will be timestamped)

campaign_report_open_list

campaign_report_link_list

 

Given what we now know, I’m not entirely confident that you could pull everything you are looking for in a single call. Out of curiosity, are you potentially pulling this information to build out a data warehouse? If so, a good process to put in place now would be to set up a webhook that sends this type of data in real-time as campaign sends are happening. While it doesn’t fill in all of the holes you may have now, it would be effective in effortlessly building on that data moving forward. So a bit of work upfront to pull what you need, but then an autonomous process working for you in the background going forward. 

Let me know if there are any lingering questions and I’d be glad to review! 


wineandsong
  • Author
  • New Participant
  • April 6, 2026

Thanks for the info ​@Ryan_ActiveCampaign. We are pulling the data into our warehouse yes. We currenlty use Segment to do what you described, where we capture send data. We then join it using Fivetran’s extract since the Segment data is pretty minimal. This works but “feels” shaky. Ideally data would come from one source, whether Segment, Fivetran, or, in this case, a custom function.

 

list-contact-activities sounds right but:

A contact ID is required to access this endpoint. This endpoint does not support multiple contact IDs with a single call.

I’m unsure the intended workflow here for a query along the lines of “Get me every single contact that was messaged int he past 24 hours and tell me when and what email they received”.

 

Between Fivetran (ERD linked above), Segment, or a custom data pipeline and scripts, is there a recommended way to get what I need?


Ryan_ActiveCampaign
Forum|alt.badge.img

Our Solutions Team felt that leveraging Webhooks would be the best and most direct way to get what you need on a continued basis to build a data warehouse more seamlessly. Just for reference, you can find information about what is possible via a webhook here:

https://help.activecampaign.com/hc/en-us/articles/115001403484-Use-ActiveCampaign-webhooks

I took your reply and reconvened with the team and was advised that we don’t have an endpoint that supports time-based activities like that across all contacts. Activities can be retrieved at the per-contact or per-campaign level.

 

You can filter campaigns by send date using: 

https://developers.activecampaign.com/reference/list-all-campaigns

And would then need to use those campaign IDs to pull results for each campaign independently. So some degree of cross-referencing would be needed to reach the end goal. 

 

My hope is that if you are focusing efforts on a modest window of time like 24 hours, that this multi-step process will be effective at getting you the data you need, though I can see where this would not be quite as ideal for a larger window of time if the volume of sends in high.


wineandsong
  • Author
  • New Participant
  • April 6, 2026

Thanks again ​@Ryan_ActiveCampaign