Auth scope for /email/public/v1/campaigns/by-id?


#1

Which auth scope do I need to call /email/public/v1/campaigns/by-id ?

The API call returns "does not have proper permissions! (requires any of [email-access])"

I don't see an email-access option in the app's auth config screen. Tried transactional email sope. However the sandbox portal claims to not have that feature.

Thanks!


#3

Hi @Hima, happy to help here! For proper permissions for Marketing Emails, you'll need to give the Application scopes for "Content", which includes Marketing Emails, Sites, Blog, Campaigns and CTA's. If you've already done so, would you then mind sending me your Application ID, and the portal that you're looking to GET all campaigns by ID from?


#4

Thank you Connor. That was it. It would be helpful if you guys list the required scope under the method details section for each endpoint on its details page.


#5

Hi @Hima, thank you for the suggestion. We will be doing an audit of all docs soon, so we will certainly keep it in mind :slight_smile:


#6

Thank you @Connor_Barley. Can you please confirm that the startTimestamp filter for /email/public/v1/events endpoint is functional? It doesn't seem to change the results


#7

@Hima, to confirm are you looking at the Event Creation Timestamp :created as the required parameter from here: https://developers.hubspot.com/docs/methods/email/get_event_by_id?

This filter should work. I've tested it out in my own portal and was able to get back the email event I was looking for. Make sure your timestamp is in milliseconds


#8

@Connor_Barley, below is the method call.

https://api.hubapi.com/email/public/v1/events?campaignId=66200506&startTimestamp=1538069007&limit=1000

I'm sending the oAuth token in the header. Getting the same number of results immaterial of the startTimeStamp. Also, there are no events in the campaign after that time stamp. So, I'm expecting zero events.

Following the doc here: https://developers.hubspot.com/docs/methods/email/get_events

Thanks!


#9

Hey @Hima, your timestamp looks to be in seconds rather than milliseconds. You're likely starting from way back in time, so it's retrieving all campaigns. Let me know if changing your timestamp to milliseconds resolves it


#10

Ugh. totally missed that one. Thanks!