For Agents
Read, write, validate, and bulk-extract HubSpot CMS template and module source files in published or draft environments, so an agent can manage themes from a developer workflow.
Get started with CMS Source Code in minutes using your preferred integration method.
# Add to your MCP client config (Claude Desktop, Cursor, Windsurf)
{
"jentic": {
"url": "https://api.jentic.com/mcp",
"auth": "oauth"
}
}
# Then ask your agent:
"read hubspot cms template source code"
# → Jentic returns the GET /events tool with parameter schema, agent executes.What an agent can do with CMS Source Code API.
Read the source code at a given path in either the draft or published environment
Upload or update template, module, and asset files at a specific path
Read or update file metadata such as folder placement and content type
Validate a file at a path before pushing it live to catch HUBL or syntax errors
GET STARTED
Use for: Read the published source for templates/main.html, Update modules/header.module/module.html in the draft environment, Validate templates/landing.html before pushing it live, Get the metadata for assets/styles.css
Not supported: Does not host binary media, manage page content, or expose runtime page renders — use for reading, writing, validating, and extracting HubSpot CMS template and module source files only.
The HubSpot CMS Source Code API exposes the file system that backs a HubSpot CMS — templates, modules, stylesheets, and JavaScript that pages and posts render against. It supports reading, writing, validating, and bulk-extracting source files in either the published or draft environments. Use it to manage HubSpot themes from a developer workflow, run validation checks before publishing, or migrate templates between portals.
Trigger an asynchronous extract of an entire CMS theme as a downloadable archive
Poll the status of an extract task and retrieve the resulting archive when ready
Patterns agents use CMS Source Code API for, with concrete tasks.
★ Themes In A Developer Workflow
Many developers prefer to manage HubSpot themes from a Git workflow rather than the in-browser design manager. The Source Code API supports reading and writing files at a path in either draft or published environments, letting a CI pipeline sync a Git repo to HubSpot. Validation runs before publish to catch syntax errors before they affect live pages.
For each changed file in a Git diff, PUT the content to /cms/v3/source-code/draft/content/{path}, run /cms/v3/source-code/draft/validate/{path}, and only promote to published if validation passes.
Cross-Portal Theme Migration
Agencies move themes between client portals or between a parent and sandbox account. The async extract endpoints package the entire theme into an archive that can be re-imported elsewhere. Polling the task status endpoint allows long-running extracts to be tracked without holding open a connection.
POST to /cms/v3/source-code/extract/async to start the extract, poll /cms/v3/source-code/extract/async/tasks/{taskId}/status until status is 'COMPLETE', then download the archive.
Pre-Publish Template Validation
Before promoting a draft template that powers many pages, content engineers want a deterministic check for HUBL syntax errors and missing references. The validate endpoint returns errors at the file level, allowing a script to abort the publish flow if any template fails. The result is fewer broken pages reaching production.
GET /cms/v3/source-code/draft/validate/{path} for each template, collect errors, and refuse to PUT to the published environment if any template has errors.
Agent-Driven Module Updates
An AI agent maintaining a brand-consistent theme can read existing modules, propose edits, and write the result back through a single search-load-execute cycle. Through Jentic, credentials never enter the agent context and the validation endpoint provides automatic feedback on each proposed change.
Use Jentic to search 'read hubspot source code at path', load the schema, execute it for the target module, generate updated HTML, and PUT it back via the matching write endpoint after validation passes.
8 endpoints — the hubspot cms source code api exposes the file system that backs a hubspot cms — templates, modules, stylesheets, and javascript that pages and posts render against.
METHOD
PATH
DESCRIPTION
/cms/v3/source-code/{environment}/content/{path}
Read source content at a path
/cms/v3/source-code/{environment}/content/{path}
Write source content at a path
/cms/v3/source-code/{environment}/metadata/{path}
Read metadata for a source file
/cms/v3/source-code/{environment}/validate/{path}
Validate a source file
/cms/v3/source-code/extract/async
Trigger an async theme extract
/cms/v3/source-code/extract/async/tasks/{taskId}/status
Check the status of an extract task
/cms/v3/source-code/{environment}/content/{path}
Read source content at a path
/cms/v3/source-code/{environment}/content/{path}
Write source content at a path
/cms/v3/source-code/{environment}/metadata/{path}
Read metadata for a source file
/cms/v3/source-code/{environment}/validate/{path}
Validate a source file
/cms/v3/source-code/extract/async
Trigger an async theme extract
Three things that make agents converge on Jentic-routed access.
Credential isolation
HubSpot OAuth tokens and Private App keys are stored encrypted in the Jentic vault (MAXsystem). The agent only sees a scoped execution token, keeping the raw HubSpot secret out of model context.
Intent-based discovery
Agents search Jentic with intents like 'read hubspot source code at path' or 'validate hubspot template' and receive the matching operation plus its input schema.
Time to first call
Direct integration: 1-2 days to wire OAuth, draft and published flows, validation, and async extract polling. Through Jentic: under half a day from search to a working publish loop.
Alternatives and complements available in the Jentic catalogue.
CMS Pages
Pages that render the templates and modules managed here
Use Source Code to update the template; use Pages to verify the rendered page picks up the change.
Blog Posts
Posts that consume the templates managed by this API
Use Source Code when changing the post template; use Posts when changing the post content itself.
Files
Stores binary assets like images and fonts that source code cannot
Choose Files for image, video, or font uploads; choose Source Code for HTML, CSS, and HUBL.
Specific to using CMS Source Code API through Jentic.
What authentication does the HubSpot CMS Source Code API use?
It accepts HubSpot OAuth 2.0 tokens or Private App tokens in the Authorization header with the content scope. Through Jentic, those credentials live in the encrypted vault and the agent only sees a scoped execution token.
Can I edit a published template directly with this API?
Yes, by writing to /cms/v3/source-code/published/content/{path}. In practice, write to draft first and validate, then promote — direct edits to published bypass the draft safety net.
What are the rate limits for the HubSpot Source Code API?
It uses HubSpot's standard public API caps: 100 requests per 10 seconds for OAuth apps and 110 per 10 seconds for Private Apps on Pro and Enterprise. The async extract endpoints offload heavy operations so they do not consume the quota during the long-running step.
How do I validate a template before publishing through Jentic?
Run pip install jentic, search 'validate hubspot template', load the schema, and execute it with environment='draft' and the path. Jentic posts to /cms/v3/source-code/draft/validate/{path} and returns any HUBL errors.
Does the Source Code API support uploading binary assets?
It handles text-based source files (HTML, HUBL, CSS, JavaScript) at given paths. For binary assets like images and fonts, use HubSpot's Files API, which is purpose-built for media storage.
/cms/v3/source-code/extract/async/tasks/{taskId}/status
Check the status of an extract task