companies-house-cli
Use ch for UK Companies House data: company search, profiles, officers, filings, PSC, charges, and insolvency.
Setup
- - INLINECODE1
- Get a free API key: https://developer.company-information.service.gov.uk/
- INLINECODE2 or add it to a local INLINECODE3
Search
- - By name: INLINECODE4
- With restrictions: INLINECODE5
- Fetch all pages: INLINECODE6
- JSON in canonical style: INLINECODE7
Company Profile
- - By number: INLINECODE8
- Force text: INLINECODE9
- Short numbers auto-pad:
ch info 9215862 becomes INLINECODE11
Officers
- - List directors/secretaries: INLINECODE12
- All officers: INLINECODE13
- Order by: INLINECODE14
Filings
- - Filing history: INLINECODE15
- Filter by type: INLINECODE16
- Include document download links: INLINECODE17
- All filings: INLINECODE18
PSC (Beneficial Owners)
- - List PSC records: INLINECODE19
- All records: INLINECODE20
Search Person
- - Find a person across UK companies: INLINECODE21
- Limit enrichment fan-out: INLINECODE22
- Fetch all search pages: INLINECODE23
Charges
- - List company charges: INLINECODE24
- All charges: INLINECODE25
Insolvency
- - Check insolvency history: INLINECODE26
- Returns empty result cleanly if no history exists (not an error)
Pagination
- - List commands support:
--items-per-page <n>, --start-index <n>, INLINECODE29 - INLINECODE30 fetches every page automatically
- INLINECODE31 and non-zero
--start-index cannot be combined
Output
- - Defaults to text in a TTY and JSON when piped
- Canonical usage is subcommand-local flags:
ch search "Revolut" --json, INLINECODE34 - Root compatibility aliases still work:
ch --json search "Revolut", INLINECODE36 - Success envelope: INLINECODE37
- Error envelope: INLINECODE38
- Command metadata now lives under
data.input and INLINECODE40 - Disable colour: INLINECODE41
Agent Notes
- - JSON mode writes handled errors to stdout, not stderr
- Error payloads include
code, message, and INLINECODE44 - Exit codes are explicit:
-
0 success
-
2 bad input or not found
-
3 auth, upstream, or rate-limit failures
-
4 internal failures
- - Update any existing parsers that expected top-level
input or pagination; those now live under INLINECODE51
Notes
- - API key required (free, instant signup at Companies House developer portal)
- Auth is HTTP Basic (key as username, blank password)
- Rate limit: 600 requests per 5 minutes
- Company numbers are automatically zero-padded to 8 digits
- INLINECODE52 fans out appointment requests for each match — use
--match-limit on broad names to control API usage - INLINECODE54 on filings derives document content URLs for direct PDF download
companies-house-cli
使用 ch 查询英国公司注册处数据:公司搜索、公司档案、高管信息、备案文件、PSC(人员具有重大控制权)、抵押记录及破产信息。
设置
- - npm install -g @shan8851/companies-house-cli
- 获取免费 API 密钥:https://developer.company-information.service.gov.uk/
- export COMPANIESHOUSEAPIKEY=yourkey 或将其添加到本地 .env 文件中
搜索
- - 按名称搜索:ch search Revolut
- 带限制条件:ch search Revolut --restrictions active-companies
- 获取所有页面:ch search Revolut --all
- 规范格式 JSON 输出:ch search Revolut --json
公司档案
- - 按编号查询:ch info 09215862
- 强制文本输出:ch info 09215862 --text
- 短编号自动补零:ch info 9215862 将自动变为 09215862
高管信息
- - 列出董事/秘书:ch officers 09215862
- 所有高管:ch officers 09215862 --all
- 排序方式:ch officers 09215862 --order-by appointed_on
备案文件
- - 备案历史:ch filings 09215862
- 按类型筛选:ch filings 09215862 --type accounts
- 包含文件下载链接:ch filings 09215862 --type accounts --include-links
- 所有备案文件:ch filings 09215862 --all
PSC(实际受益人)
- - 列出 PSC 记录:ch psc 09215862
- 所有记录:ch psc 09215862 --all
人员搜索
- - 跨英国公司查找人员:ch search-person Nik Storonsky
- 限制关联扩展范围:ch search-person Nik Storonsky --match-limit 5
- 获取所有搜索页面:ch search-person Nik Storonsky --all
抵押记录
- - 列出公司抵押记录:ch charges 09215862
- 所有抵押记录:ch charges 09215862 --all
破产信息
- - 查询破产历史:ch insolvency 09215862
- 若无历史记录则返回空结果(非错误)
分页
- - 列表命令支持:--items-per-page 、--start-index 、--all
- --all 自动获取所有页面
- --all 与非零 --start-index 不能同时使用
输出
- - 默认在 TTY 中输出文本,管道输出时输出 JSON
- 规范用法为子命令本地标志:ch search Revolut --json、ch info 09215862 --text
- 根级别兼容别名仍有效:ch --json search Revolut、ch --text info 09215862
- 成功响应结构:{ ok, schemaVersion, command, requestedAt, data }
- 错误响应结构:{ ok, schemaVersion, command, requestedAt, error }
- 命令元数据现在位于 data.input 和 data.pagination 下
- 禁用颜色:ch --no-color search Revolut
代理说明
- - JSON 模式将已处理的错误写入标准输出,而非标准错误
- 错误负载包含 code、message 和 retryable
- 退出码明确:
- 0 成功
- 2 输入错误或未找到
- 3 认证、上游或速率限制失败
- 4 内部错误
- - 更新任何期望顶层 input 或 pagination 的现有解析器;这些现在位于 data 下
备注
- - 需要 API 密钥(免费,在英国公司注册处开发者门户即时注册)
- 认证方式为 HTTP Basic(密钥作为用户名,密码为空)
- 速率限制:每 5 分钟 600 次请求
- 公司编号自动补零至 8 位
- search-person 会对每个匹配结果发起预约请求扩展——对于宽泛的名称使用 --match-limit 控制 API 使用量
- 备案文件中的 --include-links 可生成文档内容 URL,用于直接下载 PDF