Google Patents
Search and retrieve patent data via SerpApi. Requires SERPAPIAPIKEY env var (free: 100/month at serpapi.com).
5 Commands
CODEBLOCK0
Patent ID: short US11734097B1 or full patent/US11734097B1/en. Supports all countries: CN, US, EP, JP, KR, WO, DE, etc.
Search Options
CODEBLOCK1
Boolean: "(massage) AND (glove OR mitt)" | Multi-term + CPC: INLINECODE3
What Each Command Returns
search: patentid, title, snippet, assignee, inventor, dates, pdf, countrystatus
detail: title, abstract, claims[], inventors[], assignees[], classifications[], legalevents[], citations, similardocuments[], images[], pdf, familyid, worldwideapplications
fulltext: description full text (FIELD OF INVENTION, BACKGROUND, SUMMARY, DETAILED DESCRIPTION)
full: Everything from detail + description_full combined
pdf: Downloads PDF file to specified path
E-commerce Scenarios
CODEBLOCK2
Error Handling
All errors return JSON with error and code fields. No exceptions thrown.
| Code | Meaning |
|---|
| PATENTNOTFOUND | Patent ID doesn't exist (404) |
| AUTH_ERROR |
Invalid/expired API key (401/403) |
| MAX
RETRIESEXCEEDED | Network failure after 3 retries |
| NO_DESCRIPTION | Patent has no description text |
| PARSE_ERROR | HTML parsing failed |
| NO_PDF | No PDF available |
| DOWNLOAD_ERROR | PDF download failed |
| MISSING_QUERY | No search query provided |
| MISSING_ID | No patent ID provided |
Auto-retry: 3 attempts with exponential backoff (2s, 4s, 8s) on 429/5xx errors.
Rate limit: 1 second between requests to avoid triggering anti-scraping.
Timeouts: 10s connect, 30s max per request, 60s for PDF downloads.
FAQ
Q: Why are some fields empty?
A: Different countries have different patent page formats. Some patents may have incomplete data, or the description may not be digitized.
Q: Can I batch-fetch patents?
A: Yes, loop through IDs. Respect the 1s rate limit. Free tier = 100 calls/month. Cached results (same query within 1h) are free.
Q: How to get PDF?
A: INLINECODE6
Q: Chinese vs English patents?
A: Chinese pages (patent/CNxxxxxx/zh) have native Chinese content. English pages have machine-translated content. Use --language CHINESE for search.
Q: Patent ID formats?
A: Country code + number + type suffix. Examples: CN106484775A, US20180232442A1, EP2264377A2, USD975937S1 (design), JP2020123456A.
Google Patents
通过SerpApi搜索和检索专利数据。需要设置SERPAPIAPIKEY环境变量(免费版:每月100次查询,访问serpapi.com)。
5个命令
bash
bash scripts/patents.sh search 关键词 [选项] # 搜索专利
bash scripts/patents.sh detail US11734097B1 # 基本信息+权利要求
bash scripts/patents.sh fulltext US11734097B1 # 说明书全文
bash scripts/patents.sh full US11734097B1 # 一次性获取全部数据
bash scripts/patents.sh pdf US11734097B1 output.pdf # 下载PDF
专利ID:短格式US11734097B1或完整格式patent/US11734097B1/en。支持所有国家:CN、US、EP、JP、KR、WO、DE等。
搜索选项
--country US,CN,JP,WO,EP,KR --status GRANT|APPLICATION
--type PATENT|DESIGN --assignee 公司名称
--inventor 发明人姓名 --sort relevance|new|old
--after publication:20230101 --before publication:20251231
--num 10-100 --page N
--language ENGLISH|CHINESE --litigation YES|NO
--scholar --clustered
布尔搜索:(massage) AND (glove OR mitt) | 多词+CPC:(pet grooming);(A01K13)
各命令返回内容
search:专利ID、标题、摘要、专利权人、发明人、日期、PDF、国家状态
detail:标题、摘要、权利要求[]、发明人[]、专利权人[]、分类号[]、法律事件[]、引用文献、相似文档[]、图片[]、PDF、同族ID、全球申请信息
fulltext:说明书全文(技术领域、背景技术、发明内容、具体实施方式)
full:detail和fulltext的全部内容合并
pdf:将PDF文件下载到指定路径
电商场景
bash
侵权风险检查(上架前必做)
bash scripts/patents.sh search 产品名称 --type DESIGN --country US --status GRANT
竞争对手专利
bash scripts/patents.sh search 产品类别 --assignee 公司名称 --num 50
阅读权利要求评估实际风险
bash scripts/patents.sh full USD975937S1
下载专利PDF供参考
bash scripts/patents.sh pdf USD975937S1 ./patent.pdf
过期专利(可免费使用)
bash scripts/patents.sh search 技术关键词 --before filing:20040101
最新趋势
bash scripts/patents.sh search 技术关键词 --sort new --after publication:20240101
诉讼高发专利
bash scripts/patents.sh search 产品名称 --litigation YES --country US
错误处理
所有错误均返回包含error和code字段的JSON。不会抛出异常。
| 错误码 | 含义 |
|---|
| PATENTNOTFOUND | 专利ID不存在(404) |
| AUTH_ERROR |
API密钥无效/过期(401/403) |
| MAX
RETRIESEXCEEDED | 3次重试后网络仍然失败 |
| NO_DESCRIPTION | 专利没有说明书文本 |
| PARSE_ERROR | HTML解析失败 |
| NO_PDF | 没有可用的PDF |
| DOWNLOAD_ERROR | PDF下载失败 |
| MISSING_QUERY | 未提供搜索查询 |
| MISSING_ID | 未提供专利ID |
自动重试:遇到429/5xx错误时,最多尝试3次,采用指数退避策略(2秒、4秒、8秒)。
速率限制:请求间隔至少1秒,避免触发反爬机制。
超时设置:连接超时10秒,单次请求最大30秒,PDF下载最大60秒。
常见问题
问:为什么有些字段为空?
答:不同国家的专利页面格式不同。部分专利可能数据不完整,或者说明书尚未数字化。
问:可以批量获取专利吗?
答:可以,通过循环遍历ID即可。请遵守1秒的速率限制。免费版每月100次调用。相同查询1小时内的缓存结果不计费。
问:如何获取PDF?
答:bash scripts/patents.sh pdf US11734097B1 output.pdf
问:中文专利与英文专利的区别?
答:中文页面(patent/CNxxxxxx/zh)包含原生中文内容。英文页面为机器翻译内容。搜索时使用--language CHINESE。
问:专利ID格式?
答:国家代码+编号+类型后缀。示例:CN106484775A、US20180232442A1、EP2264377A2、USD975937S1(外观设计)、JP2020123456A。