lark-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Lark CLI

Lark CLI

This skill uses the
lark
CLI to operate Feishu/Lark products (IM, Drive, Docs, Sheets, Mail, Calendar, Wiki, Bitable, Tasks, and more), with the shortest-path examples and reference links.
本技能使用
lark
CLI操作飞书/Lark产品(即时通讯、云盘、文档、表格、邮箱、日历、知识库、多维表格、任务等),提供最简路径示例及参考链接。

What this repo provides

本仓库提供的内容

  • lark
    CLI: a single binary to access Feishu/Lark products (IM, Drive, Docs, Sheets, Mail, Calendar, Wiki, Bitable, Tasks).
  • Two output modes: human tables by default, JSON with
    --json
    for automation.
  • SDK-first implementation via the official
    oapi-sdk-go
    .
  • lark
    CLI:一款可访问飞书/Lark全产品(即时通讯、云盘、文档、表格、邮箱、日历、知识库、多维表格、任务)的单二进制文件工具。
  • 两种输出模式:默认输出易读的表格格式,添加
    --json
    参数可输出JSON格式以支持自动化场景。
  • 基于官方
    oapi-sdk-go
    实现的SDK优先架构。

Quickstart (minimal)

快速入门(最简版)

  1. Install the CLI (see
    references/INSTALL.md
    ).
  2. Authenticate:
    • Tenant token (app-only, bot/app identity):
      lark auth tenant
    • User token (user-scoped, on behalf of a user):
      lark auth user login
      See
      references/AUTH.md
      for details and scopes.
  3. Run a command:
bash
lark whoami
lark chats list --limit 10
lark users search "Ada" --json
  1. 安装CLI(详见
    references/INSTALL.md
    )。
  2. 身份验证:
    • 租户令牌(仅应用身份,机器人/应用身份):
      lark auth tenant
    • 用户令牌(用户范围,代表特定用户操作):
      lark auth user login
      详见
      references/AUTH.md
      了解详细信息及权限范围。
  3. 运行命令:
bash
lark whoami
lark chats list --limit 10
lark users search "Ada" --json

Core concepts (tl;dr)

核心概念(简述)

  • Feishu = Lark (global brand). Same API surface, different API endpoints.
  • Most commands follow:
    lark <product> <action> [args] [flags]
    .
  • Required IDs are positional args (no required
    --id
    flags).
  • Many commands accept a Lark/Feishu web URL in place of IDs.
  • --json
    prints machine-readable output to stdout; logs/errors go to stderr.
See
references/CONCEPTS.md
for a longer primer.
  • 飞书 = Lark(全球品牌)。API接口一致,仅API端点不同。
  • 大多数命令遵循格式:
    lark <产品> <操作> [参数] [标志]
  • 必填ID为位置参数(无需必填的
    --id
    标志)。
  • 许多命令支持使用Lark/飞书网页URL替代ID。
  • --json
    参数会将机器可读的输出打印到标准输出;日志/错误信息输出到标准错误输出。
如需更详细的介绍,请查看
references/CONCEPTS.md

When to use tenant vs user tokens

何时使用租户令牌 vs 用户令牌

  • Tenant token: app-level operations as your bot/app identity.
  • User token: user-scoped operations on behalf of a specific user.
If a command fails with scope errors, check
references/TROUBLESHOOTING.md
.
  • 租户令牌:以机器人/应用身份执行应用级操作。
  • 用户令牌:代表特定用户执行用户范围的操作。
如果命令因权限范围错误失败,请查看
references/TROUBLESHOOTING.md

Token Type Usage

令牌类型使用

Use
--token-type
to force the access token type:
  • --token-type auto
    : default, auto-select based on command needs.
  • --token-type tenant
    : force tenant token.
  • --token-type user
    : force user token.
Examples:
bash
lark whoami --token-type tenant
lark drive list --token-type user
使用
--token-type
参数强制指定访问令牌类型:
  • --token-type auto
    :默认值,根据命令需求自动选择。
  • --token-type tenant
    :强制使用租户令牌。
  • --token-type user
    :强制使用用户令牌。
示例:
bash
lark whoami --token-type tenant
lark drive list --token-type user

Agent-friendly workflow

适配Agent的工作流

  • Prefer
    --json
    and parse in tools/scripts.
  • Use
    --limit
    /
    --pages
    for pagination-heavy commands.
  • Reuse
    --account
    or
    LARK_ACCOUNT
    for multi-user scenarios.
  • 优先使用
    --json
    参数并在工具/脚本中解析输出。
  • 对涉及分页的命令,使用
    --limit
    /
    --pages
    参数。
  • 在多用户场景下,复用
    --account
    参数或
    LARK_ACCOUNT
    环境变量。

Common recipes

常用操作示例

See
references/RECIPES.md
for common tasks (send message, search users, read docs, etc.).
查看
references/RECIPES.md
获取常见任务示例(发送消息、搜索用户、读取文档等)。

Deep references

深度参考文档

  • Install:
    references/INSTALL.md
  • Auth & scopes:
    references/AUTH.md
  • Concepts & IDs:
    references/CONCEPTS.md
  • Recipes:
    references/RECIPES.md
  • Troubleshooting:
    references/TROUBLESHOOTING.md
  • Completion:
    references/COMPLETION.md
  • Docs:
    references/DOCS.md
  • Sheets:
    references/SHEETS.md
  • Bitable bases:
    references/BASES.md
  • Drive:
    references/DRIVE.md
  • Minutes:
    references/MINUTES.md
  • Calendars:
    references/CALENDARS.md
  • Meetings:
    references/MEETINGS.md
  • Chats:
    references/CHATS.md
  • Messages:
    references/MESSAGES.md
  • Contacts:
    references/CONTACTS.md
  • Mail:
    references/MAIL.md
  • Tasklists:
    references/TASKLISTS.md
  • Tasks:
    references/TASKS.md
  • Users:
    references/USERS.md
  • Config:
    references/CONFIG.md
  • Whoami:
    references/WHOAMI.md
  • Wiki:
    references/WIKI.md
  • 安装:
    references/INSTALL.md
  • 身份验证与权限范围:
    references/AUTH.md
  • 概念与ID:
    references/CONCEPTS.md
  • 操作示例:
    references/RECIPES.md
  • 故障排查:
    references/TROUBLESHOOTING.md
  • 命令补全:
    references/COMPLETION.md
  • 文档:
    references/DOCS.md
  • 表格:
    references/SHEETS.md
  • 多维表格:
    references/BASES.md
  • 云盘:
    references/DRIVE.md
  • 会议纪要:
    references/MINUTES.md
  • 日历:
    references/CALENDARS.md
  • 会议:
    references/MEETINGS.md
  • 群组:
    references/CHATS.md
  • 消息:
    references/MESSAGES.md
  • 通讯录:
    references/CONTACTS.md
  • 邮箱:
    references/MAIL.md
  • 任务列表:
    references/TASKLISTS.md
  • 任务:
    references/TASKS.md
  • 用户:
    references/USERS.md
  • 配置:
    references/CONFIG.md
  • 身份查询:
    references/WHOAMI.md
  • 知识库:
    references/WIKI.md