# Updating pages through code

**URL:** <https://community.hubspot.com/t/updating-pages-through-code/78641>\
**Category:** CMS Development\
**Tags:** free, starter\
**Created:** [April 4, 2023, 5:59am UTC](https://community.hubspot.com/t/updating-pages-through-code/78641 "2023-04-04T05:59:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amohar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amohar/32/198209_2.png) [@amohar](https://community.hubspot.com/u/amohar)\
**Post date:** [April 4, 2023, 5:59am UTC](https://community.hubspot.com/t/updating-pages-through-code/78641/1 "2023-04-04T05:59:11Z")

</div>

Hello everyone,

Is it possible to update page contents **including modules’ data** entirely through code? I know I can add default modules using `dnd_module` HUBL code in page templates, but it seems when I update the template modules in code with new or updated module data, the existing pages don’t reflect the changes (which is logical - template should be used just to create the initial version). I would still like to edit the pages’ contents through code, so that I can have it stored in a separate versioning system. Is this possible?

I’m currently working on the free Hubspot version and am looking to buy starter version.

---

<div class="post-metadata">

**Author:** ![TDwebdev](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tdwebdev/32/78032_2.png) [@TDwebdev](https://community.hubspot.com/u/TDwebdev)\
**Post date:** [April 4, 2023, 12:41pm UTC](https://community.hubspot.com/t/updating-pages-through-code/78641/2 "2023-04-04T12:41:41Z")

</div>

Hi Amohar,

You can update pages via code by using the API: [https://legacydocs.hubspot.com/docs/methods/pages/put\_pages\_page\_id](https://legacydocs.hubspot.com/docs/methods/pages/put_pages_page_id)

Is that what you mean?

---

<div class="post-metadata">

**Author:** ![amohar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amohar/32/198209_2.png) [@amohar](https://community.hubspot.com/u/amohar)\
**Post date:** [April 4, 2023, 2:52pm UTC](https://community.hubspot.com/t/updating-pages-through-code/78641/3 "2023-04-04T14:52:49Z")

</div>

Hello Twan, yeah, I need to take a deeper look but this sounds promising. I see I can set up all the widgets (modules) and their field values for a page, which is what I’m after. Thanks!
