kommo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Kommo API

Kommo API

Use the Kommo API via direct
curl
calls for CRM management including leads, contacts, companies, tasks, and sales pipelines.
Official docs:
https://developers.kommo.com/

通过直接
curl
调用使用Kommo API进行CRM管理,包括线索、联系人、公司、任务和销售管道。
官方文档:
https://developers.kommo.com/

When to Use

何时使用

Use this skill when you need to:
  • Manage leads - Create, list, update leads in your sales pipeline
  • Handle contacts - Add and retrieve customer contact information
  • Track companies - Manage company records and associations
  • Create tasks - Schedule follow-ups and meetings
  • View pipelines - Get sales pipeline stages and statuses

当你需要完成以下操作时使用本技能:
  • 管理线索 - 创建、查询、更新销售管道中的线索
  • 处理联系人 - 添加和获取客户联系信息
  • 跟踪公司 - 管理公司记录及关联关系
  • 创建任务 - 安排跟进和会议
  • 查看管道 - 获取销售管道阶段和状态

Prerequisites

前置条件

  1. Sign up at Kommo
  2. Create a private integration:
  • Go to Settings > Integrations > Create Integration
  • Select "Private integration"
  • Go to "Keys and scopes" tab
  • Click "Generate long-lived token"
  • Copy the token (it cannot be retrieved again)
  1. Note your subdomain from your Kommo URL:
    https://{subdomain}.kommo.com
bash
export KOMMO_SUBDOMAIN="your-subdomain" # e.g., "mycompany" (not "mycompany.kommo.com")
export KOMMO_API_KEY="your-long-lived-token"

Important: When using
$VAR
in a command that pipes to another command, wrap the command containing
$VAR
in
bash -c '...'
. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.
bash
bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
  1. Kommo注册账号
  2. 创建私有集成:
  • 进入设置 > 集成 > 创建集成
  • 选择「私有集成」
  • 进入「密钥和权限范围」标签页
  • 点击「生成长期令牌」
  • 复制令牌(后续无法再次获取)
  1. 记下你的Kommo URL中的子域名:
    https://{subdomain}.kommo.com
bash
export KOMMO_SUBDOMAIN="your-subdomain" # e.g., "mycompany" (not "mycompany.kommo.com")
export KOMMO_API_KEY="your-long-lived-token"

重要提示: 在需要管道传输的命令中使用
$VAR
时,请将包含
$VAR
的命令包裹在
bash -c '...'
中。由于Claude Code的bug,直接使用管道时环境变量会被静默清除。
bash
bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'

How to Use

使用方法

All examples below assume you have environment variables set.
The base URL is:
https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4
Authentication uses Bearer token in the
Authorization
header.
Rate limit: Maximum 7 requests per second.

以下所有示例都假设你已设置好环境变量。
基础URL为:
https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4
身份认证使用
Authorization
头中的Bearer令牌。
速率限制: 最高每秒7次请求。

1. List Leads

1. 列出线索

Get all leads in your account:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["leads"][] | {id, name, price}'
With filters:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads?limit=10&page=1" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["leads"]'

获取账号下所有线索:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["leads"][] | {id, name, price}'
带筛选条件:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads?limit=10&page=1" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["leads"]'

2. Get Lead by ID

2. 根据ID获取线索

Get a specific lead:
Replace
<your-lead-id>
with the actual lead ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/<your-lead-id>" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"'

获取指定线索:
<your-lead-id>
替换为实际的线索ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/<your-lead-id>" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"'

3. Create Lead

3. 创建线索

Create a new lead:
Write to
/tmp/kommo_request.json
:
json
[{
  "name": "New Lead",
  "price": 5000
}]
Then run:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

创建新线索:
写入内容到
/tmp/kommo_request.json
json
[{
  "name": "New Lead",
  "price": 5000
}]
然后运行:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

4. Create Lead with Contact and Company

4. 创建带关联联系人和公司的线索

Create a lead with associated contact and company:
Write to
/tmp/kommo_request.json
:
json
[{
  "name": "Lead with Contact",
  "price": 10000,
  "_embedded": {
    "contacts": [{
      "first_name": "John",
      "last_name": "Doe"
    }],
    "companies": [{
      "name": "Acme Corp"
    }]
  }
}]
Then run:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/complex" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

创建关联了联系人和公司的线索:
写入内容到
/tmp/kommo_request.json
json
[{
  "name": "Lead with Contact",
  "price": 10000,
  "_embedded": {
    "contacts": [{
      "first_name": "John",
      "last_name": "Doe"
    }],
    "companies": [{
      "name": "Acme Corp"
    }]
  }
}]
然后运行:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/complex" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

5. Update Lead

5. 更新线索

Update an existing lead:
Write to
/tmp/kommo_request.json
:
json
{
  "price": 7500,
  "name": "Updated Lead Name"
}
Then run:
Replace
<your-lead-id>
with the actual lead ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/<your-lead-id>" -X PATCH -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

