I am using the API to post a landing page but it is getting posted to Website pages for some reason. Using the following post url-
https://api.hubapi.com/cms/v3/pages/landing-pages
Any recommendations on how to troubleshoot this? It’s the first time I have run into this issue.
Thanks,
Terry
Hey there, @tmcmillan99, and thank you for posting!
Here are some developer articles that offer helpful context:
https://developers.hubspot.com/docs/api-reference/cms-pages-v3/guide
As a workaround, there’s this Knowledge Base article that would help a lot:
Finally, I’d also like to tag a few community experts to help out: Hey there @evaldas @Anton and @GRajput , any additional insights here?
Thanks!
Victor
Hi @tmcmillan99,
I haven’t encountered this and confirming that the POST /cms/v3/pages/landing-page endpoint is working fine on my end - a landing page gets created in the “Landing Pages” section in HubSpot.
In terms of troubleshooting, try creating the most plain landing page by using a payload like below. This does not use any `domain` or `url` values, which is the only thing that comes to mind that could actually impact something.
{
"domain": "",
"htmlTitle": "Test Landing Page",
"name": "Test LP from API",
"slug": "test-lp-from-api",
"state": "DRAFT",
"templatePath": "@hubspot/growth/templates/paid-consultation.html",
"url": "",
"useFeaturedImage": false,
"layoutSections": {
"dnd_area": {
}
}
}
If this basic test works and landing page gets created in the correct place, then you may need to find the culprit in your original payload.
Hope this helps!
@evaldas Thanks for pointing me in the right direction. As usual, I was overlooking something simple. Realized I had the following in my json file-
“subcategory”: “site_page”
Changed it to “landing_page” and it worked.
Glad to hear! It’s a little odd that the JSON essentially allows “overriding” the endpoint but thank you for sharing that detail.
Hi @tmcmillan99
Hey, I found this API to push the draft LP. This is the curl - curl --request POST \
--url https://api.hubapi.com/cms/v3/pages/landing-pages/{objectId}/draft/push-live
\--header ‘Authorization: Bearer <token>’
link - Accounts Dashboard | HubSpot
I saw you are not using id anywhere in your post, so how the endpoint will know which page you are LP. You can use the API mentioned above, provide the required scopes, and hit that, then the LP will be live.
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!
This post does not ask about pushing a draft page live.