Cleanup Forms
Audit HubSpot forms to remove unused and test forms. Stale forms clutter the forms dashboard and can cause confusion when building workflows or reports.
Prerequisites
- - HubSpot API token in INLINECODE0
- Python with
hubspot-api-client installed via INLINECODE2 - Note: The Forms API may return 403 on some plan tiers. If so, perform the audit manually in the HubSpot UI under Marketing > Forms.
Step-by-Step Instructions
Stage 1: Before — Inventory All Forms
Pull all forms via the API:
CODEBLOCK0
For each form, record: form ID, name, type, submission count, created date, last submission date.
Stage 2: Execute — Identify Candidates for Deletion
Flag forms matching any of these criteria:
- 1. Zero submissions and created more than 30 days ago
- No recent submissions (last submission 6+ months ago) and not embedded on an active page
- Test forms (names containing "test", "temp", "draft", "copy of")
- Deprecated forms replaced by newer versions
Before deleting, check:
- - Is the form referenced in any workflow enrollment trigger?
- Is the form embedded on any live landing page or website page?
- Is the form used in any pop-up or slide-in CTA?
Stage 3: After — Delete and Document
- 1. Delete confirmed unused forms via the API or UI.
- Document what was deleted in a cleanup log.
- If a form with submissions is deleted, the submission data is retained on the contact records — but the form definition is gone.
Stage 4: Rollback
- - Deleted forms cannot be restored in HubSpot.
- Before deleting a form with any submissions, export the form definition (field names, settings) so it can be recreated.
- Contact records retain their form submission history regardless of form deletion.
Tips
- - Establish a naming convention:
[TEAM] - Purpose - Version (e.g., [Marketing] - Webinar Registration - v2). - Prefix deprecated forms with "[DEPRECATED]" instead of deleting immediately — delete after one quarter of no usage.
清理表单
审计HubSpot表单,移除未使用和测试用的表单。过时的表单会杂乱地堆积在表单仪表板中,并在构建工作流或报告时造成混淆。
前提条件
- - 在.env文件中配置HubSpot API令牌
- 通过uv安装带有hubspot-api-client的Python环境
- 注意:某些套餐层级下Forms API可能返回403错误。若出现此情况,请在HubSpot界面中手动执行审计,路径为:营销 > 表单。
分步操作说明
第一阶段:操作前——盘点所有表单
通过API拉取所有表单:
python
from hubspot import HubSpot
apiclient = HubSpot(accesstoken=os.getenv(HUBSPOTAPITOKEN))
forms = apiclient.marketing.forms.formsapi.get_page(limit=100)
针对每个表单,记录:表单ID、名称、类型、提交次数、创建日期、最后提交日期。
第二阶段:执行——识别待删除候选表单
标记符合以下任一条件的表单:
- 1. 零提交且创建时间超过30天
- 近期无提交(最后提交距今6个月以上)且未嵌入到活跃页面中
- 测试表单(名称包含test、temp、draft、copy of)
- 已弃用表单(已被新版本替代)
删除前需检查:
- - 该表单是否被任何工作流注册触发器引用?
- 该表单是否嵌入到任何活跃的落地页或网站页面中?
- 该表单是否用于任何弹窗或滑入式CTA?
第三阶段:操作后——删除并记录
- 1. 通过API或界面删除确认未使用的表单。
- 在清理日志中记录已删除的内容。
- 如果删除了有提交记录的表单,提交数据仍会保留在联系人记录中——但表单定义将不复存在。
第四阶段:回滚
- - 已删除的表单无法在HubSpot中恢复。
- 在删除任何有提交记录的表单前,请导出表单定义(字段名称、设置),以便后续重新创建。
- 无论表单是否被删除,联系人记录都会保留其表单提交历史。
提示
- - 建立命名规范:[团队] - 用途 - 版本(例如:[市场部] - 网络研讨会注册 - v2)。
- 对于已弃用的表单,先添加[DEPRECATED]前缀而非立即删除——待一个季度无使用后再行删除。