更新已有线索:
写入内容到
/tmp/kommo_request.json
json
{
  "price": 7500,
  "name": "Updated Lead Name"
}
然后运行:
<your-lead-id>
替换为实际的线索ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/<your-lead-id>" -X PATCH -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

6. List Contacts

6. 列出联系人

Get all contacts:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/contacts" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["contacts"][] | {id, name}'

获取所有联系人:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/contacts" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["contacts"][] | {id, name}'

7. Get Contact by ID

7. 根据ID获取联系人

Get a specific contact:
Replace
<your-contact-id>
with the actual contact ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/contacts/<your-contact-id>" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"'

获取指定联系人:
<your-contact-id>
替换为实际的联系人ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/contacts/<your-contact-id>" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"'

8. Create Contact

8. 创建联系人

Create a new contact:
Write to
/tmp/kommo_request.json
:
json
[{
  "first_name": "Jane",
  "last_name": "Smith"
}]
Then run:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/contacts" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

创建新联系人:
写入内容到
/tmp/kommo_request.json
json
[{
  "first_name": "Jane",
  "last_name": "Smith"
}]
然后运行:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/contacts" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

9. List Companies

9. 列出公司

Get all companies:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/companies" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["companies"][] | {id, name}'

获取所有公司:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/companies" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["companies"][] | {id, name}'

10. Create Company

10. 创建公司

Create a new company:
Write to
/tmp/kommo_request.json
:
json
[{
  "name": "New Company Inc"
}]
Then run:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/companies" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

创建新公司:
写入内容到
/tmp/kommo_request.json
json
[{
  "name": "New Company Inc"
}]
然后运行:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/companies" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'

11. List Tasks

11. 列出任务

Get all tasks:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/tasks" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["tasks"][] | {id, text, complete_till}'

获取所有任务:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/tasks" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["tasks"][] | {id, text, complete_till}'

12. Create Task

12. 创建任务

Create a new task (use Unix timestamp for
complete_till
):
Write to
/tmp/kommo_request.json
:
json
[{
  "text": "Follow up with client",
  "complete_till": 1735689600,
  "task_type_id": 1
}]
Then run:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/tasks" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'
Task types:
1
= Follow-up,
2
= Meeting

创建新任务(
complete_till
使用Unix时间戳):
写入内容到
/tmp/kommo_request.json
json
[{
  "text": "Follow up with client",
  "complete_till": 1735689600,
  "task_type_id": 1
}]
然后运行:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/tasks" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}" -d @/tmp/kommo_request.json'
任务类型:
1
= 跟进,
2
= 会议

13. List Pipelines

13. 列出销售管道

Get all sales pipelines:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/pipelines" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["pipelines"][] | {id, name}'

获取所有销售管道:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/pipelines" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["pipelines"][] | {id, name}'

14. Get Pipeline Stages

14. 获取管道阶段

Get stages for a specific pipeline:
Replace
<your-pipeline-id>
with the actual pipeline ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/pipelines/<your-pipeline-id>" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["statuses"][] | {id, name}'

获取指定销售管道的阶段:
<your-pipeline-id>
替换为实际的管道ID:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/leads/pipelines/<your-pipeline-id>" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '.["_embedded"]["statuses"][] | {id, name}'

15. Get Account Info

15. 获取账号信息

Get account information:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/account" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '{id, name, subdomain, currency}'

获取账号相关信息:
bash
bash -c 'curl -s "https://${KOMMO_SUBDOMAIN}.kommo.com/api/v4/account" -H "Accept: application/json" -H "Authorization: Bearer ${KOMMO_API_KEY}"' | jq '{id, name, subdomain, currency}'

Response Format

响应格式

Lead Response

线索响应

json
{
  "id": 12345,
  "name": "Lead Name",
  "price": 5000,
  "responsible_user_id": 123,
  "pipeline_id": 456,
  "status_id": 789
}
json
{
  "id": 12345,
  "name": "Lead Name",
  "price": 5000,
  "responsible_user_id": 123,
  "pipeline_id": 456,
  "status_id": 789
}

Contact Response

联系人响应

json
{
  "id": 12345,
  "name": "John Doe",
  "first_name": "John",
  "last_name": "Doe"
}

json
{
  "id": 12345,
  "name": "John Doe",
  "first_name": "John",
  "last_name": "Doe"
}

Guidelines

使用规范

  1. Rate limit: Maximum 7 requests per second, 429 returned if exceeded
  2. Array format: POST requests for creating entities expect an array of objects
  3. Use pagination: Add
    ?limit=N&page=N
    for large result sets
  4. Task timestamps:
    complete_till
    is Unix timestamp in seconds
  5. If-Modified-Since: Use this header for efficient polling of list endpoints
  1. 速率限制: 最高每秒7次请求,超出将返回429状态码
  2. 数组格式: 创建实体的POST请求需要传入对象数组
  3. 使用分页: 结果集较大时添加
    ?limit=N&page=N
    参数
  4. 任务时间戳:
    complete_till
    是秒级Unix时间戳
  5. If-Modified-Since: 列表接口轮询时使用该头提升效率