# Klipfolio - custom API call for e-mail send statistics

**URL:** <https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715>\
**Category:** APIs & Integrations\
**Tags:** email\
**Created:** [March 27, 2019, 7:24pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715 "2019-03-27T19:24:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbhoward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbhoward/32/101739_2.png) [@dbhoward](https://community.hubspot.com/u/dbhoward)\
**Post date:** [March 27, 2019, 7:24pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/1 "2019-03-27T19:24:08Z")

</div>

We use Klipfolio for dashboarding.

It looks like I need to build a custom API call to HubSpot get the data I want - sent, bounce, etc.

This link, seems to point to the right endpoint, etc. :

[https://developers.hubspot.com/docs/methods/email/get\_event\_by\_id](https://developers.hubspot.com/docs/methods/email/get_event_by_id)

However, how am I supposed to determine the eventID of the email, and the create time in epoch seconds? How can I know or determine that from the HubSpot GUI interface review of the e-mail stats?

I’m not finding any clues in the dox.

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [March 28, 2019, 9:51pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/2 "2019-03-28T21:51:31Z")

</div>

Hi, @dbhoward.

If you’re looking to retrieve send, delivery, bounce, open, and click information for an email (campaign) or recipient, then I’d actually recommend [this endpoint](https://developers.hubspot.com/docs/methods/email/get_events).

While `campaignId` values can be found in the UI in an email’s _See details_ section under _Internal HubSpot ID_, you won’t be able to find create dates and other epoch millisecond timestamps on the front end. Most of the endpoints assume your app is using other endpoints like [_Get all campaigns_](https://developers.hubspot.com/docs/methods/email/get_campaigns_by_id) and [_Get campaign data_](https://developers.hubspot.com/docs/methods/email/get_campaign_data) to retrieve the requisite data.

---

<div class="post-metadata">

**Author:** ![dbhoward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbhoward/32/101739_2.png) [@dbhoward](https://community.hubspot.com/u/dbhoward)\
**Post date:** [March 28, 2019, 9:58pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/3 "2019-03-28T21:58:16Z")

</div>

So which value is going to be the campaign URL in this UI URL?

[https://app.hubspot.com/email/2xxxxxx/details/7yyyyyyyyy/performance](https://app.hubspot.com/email/2xxxxxx/details/7yyyyyyyyy/performance)

the ‘y’ value?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [March 28, 2019, 10:04pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/4 "2019-03-28T22:04:17Z")

</div>

Hey, @dbhoward.

Neither. Per my last message, the `campaignId` is located under **See details** \> **Internal HubSpot ID**.

---

<div class="post-metadata">

**Author:** ![dbhoward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbhoward/32/101739_2.png) [@dbhoward](https://community.hubspot.com/u/dbhoward)\
**Post date:** [March 28, 2019, 10:08pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/5 "2019-03-28T22:08:07Z")

</div>

Ok, I got it. didn’t follow you. found the campaign id in the ‘see details’ section of the email stats review page in the UI

---

<div class="post-metadata">

**Author:** ![dbhoward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbhoward/32/101739_2.png) [@dbhoward](https://community.hubspot.com/u/dbhoward)\
**Post date:** [March 28, 2019, 10:10pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/6 "2019-03-28T22:10:09Z")

</div>

Klipfolio errors, even when using the correct value for campaign ID, but in a browser, the URL returns:

`{"hasMore":true,"offset":"xxx","events":[{"appName":"AbBatch","ipAddress":"217.86.118.48","browser":{"name":"Thunderbird 60.6.1","family":"Thunderbird","producer":"Mozilla Foundation","producerUrl":"https://www.mozilla.org/","type":"Email client","url":"https://www.mozilla.org/en-US/thunderbird/","version":["60.6.1"]},"duration":3286,"userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Lightning/6.2.6.1","created":1553793102833,"location":{"country":"GERMANY","state":"bayern","city":"neumarkt in der oberpfalz","latitude":49.2803},"id":"325e1fca-7c19-3c0e-a6e4-b48d7c7393cd","recipient":"admin@pettering.de","sentBy":{"id":"8091e8fc-47a1-4edd-b72a-ebdc2b984e28","created":1553514509688},"smtpId":null,"portalId":2818205,"type":"OPEN","filteredEvent":false,"deviceType":"COMPUTER","appId":20185,"emailCampaignId":71056404,"emailCampaignGroupId":71056402}]}`

Which doesn’t look like summary data, but detail data.

---

<div class="post-metadata">

**Author:** ![dbhoward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbhoward/32/101739_2.png) [@dbhoward](https://community.hubspot.com/u/dbhoward)\
**Post date:** [March 28, 2019, 10:17pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/7 "2019-03-28T22:17:43Z")

</div>

Finally got it - have to use the campaign endpoint for the summary data, not email events, which provides detail:

[https://api.hubapi.com/email/public/v1/campaigns/[hubspot](https://api.hubapi.com/email/public/v1/campaigns/%5Bhubspot) internal id from ‘see details’ in email front end]/?hapikey=[my secret api key]

Note also, that for an A/B test email, as is the one in question for me right now, it returns details by A variant, B variant, and the ‘winner’ variant - all 3 distinct pieces of data.

But no overall gross summary of the email. i.e. all sends, all dropped, all bounces, etc.

If I expect details for the same campaign to excel, I am able to calculate an overall summary in Excel. (And upload that to Klipfolio)

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [April 1, 2019, 12:31pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/8 "2019-04-01T12:31:32Z")

</div>

Hey, @dbhoward.

You’re absolutely correct. HubSpot considers each distinct send event a “campaign,” so an A/B test will comprise three campaigns.

---

<div class="post-metadata">

**Author:** ![dbhoward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dbhoward/32/101739_2.png) [@dbhoward](https://community.hubspot.com/u/dbhoward)\
**Post date:** [April 1, 2019, 4:46pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/9 "2019-04-01T16:46:08Z")

</div>

It would be nice if it reported under a single campaign ID an aggregate number.

The front-end appears to report some aggregate number - would be useful to pull the same data via the API.

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [April 1, 2019, 4:57pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/10 "2019-04-01T16:57:29Z")

</div>

Thanks, @dbhoward. I’ll pass your feedback along.

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [April 3, 2019, 12:55pm UTC](https://community.hubspot.com/t/klipfolio-custom-api-call-for-e-mail-send-statistics/13715/11 "2019-04-03T12:55:24Z")

</div>

Hey, @dbhoward.

We just released a [CMS Marketing Email API](https://developers.hubspot.com/changelog/update-cms-marketing-email-api-is-now-live) which has a [_Get the statistics for a marketing email_](https://developers.hubspot.com/docs/methods/cms_email/get-the-statistics-for-a-marketing-email) endpoint. From my understanding, this should include data from all relevant campaigns, so this may be what you’re looking for!
