No longer able to create website pages via API

SOLVE
Highlighted
New Contributor

Our app helps users to create pages in HubSpot portal, it had been working fine until one or two weeks ago, since then it fails when calling POST /content/api/v2/pages with following error:

 

{"correlationId":"816b5c7b-58e3-4a6f-b051-973b07b1cbd7","errorTokens":{"action":["create"],"contentId":["10993330975"],"contentType":["site page"]},"errorType":"CONTENT_SCOPE_RESTRICTED","message":"User does not have permission to create the site page with id 10993330975.","requestId":"47a022b1-a6d2-4fda-b6b9-834997c00a8d","status":"error"}

 

Note that this only happens with site pages, the app can create landing page without error. I tested a few portals and all of them fails with the same error. Can you help us to fix it? Thank you.

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Hey, @JoeHu.

 

Apologies for the delayed response. I've just sent you a direct message.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
14 Replies 14
Regular Advisor

Hello @JoeHu 

Can you please tell how you are making API call like either with OAuth2.0 or API key. Its a user permission error for a API call. If you are using the oauth for the APP then make sure it is authorized either with the super admin user or respective user role who has the permission to create pages on HubSpot. It may be a case that the APP do not fulfills all the scopes while authorization by a user.

Thankyou.

Digital Marketing & Inbound Expert In Growth Hacking Technology
Reply
0 Upvotes
New Contributor

Hi @himanshurauthan , thank you for your reply. My app uses OAuth and it requests following scopes: `content contacts forms`. Even if I authorizes with Super Admin user, I still can't create site page (although I can create landing page as mentioned). Any idea?

Reply
0 Upvotes
Regular Advisor

@JoeHu 

can you make sure that the account has Marketing professional or Enterprise plan activated? Because the content scope is allowed on only such plans.


Digital Marketing & Inbound Expert In Growth Hacking Technology
Reply
0 Upvotes
New Contributor

@himanshurauthan 

 

Yes I can confirm that. And the app is working for the same portal a few weeks ago.

Reply
0 Upvotes
Regular Advisor

@JoeHu 
Can you please mention the request API code that you are sending for creating new pages? May be I can find something from that?

Digital Marketing & Inbound Expert In Growth Hacking Technology
Reply
0 Upvotes
New Contributor

@himanshurauthanMy code is a bit too complex to put here, but I can provide sample of body of a failed request:

 

{
    "enable_layout_stylesheets":true,
    "name":"My new landing page",
    "include_default_custom_css":false,
    "enable_domain_stylesheets":false,
    "template_path":"generated_layouts/5458378816.html",
    "widget_containers":{
        "body_flexible_column":{
            "widgets":[
                {
                    "body":{"module_id":2755238,"widget_name":"SUF - Feature 2 \u2705"},
                    "name":"widget_05940e4a273a42afb4c3d483ea46af82",
                    "label":"SUF - Feature 2 ✅",
                    "module_id":"2755238",
                    "type":"module",
                    "order":"0"
                }
            ]
        }
    },
    "subcategory":"site_page"
}

 

Reply
0 Upvotes
Regular Advisor

@JoeHu 
Are you sending the request in JSON format. If so what data you are sending to headers. It should be "application/json" for POST request.

Rest I do not see any issue with your request. Was there any change made to the published APP in last hours as you mentioned the same was working fine for week or more.

Digital Marketing & Inbound Expert In Growth Hacking Technology
Reply
0 Upvotes
New Contributor

@himanshurauthanYes I can confirm that I have set content type to "application/json", and I haven't modified the app for a while. Thanks for your help anyways.

Reply
0 Upvotes
HubSpot Moderator

Thanks for jumping in @himanshurauthan!

 

Welcome, @JoeHu.

 

This is a strange one. If you're authorizing with a Super Admin user, I definitely wouldn't expect you to encounter such an error.

 

Can you share your app ID and the Hub IDs of a few accounts you tested in? If there is more than one Super Admin in each account, can you confirm via DM which you used to connect the app?

 

 

Isaac Takushi

HubSpot Developer Support
New Contributor

Hi @IsaacTakushi , thank you for your reply. I just sent you details via DM, please let me know if there is anything else I can provide. Thanks!

Reply
0 Upvotes
New Contributor

Hi @IsaacTakushi , any update? Is there any other info I can provide? Thank you!

Reply
0 Upvotes
HubSpot Moderator

Hey, @JoeHu.

 

Apologies for the delayed response. I've just sent you a direct message.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
New Contributor

Hi @IsaacTakushi , I just tested again and found that the issue disappeared by itself I didn't change any code and used same refresh token without re-authentication, so I am not really sure what happened. Anyways I am happy to see the issue got fixed. Thanks again!

Reply
0 Upvotes
HubSpot Moderator

Hey, @JoeHu.

 

Thanks for the update. I'm glad to hear that the behavior seems to have resolved itself. Please let me know if you encounter it again!

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes