当前位置: 首页 > Skill >

HubSpot

HubSpot

HubSpot

HubSpot CRM与CMS API集成,用于联系人、公司、交易、所有者及内容管理。

1.0.1 2026.11.22 139
获取Skill文件查看使用说明
作 者:江景 许可证: 更新时间:2026.11.22
本文目录展开

HubSpot Skill

Interact with HubSpot CRM and CMS via the REST API.

Setup

Set your HubSpot Private App access token:

HUBSPOT_ACCESS_TOKEN=pat-na2-xxxxx

API Base

All endpoints use: https://api.hubapi.com

Authorization header: Bearer $HUBSPOT_ACCESS_TOKEN

CRM Objects

Contacts

Create contact:

curl -s -X POST -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"properties":{"email":"test@example.com","firstname":"Test","lastname":"User","phone":"555-1234","company":"Acme Inc","jobtitle":"Manager"}}' 
  "https://api.hubapi.com/crm/v3/objects/contacts" | jq

List contacts:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/contacts?limit=10" | jq

Search contacts:

curl -s -X POST -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"filterGroups":[{"filters":[{"propertyName":"email","operator":"CONTAINS_TOKEN","value":"example.com"}]}],"limit":10}' 
  "https://api.hubapi.com/crm/v3/objects/contacts/search" | jq

Get contact by ID:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/contacts/{contactId}?properties=email,firstname,lastname,phone,company" | jq

Get contact by email:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/contacts/{email}?idProperty=email" | jq

Companies

List companies:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/companies?limit=10&properties=name,domain,industry" | jq

Search companies:

curl -s -X POST -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"filterGroups":[{"filters":[{"propertyName":"name","operator":"CONTAINS_TOKEN","value":"acme"}]}],"limit":10}' 
  "https://api.hubapi.com/crm/v3/objects/companies/search" | jq

Get company by ID:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/companies/{companyId}?properties=name,domain,industry,numberofemployees" | jq

Deals

Create deal:

curl -s -X POST -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"properties":{"dealname":"New Deal","amount":"10000","closedate":"2026-06-01","description":"Deal notes here"}}' 
  "https://api.hubapi.com/crm/v3/objects/deals" | jq

List deals:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/deals?limit=10&properties=dealname,amount,dealstage,closedate" | jq

Search deals:

curl -s -X POST -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"filterGroups":[{"filters":[{"propertyName":"dealstage","operator":"EQ","value":"closedwon"}]}],"limit":10}' 
  "https://api.hubapi.com/crm/v3/objects/deals/search" | jq

Get deal by ID:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/objects/deals/{dealId}?properties=dealname,amount,dealstage,closedate,pipeline" | jq

Owners

List owners (users):

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/owners" | jq

Update & Assign Owner

Update contact properties:

curl -s -X PATCH -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"properties":{"phone":"555-9999","jobtitle":"Director"}}' 
  "https://api.hubapi.com/crm/v3/objects/contacts/{contactId}" | jq

Assign owner to contact:

curl -s -X PATCH -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"properties":{"hubspot_owner_id":"{ownerId}"}}' 
  "https://api.hubapi.com/crm/v3/objects/contacts/{contactId}" | jq

Assign owner to deal:

curl -s -X PATCH -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"properties":{"hubspot_owner_id":"{ownerId}"}}' 
  "https://api.hubapi.com/crm/v3/objects/deals/{dealId}" | jq

Associations

Get associated contacts for a company:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v4/objects/companies/{companyId}/associations/contacts" | jq

Get associated deals for a contact:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v4/objects/contacts/{contactId}/associations/deals" | jq

Create association (deal to contact):

