How to retrieve the Web Version URL for a sent Marketing Email using HubSpot API?

Hi HubSpot Team,

We are currently working on a Salesforce–HubSpot integration and have a requirement to display the Web Version URL of a sent Marketing Email in our Salesforce widget.

Current Implementation

We are using the HubSpot Email Events API to retrieve email events for a Contact.

For a SENT event, we receive information such as:

  • emailCampaignId

  • recipient

  • subject

  • type = SENT

For example:

emailCampaignId = 140729929
subject = Responsible AI use training for authorized users

Requirement

For each sent email, we need to display a View Email / Web Version link in Salesforce.

We understand that the Marketing Email API response contains a webversion object, including:

webversion.url
webversion.enabled
webversion.domain
webversion.slug

We also see primaryEmailCampaignId in the Marketing Email API response.

Therefore, we are considering the following approach:

Email Events API
       ↓
emailCampaignId
       ↓
Marketing Email API
       ↓
primaryEmailCampaignId
       ↓
webversion.url

Our Question

Could you please confirm whether this is the correct and officially supported approach?

Specifically:

  1. Can the emailCampaignId returned by the Email Events API be used to identify the corresponding Marketing Email?

  2. Can we match it with primaryEmailCampaignId from the Marketing Email API?

  3. Once the corresponding Marketing Email is identified, is webversion.url the correct field to use for the Web Version URL?

  4. What is the recommended/current HubSpot API endpoint to retrieve this information?

  5. Are there any limitations or conditions where webversion.url may not be available, such as when the Web Version is disabled or the email has not been published/sent?

We initially came across the following endpoint:

GET /content/api/v2/templates

However, our requirement is specifically to retrieve the Web Version URL of an individual sent Marketing Email, rather than the template itself.

So we would like to confirm the correct HubSpot API and mapping before implementing this in Salesforce.

Thanks!

Venkatesh I

A question for you: do you want the same web version as the contact including their personalization (eg, this email was sent to: EMAILHERE) or are you fine with the generic version of the same email?

If you want the exactly the same web version as the user, which would have their own personalization and click tracking in the email, I’m not sure it’s possible to rebuild the entire url. I see ecid as the missing variable and I don’t know where that might be.

However, I’m not sure how much is necessary since it seems most of the links on the email itself between a generic loaded version and a custom version are the same?

If you’re fine with the generic version of the email, then you have most of it correct.


I went through your logic on my account and this is the route I ended up with:

Email Events API (https://api.hubapi.com/email/public/v1/events/?recipient=EMAILHERE)-> Get emailCampaignId

Campaigns API (https://api.hubapi.com/email/public/v1/campaigns/emailCampaignId) → Get contentId

Marketing API (https://api.hubapi.com/marketing/v3/emails/contentId) → Get webVersion.url

webVersion.url will be the generic version of the email and is created when an email is sent.

I ran through the steps through Postman to get to the webVersion.url.

Your mapping direction is right: Email Events give you the campaign send id, and the Marketing Emails API is where webversion.url lives. A few precise points so the Salesforce widget does not break on edge cases.

  1. Treat emailCampaignId from Email Events as a campaign-send id, not as the marketing-email content id. On the Marketing Email object, match it against primaryEmailCampaignId or (safer) any value in allEmailCampaignIds. A/B and some republish paths can put the event’s id in the array even when it is not the primary.

  2. Preferred lookup path today

    • From the SENT event, keep emailCampaignId + recipient + subject.
    • Find the marketing email with Marketing Emails API (GET /marketing/emails/2026-03 list/filter, or get-by-id once you know the email id). Confirm the event’s emailCampaignId is in allEmailCampaignIds (or equals primaryEmailCampaignId).
    • Read webversion.url from that email payload. That is the supported Web Version field (with webversion.enabled, domain, slug).
  3. Do not use GET /content/api/v2/templates for this. That is template/content metadata, not the post-send Web Version for a specific marketing email send.

  4. When webversion.url can be empty or useless

    • webversion.enabled is false, or Web Version was never turned on for that email.
    • Email never published/sent in a state that materializes a public Web Version.
    • Some send types (certain transactional / single-send paths) will not expose a stable marketing-email Web Version the same way. Gate the Salesforce link on webversion.enabled == true and a non-empty url.
  5. Salesforce widget pattern: cache (emailCampaignId → webversion.url) after the first successful resolve so you are not listing all marketing emails on every contact timeline paint. Refresh the cache if subject/campaign changes or the URL 404s.

So: Events emailCampaignId → Marketing Email via allEmailCampaignIds / primaryEmailCampaignId → webversion.url is the supported approach. Skip the old templates v2 endpoint for this requirement.

If you can share one sample SENT event payload (redact email) plus whether that send was a regular marketing email vs A/B, we can sanity-check the exact id field you should key on.

VK | AXIOPRAX

Your approach is on the right track. The emailCampaignId from the Email Events API can be used to look up the corresponding marketing email, and the webversion.url field is indeed the correct one for the web version link. Just keep in mind that the web version URL only works if the web version is enabled and the email has been published — otherwise that field may be empty.

Thanks , will Check and update