How do I access the CMS Templates API via OAuth tokens?


#1

I can't quite figure out how to get an OAuth token that has permission to create CMS Templates (via the endpoint described at https://developers.hubspot.com/docs/methods/templates/post_templates).

I'm using an OAuth token with access to the following scopes: "contacts", "content", "timeline", "business-intelligence", "oauth", "files", "tickets", "e-commerce"

Unfortunately, I get the following error when I POST to /content/api/v2/templates:
This oauth-token (REDACTED) does not have proper permissions! (requires any of [design-manager-access, content-core-api-access, content-access])

As "content" is one of my allowed scopes, I am not sure why I still get that error. Thanks.


#3

Welcome, @arickp!

I'm not certain what that error message is referring to off the top of my head, but I'm happy to investigate further.

Would you share:

  • Your developer Hub ID.
  • Your app ID.
  • The Hub ID of the account your app is connected to.

#4

Developer Hub ID: 2833362
App ID: 59775
Hub ID: 3409584


#5

Hi @arickp,

Thanks for that information.

Account 3409584 has a Marketing Hub Free subscription, so it lacks the required content tools and the design-manager-access, content-core-api-access, and content-access scopes.

The OAuth content scope described here is truly a "scope group," which may or may not include specific scopes.

I learned the other day that the content scope group is returned by this endpoint for Marketing Hub Free accounts. I believe this is because the team added one particular scope which falls under the content scope group to free subscriptions. While this scope does not grant access to any content tools, I suspect it may in the future.

Could you confirm whether this behavior of the content scope group being returned by Marketing Hub Free accounts is new to you? If it is, I can see why it might cause confusion and make your app think that the connected account has access to the design manager, for example.


#6

Hi @Isaac_Takushi,

Oh, that makes sense! Yes, I was trying it on a basic/free HubSpot portal that I was using to test. I connected my application to a paid portal that I know uses templates/design manager/etc., and now it works.

Thanks


#7

Glad to hear it, @arickp!