curl -s -X POST -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"inputs":[{"from":{"id":"{dealId}"},"to":{"id":"{contactId}"},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":3}]}]}' 
  "https://api.hubapi.com/crm/v4/associations/deals/contacts/batch/create" | jq

Common association type IDs:

  • 3: Deal to Contact
  • 5: Deal to Company
  • 1: Contact to Company

Properties (Schema)

List contact properties:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/properties/contacts" | jq '.results[].name'

List company properties:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/properties/companies" | jq '.results[].name'

List deal properties:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/crm/v3/properties/deals" | jq '.results[].name'

CMS

Pages

List site pages:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/cms/v3/pages/site-pages?limit=10" | jq

List landing pages:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/cms/v3/pages/landing-pages?limit=10" | jq

Domains

List domains:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/cms/v3/domains" | jq

Files

List files:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/files/v3/files?limit=10" | jq

Search files:

curl -s -H "Authorization: Bearer $HUBSPOT_ACCESS_TOKEN" 
  "https://api.hubapi.com/files/v3/files/search?name=logo" | jq

Search Operators

For search endpoints, use these operators in filters:

Operator Description
EQ Equal to
NEQ Not equal to
LT Less than
LTE Less than or equal
GT Greater than
GTE Greater than or equal
CONTAINS_TOKEN Contains word
NOT_CONTAINS_TOKEN Does not contain word
HAS_PROPERTY Has a value
NOT_HAS_PROPERTY Does not have a value

PowerShell Examples

For Windows/PowerShell, use Invoke-RestMethod:

$headers = @{ 
  "Authorization" = "Bearer $env:HUBSPOT_ACCESS_TOKEN"
  "Content-Type" = "application/json" 
}

# List contacts
Invoke-RestMethod -Uri "https://api.hubapi.com/crm/v3/objects/contacts?limit=10" -Headers $headers

# Search contacts
$body = @{
  filterGroups = @(@{
    filters = @(@{
      propertyName = "email"
      operator = "CONTAINS_TOKEN"
      value = "example.com"
    })
  })
  limit = 10
} | ConvertTo-Json -Depth 5

Invoke-RestMethod -Method POST -Uri "https://api.hubapi.com/crm/v3/objects/contacts/search" -Headers $headers -Body $body

Notes

  • Full CRUD operations supported with appropriate scopes
  • Rate limits: 100 requests per 10 seconds for private apps
  • Pagination: Use after parameter from paging.next.after for next page
  • Portal ID is in the record URL: https://app-na2.hubspot.com/contacts/{portalId}/record/...

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,014
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,014
Skill 文件
  • SKILL.md
    • HubSpot Skill
    • Setup
    • API Base
    • CRM Objects
      • Contacts
      • Companies
      • Deals
      • Owners
    • Update & Assign Owner
    • Associations
    • Properties (Schema)
    • CMS
      • Pages
      • Domains
    • Files
    • Search Operators
    • PowerShell Examples
    • Notes
  • 项目或源文件

相关 Skill

更多
hubspot-integration hubspot-integration HubSpot CRM 集成的专家模式,涵盖 OAuth 认证、CRM 对象、关联、批量操作、Webhook 与自定义对象。覆盖 Node.js 与 Pytho
Hubspot Suite Hubspot Suite 全能HubSpot CRM、营销、销售、服务及CMS管理套件,覆盖所有HubSpot API。
Delete No Email Contacts Delete No Email Contacts 从HubSpot CRM实例中删除没有电子邮件地址的联系人。这些联系人无法接收任何通讯,且会增加计费。完全自动化通过...
Copy.ai Sales Email Sequence Builder Copy.ai Sales Email Sequence Builder 利用 Copy.ai 的 Workflows API 生成多步骤冷启动外联序列,包含针对不同角色的消息。每个序列步骤都使用 Copy.ai 的 email-sequence 模板类型生成,并通过 HubSpot Contacts 和 Emails API 推送到 HubSpot CRM。
Hubspot Audit Hubspot Audit 对HubSpot CRM数据库进行全面审计,分析联系人、公司、交易、互动、数据质量和送达率。适用于启动CRM时使用。