How to migrate HubSpot website pages with full content (text + images) between accounts via API or a

Gabrielbab
Member

Hi everyone, We are migrating a full website from one HubSpot account (sandbox or staging) to another production account and have run into a problem. Context: Both accounts are HubSpot CMS instances. The migration was done using the CMS Site Pages API. Both accounts are on Enterprise using the multi brand setup. Problem: The page structures and modules migrated successfully, but the actual content (text, images, and module data) did not. Each page reverted to the default dummy content from the templates used in the sandbox. HubSpot Support confirmed that website pages are not supported for sandbox to production deployment, and that content and media remain stored in the sandbox account. Questions: Is there any API or supported workflow to migrate complete website pages including module data, text, and images between HubSpot accounts? Can any CMS Hub API endpoints or HubDB or design manager exports be used to extract and re import module JSON data? Does the Enterprise plus Multi Brand setup provide any internal migration tools or partner level access for this? Has anyone successfully built a custom script or workflow to duplicate full CMS pages with content between HubSpot portals? Goal: We want to fully replicate all website pages from sandbox to production without manually rebuilding the content. Any advice or workarounds would be greatly appreciated.

0 Upvotes
2 Accepted solutions
Christensen
Solution
Contributor

Hey @Gabrielbab, I've done similar projects for this. I can confirm that moving CMS Pages with full content can be done via the API, but there must be an incorrect data mapping in your migration that resulted in the default module content instead of your actual sandbox content.

When you create a page via POST to /cms/v3/pages/site-pages, you must include the complete layoutSections, widgets, and widgetContainers objects with all your content. If you only pass name and templatePath, the API creates the page structure but populates it with the template's default/dummy content - which is exactly what happened in your case.

I'm not aware of any app in the marketplace that migrates CMS pages with content. Apps like the "HubSpot to HubSpot Migrator" exist but they only handle CRM data (contacts, deals, workflows, forms, etc.) and explicitly exclude website pages and blog content due to API limitations. This is why a custom migration script is your the only solution that I'm aware for this sandbox-to-production CMS migration.

View solution in original post

Christensen
Solution
Contributor

Hey @Gabrielbab, when migrating from one portal to another, you can use /files/v3/files to upload a file synchronously or if you prefer to import the file via urls then you can use the /files/v3/files/import-from-url/async but you'll need to poll for the result as it imports asynchronously.

You'll want to scan for files in each page you're migrating before importing a page. Import the files first, get the new URLs from HubSpot, then update your page content to reference these new URLs before creating the page in the new portal via /cms/v3/pages/site-pages. That's how I actually do it.

View solution in original post

0 Upvotes
4 Replies 4
Christensen
Solution
Contributor

Hey @Gabrielbab, I've done similar projects for this. I can confirm that moving CMS Pages with full content can be done via the API, but there must be an incorrect data mapping in your migration that resulted in the default module content instead of your actual sandbox content.

When you create a page via POST to /cms/v3/pages/site-pages, you must include the complete layoutSections, widgets, and widgetContainers objects with all your content. If you only pass name and templatePath, the API creates the page structure but populates it with the template's default/dummy content - which is exactly what happened in your case.

I'm not aware of any app in the marketplace that migrates CMS pages with content. Apps like the "HubSpot to HubSpot Migrator" exist but they only handle CRM data (contacts, deals, workflows, forms, etc.) and explicitly exclude website pages and blog content due to API limitations. This is why a custom migration script is your the only solution that I'm aware for this sandbox-to-production CMS migration.

Gabrielbab
Member

Absolute life-saver tip @Christensen — worked like a charm!

There's one other thing closely tied to this — is there a way to make sure my image src files are seamlessly migrated so that they're self-reflecting, meaning they're pointing from the new domain?

e.g. if i migrated from domain.com to solutions.domain.com, my images are coming from https://24313776.fs1.hubspotusercontent-na1.net/hubfs/24313776/

Whilist before they were coming from domain.com/image-src

Hope that makes sense!

Christensen
Solution
Contributor

Hey @Gabrielbab, when migrating from one portal to another, you can use /files/v3/files to upload a file synchronously or if you prefer to import the file via urls then you can use the /files/v3/files/import-from-url/async but you'll need to poll for the result as it imports asynchronously.

You'll want to scan for files in each page you're migrating before importing a page. Import the files first, get the new URLs from HubSpot, then update your page content to reference these new URLs before creating the page in the new portal via /cms/v3/pages/site-pages. That's how I actually do it.

0 Upvotes
Jaycee_Lewis
Thought Leader

Great points @Christensen 🙌 — Jaycee





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes