# Publish CMS Page

**URL:** <https://community.hubspot.com/t/publish-cms-page/18088>\
**Category:** APIs & Integrations\
**Tags:** cms-content\
**Created:** [January 14, 2020, 9:32am UTC](https://community.hubspot.com/t/publish-cms-page/18088 "2020-01-14T09:32:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmoraleda](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cmoraleda/32/97852_2.png) [@cmoraleda](https://community.hubspot.com/u/cmoraleda)\
**Post date:** [January 14, 2020, 9:32am UTC](https://community.hubspot.com/t/publish-cms-page/18088/1 "2020-01-14T09:32:29Z")

</div>

I am integrating an application with the API and I encounter a difficulty when I publish pages of the website in Hubspot. I publish the page perfectly but it is being impossible for me to leave it in a state published from the API.

Can anyone guide me about this process?

---

<div class="post-metadata">

**Author:** ![Willson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/willson/32/84663_2.png) [@Willson](https://community.hubspot.com/u/Willson)\
**Post date:** [January 14, 2020, 11:19am UTC](https://community.hubspot.com/t/publish-cms-page/18088/2 "2020-01-14T11:19:01Z")

</div>

Hi @cmoraleda

This process of creating and publishing pages can be done through the use of 2 endpoints:

1. **Create a new page** : [https://developers.hubspot.com/docs/methods/pages/post\_pages](https://developers.hubspot.com/docs/methods/pages/post_pages)
2. **Publish or unpublish pages** : [https://developers.hubspot.com/docs/methods/pages/post\_pages\_page\_id\_publish\_action](https://developers.hubspot.com/docs/methods/pages/post_pages_page_id_publish_action)

To walk-through this with you, i’ve gone ahead and created a test page using the sample JSON found in the create documentation, see below:

```auto
 {
 "name": "My API Page",
 "template_path": "hubspot_default/landing_page/basic_with_form/2_col_form_left.html"
}

```

This is being posted to the following endpoint:

`https://api.hubapi.com/content/api/v2/pages?hapikey={{hapikey}}`

Once this is done, my page is created but is returned in draft mode, this is signified by the following values that are returned in your response when the page is created:

`"is_draft": true,`

`"is_published": false,`

Now, if we’re looking to publish this page, we can make a new request to the following endpoint:

`https://api.hubapi.com/content/api/v2/pages/PAGE_ID/publish-action?hapikey={{hapikey}}` This is documented in the second link above. You’ll see that this endpoint is specifically targetting the page we’ve just created through the use of the `page_id` which is returned in the intial response when the page is created using the above method.

Once this is sent, the page we’ve just created will be updated and the `is_published` value set to true providing we receive the `204 No Content` status.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![cmoraleda](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cmoraleda/32/97852_2.png) [@cmoraleda](https://community.hubspot.com/u/cmoraleda)\
**Post date:** [January 15, 2020, 4:51pm UTC](https://community.hubspot.com/t/publish-cms-page/18088/3 "2020-01-15T16:51:32Z")

</div>

Thanks for your answer!

I have performed the steps you comment and the answer has been this:

HTTP ERROR 405

Problem accessing /cospages/v1/pages/XXXXXXXX/push-buffer-live. Reason:

Method Not Allowed

To publish I used this url:

[https://api.hubapi.com/content/api/v2/pages/XXXXXXXX/push-buffer-live?hapikey=XXXXXXXXXXXXXXXXXXXX](https://api.hubapi.com/content/api/v2/pages/XXXXXXXX/push-buffer-live?hapikey=XXXXXXXXXXXXXXXXXXXX)

---

<div class="post-metadata">

**Author:** ![cmoraleda](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cmoraleda/32/97852_2.png) [@cmoraleda](https://community.hubspot.com/u/cmoraleda)\
**Post date:** [January 15, 2020, 7:10pm UTC](https://community.hubspot.com/t/publish-cms-page/18088/4 "2020-01-15T19:10:28Z")

</div>

Fixed!

I was writing the url wrong.

This is correct:

[https://api.hubapi.com/content/api/v2/pages/XXXXXXXX/[u]\*\*publish-action\*\*[/u]?hapikey=XXXXXXXXXXXXXXXXXXXX](https://api.hubapi.com/content/api/v2/pages/XXXXXXXX/%5Bu%5D **publish-action** %5B/u%5D?hapikey=XXXXXXXXXXXXXXXXXXXX)

---

<div class="post-metadata">

**Author:** ![Willson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/willson/32/84663_2.png) [@Willson](https://community.hubspot.com/u/Willson)\
**Post date:** [January 16, 2020, 9:08am UTC](https://community.hubspot.com/t/publish-cms-page/18088/5 "2020-01-16T09:08:29Z")

</div>

Hi @cmoraleda

Great, glad to hear this is working for you now!
