# linking email event data with campaign data with API

**URL:** <https://community.hubspot.com/t/linking-email-event-data-with-campaign-data-with-api/136505>\
**Category:** APIs & Integrations\
**Tags:** email\
**Created:** [July 18, 2025, 7:25pm UTC](https://community.hubspot.com/t/linking-email-event-data-with-campaign-data-with-api/136505 "2025-07-18T19:25:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EShaw-Meadow](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@EShaw-Meadow](https://community.hubspot.com/u/EShaw-Meadow)\
**Post date:** [July 18, 2025, 7:25pm UTC](https://community.hubspot.com/t/linking-email-event-data-with-campaign-data-with-api/136505/1 "2025-07-18T19:25:27Z")

</div>

I am trying to pull email marketing data in order to train an attribution model using Hubspot’s APIs.  
I pulled email events from the following API: [https://api.hubapi.com/email/public/v1/events](https://api.hubapi.com/email/public/v1/events) . Now I want to be able pull email metadata, especially at the campaign level so I can add the campaign name to each email event. The email events data includes a field called ‘campaign\_id’. However, this campaign\_id seems to be different from the id that is found in the campaign data I pulled from this API: [https://api.hubapi.com/marketing/v3/campaigns](https://api.hubapi.com/marketing/v3/campaigns) .  
Hubspot support has confirmed that the event data is from an older API version and there isn’t a way to map a given campaign\_id from the email events API directly to the newer campaigns API. I also tried the general marketing emails API ([https://api.hubapi.com/marketing/v3/emails](https://api.hubapi.com/marketing/v3/emails) ) but wasn’t able to find a campaign\_id in that table either.  
Has anyone found a workaround for this?

---

<div class="post-metadata">

**Author:** ![PNofer](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@PNofer](https://community.hubspot.com/u/PNofer)\
**Post date:** [July 19, 2025, 11:56pm UTC](https://community.hubspot.com/t/linking-email-event-data-with-campaign-data-with-api/136505/2 "2025-07-19T23:56:24Z")

</div>

I’ve dealt with this too, it’s annoying. The campaign\_id from the email events API doesn’t match anything in the newer campaigns API. They come from different systems, and HubSpot never made a bridge between them.

What helped in my case: I used the email subject and send time from the event data to manually match each event to the right campaign from the /marketing/v3/emails API. It’s not perfect, but if your naming or send schedule is structured, it works well enough.
