Clay
Use clay to search, create, update, and manage your personal contact network from the command line.
Requirements
- - A Clay account (clay.earth)
- Authenticate before using any commands: INLINECODE1
Authentication
Log in (opens browser for OAuth):
CODEBLOCK0
Check authentication status:
CODEBLOCK1
Log out:
CODEBLOCK2
Credentials are stored in ~/.config/clay.json.
Output Formats
All data commands support --format to control output:
- -
json (default) — Pretty-printed JSON - INLINECODE5 — Comma-separated values
- INLINECODE6 — Tab-separated values
CODEBLOCK3
Contacts
Get a contact by ID:
CODEBLOCK4
Search contacts:
CODEBLOCK5
Create a contact:
CODEBLOCK6
Update a contact:
CODEBLOCK7
Archive / restore contacts:
CODEBLOCK8
Merge duplicate contacts:
CODEBLOCK9
Notes
List notes in a date range:
CODEBLOCK10
Create a note on a contact:
CODEBLOCK11
Notes support contact references in content: [contact:123:John Doe].
Groups
List all groups:
CODEBLOCK12
Create a group:
CODEBLOCK13
Update a group (rename, add/remove members):
CODEBLOCK14
Events
List events in a date range:
CODEBLOCK15
List upcoming events:
CODEBLOCK16
Emails
List emails in a date range:
CODEBLOCK17
List recent emails:
CODEBLOCK18
Reminders
List recent reminders:
CODEBLOCK19
List upcoming reminders:
CODEBLOCK20
Search Options Reference
The contacts:search command supports filters for:
- - Name: INLINECODE9
- Work:
--work-history-company, --work-history-position, INLINECODE12 - Education:
--education-history-school, --education-history-degree, INLINECODE15 - Location:
--location-latitude, --location-longitude, INLINECODE18 - Age:
--age-gte, INLINECODE20 - Birthday:
--upcoming-birthday-gte/lte, INLINECODE22 - Contact info:
--information-type (filter by type of info available) - Interaction dates:
--first-email-date-gte/lte, --last-email-date-gte/lte, --first-event-date-gte/lte, --last-event-date-gte/lte, --first-text-message-date-gte/lte, --last-text-message-date-gte/lte, --first-interaction-date-gte/lte, INLINECODE31 - Interaction counts:
--email-count-gte/lte, --event-count-gte/lte, INLINECODE34 - Notes:
--note-content, INLINECODE36 - Groups:
--group-ids (group ID or "starred") - Integration: INLINECODE39
- Sorting:
--sort-field, INLINECODE41 - Pagination:
--limit, INLINECODE43 - Fields:
--include-fields (select which fields to return)
Clay
使用 clay 从命令行搜索、创建、更新和管理您的个人联系人网络。
系统要求
- - 一个 Clay 账户 (clay.earth)
- 使用任何命令前需进行身份验证:clay login
身份验证
登录(在浏览器中打开 OAuth 授权页面):
bash
clay login
检查身份验证状态:
bash
clay status
退出登录:
bash
clay logout
凭据存储在 ~/.config/clay.json 中。
输出格式
所有数据命令均支持 --format 参数来控制输出格式:
- - json(默认)— 格式化打印的 JSON
- csv — 逗号分隔值
- tsv — 制表符分隔值
bash
clay contacts:search --name Alice --format csv
clay emails:recent --format tsv
联系人
通过 ID 获取联系人:
bash
clay contact --contact-id 12345
搜索联系人:
bash
clay contacts:search --name Jane Smith
clay contacts:search --work-history-company Acme --work-history-active true
clay contacts:search --education-history-school MIT
clay contacts:search --location-latitude 37.7749 --location-longitude -122.4194 --location-distance 50
clay contacts:search --last-email-date-gte 2025-01-01 --sort-field lastemaildate --sort-direction desc
clay contacts:search --group-ids starred --limit 10
clay contacts:search --keywords investor --include-fields name,email,title
创建联系人:
bash
clay contacts:create --first-name Jane --last-name Doe --email jane@example.com
clay contacts:create --first-name Bob --title CEO --organization Acme Inc --birthday 1990-05-15
更新联系人:
bash
clay contacts:update --contact-id 12345 --title CTO --organization NewCo
clay contacts:update --contact-id 12345 --email new@example.com --phone +1234567890
归档/恢复联系人:
bash
clay contacts:archive --contact-ids 12345
clay contacts:restore --contact-ids 12345
合并重复联系人:
bash
clay contacts:merge --contact-ids 12345 --contact-ids 67890
备注
列出指定日期范围内的备注:
bash
clay notes --start 2025-01-01 --end 2025-12-31
clay notes --contact-ids 12345
在联系人上创建备注:
bash
clay notes:create --contact-id 12345 --content 在会议上认识,对合作非常感兴趣。
clay notes:create --contact-id 12345 --content 下周跟进 --reminder-date 2026-03-01T09:00:00Z
备注内容支持联系人引用:[contact:123:John Doe]。
分组
列出所有分组:
bash
clay groups
clay groups --limit 50
创建分组:
bash
clay groups:create --title 投资者
更新分组(重命名、添加/移除成员):
bash
clay groups:update --group-id 42 --title 天使投资人
clay groups:update --group-id 42 --add-contact-ids 12345 --add-contact-ids 67890
clay groups:update --group-id 42 --remove-contact-ids 11111
活动
列出指定日期范围内的活动:
bash
clay events --start 2025-01-01 --end 2025-03-01
clay events --contact-ids 12345
列出即将到来的活动:
bash
clay events:upcoming
clay events:upcoming --limit 20 --page 2
邮件
列出指定日期范围内的邮件:
bash
clay emails --start 2025-01-01 --end 2025-02-01
clay emails --contact-ids 12345
列出最近的邮件:
bash
clay emails:recent
clay emails:recent --limit 25 --contact-ids 12345
提醒
列出最近的提醒:
bash
clay reminders:recent
clay reminders:recent --limit 5
列出即将到来的提醒:
bash
clay reminders:upcoming
clay reminders:upcoming --limit 20 --page 2
搜索选项参考
contacts:search 命令支持以下筛选条件:
- - 姓名:--name
- 工作:--work-history-company、--work-history-position、--work-history-active
- 教育:--education-history-school、--education-history-degree、--education-history-active
- 位置:--location-latitude、--location-longitude、--location-distance
- 年龄:--age-gte、--age-lte
- 生日:--upcoming-birthday-gte/lte、--previous-birthday-gte/lte
- 联系信息:--information-type(按可用信息类型筛选)
- 互动日期:--first-email-date-gte/lte、--last-email-date-gte/lte、--first-event-date-gte/lte、--last-event-date-gte/lte、--first-text-message-date-gte/lte、--last-text-message-date-gte/lte、--first-interaction-date-gte/lte、--last-interaction-date-gte/lte
- 互动次数:--email-count-gte/lte、--event-count-gte/lte、--text-message-count-gte/lte
- 备注:--note-content、--note-date-gte/lte
- 分组:--group-ids(分组 ID 或 starred)
- 集成:--integration
- 排序:--sort-field、--sort-direction
- 分页:--limit、--exclude-contact-ids
- 字段:--include-fields(选择要返回的字段)