Skip to content

About

Examples for moving PatentsView API code to PatentRef: change the host and the key. Python, R, notebook, MCP config.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

PatentsView replacement: one-line switch to PatentRef

Your old PatentsView code works again. Change the host and the key.

https://search.patentsview.org
https://patentref.io

Plus claim trees for US grants since 1976, and an MCP package for agents.

To move a script or client from the PatentsView API to PatentRef, change the base URL from https://search.patentsview.org to https://patentref.io and add a PatentRef key in the X-Api-Key header. A PatentsView key does not work here. A Free key is at https://patentref.io/api/v1/meta/signup/ (email sign-up, 1,000 requests a month, 45 a minute, no card). Paths, the q, f, s and o parameters, the response shape and the error forms stay the same. Details: https://patentref.io/docs/migration.html

What is in this repo

  • python/one_line_switch.py: the docs quick-start patent lookup, then a claim-tree request
  • r/one_line_switch.R: the same two requests in R, using the httr package
  • r/patentsview_dev_switch.R: the docs quick-start lookup with the rOpenSci patentsview R package development version (base-URL support merged 2026-11-24)
  • notebooks/one_line_switch.ipynb: the same lookup in a notebook
  • mcp/: install and config for the patentref-mcp package (runs on your machine; there is no hosted MCP endpoint)
  • images/: claim-tree pictures for three recent grants, with record-page links in ATTRIBUTION.md

Run the one-line switch (Python)

Set a key, then:

export PATENTREF_API_KEY=your_key
python python/one_line_switch.py

The request is the official docs example:

curl -s -G -H "X-Api-Key: $PATENTREF_API_KEY" https://patentref.io/api/v1/patent/ \
  --data-urlencode 'q={"patent_id": "10905426"}' \
  --data-urlencode 'f=["patent_id", "patent_title", "patent_date"]'

The same request against the old PatentsView host was https://search.patentsview.org/api/v1/patent/ with a PatentsView key. The PatentsView API has been paused since 2026-03-20. Only the scheme and host change; the path stays /api/v1/patent/.

Claim tree

curl -s -H "X-Api-Key: $PATENTREF_API_KEY" \
  https://patentref.io/api/v1/structure/claims/10905426/

Record page for that patent: https://patentref.io/p/10905426/

R: patentsview development version

rOpenSci merged a base-URL setting into ropensci/patentsview on 2026-11-24 (pull request #47). That development version reads PATENTSVIEW_BASE_URL (scheme and host only) and PATENTSVIEW_API_KEY. Set the key to a PatentRef key.

remotes::install_github("ropensci/patentsview")
export PATENTSVIEW_BASE_URL=https://patentref.io
export PATENTSVIEW_API_KEY=your_patentref_key
Rscript r/patentsview_dev_switch.R

The script will also accept PATENTREF_API_KEY if PATENTSVIEW_API_KEY is unset. It does not print the key.

CRAN patentsview 1.0.0 does not take a base URL setting. For that release, https://patentref.io/docs/migration.html (checked 2026-11-25) still shows replacing get_base() for the session with assignInNamespace. Use the development version, or the httr script in r/one_line_switch.R, instead of that CRAN release if you want the environment-variable switch.

Claim trees are a PatentRef path (/api/v1/structure/claims/<id>/), not a PatentsView PatentSearch endpoint, so they are in r/one_line_switch.R.

MCP setup

pip install patentref-mcp
export PATENTREF_API_KEY=your_key
patentref-mcp

Package on PyPI: https://pypi.org/project/patentref-mcp/ (0.5.0 as of 2026-11-25) Source (public, MIT): https://github.com/patentref/patentref-mcp Docs for agents: https://patentref.io/agents/ A Claude Desktop example config is in mcp/claude_desktop_config.example.json.

Live facts used in this repo (checked Wed 2026-11-25, America/Phoenix)

Refresh counts from https://patentref.io/api/v1/meta/ before a public release if a newer build is in service.

License and attribution

Example code is MIT (see LICENSE). Patent data from PatentsView and the USPTO, used under CC BY 4.0. PatentRef is an independent service and is not affiliated with the USPTO. See ATTRIBUTION.md.

About

Examples for moving PatentsView API code to PatentRef: change the host and the key. Python, R, notebook, MCP config.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages