Skip to content
Projets

À propos

Agent-ready CLI for the USPTO Open Data Portal API

Outils de développement

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
-1
in 15 days
-1
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

uspto

Agent-ready CLI for USPTO patent and trademark data. Search patents through the Open Data Portal, discover marks through the official Trademark Search companion service, and retrieve official trademark status, file wrappers, images, and other artifacts from TSDR — all from one terminal.

Single static binary, zero runtime dependencies, structured output, safe bulk workflows, and raw escape hatches for agents.

Install

# With Go
go install github.com/smcronin/uspto-cli/cmd/uspto@latest

# Or download a binary from GitHub Releases
# https://github.com/smcronin/uspto-cli/releases

Trademark Quick Start

Trademark discovery is anonymous; official record retrieval needs a separate TSDR key. An Open Data Portal patent key does not work at TSDR.

# Search candidate marks without any API key
uspto trademark search --wordmark "OPENAI" --status live --limit 10

# Configure the separate TSDR key from https://account.uspto.gov/api-manager/
uspto config set-tsdr-api-key "YOUR_TSDR_KEY"

# Hydrate a candidate serial number from the official TSDR record
uspto trademark case status sn:97054561
uspto trademark case get sn:97054561 -f json

# Inspect its file wrapper and build a reusable local bundle
uspto trademark docs list sn:97054561
uspto trademark case bundle sn:97054561 --output ./openai-mark

# Expungement/reexamination proceedings, petitions to the Director and
# administrative sanctions come from the Open Data Portal (ODP key)
uspto trademark decisions search --category administrative --limit 5
uspto trademark decisions download <documentIdentifier>

trademark search uses the public backend currently used by the official Trademark Search UI. USPTO does not publish that backend as a stable developer API, so treat search hits as candidates and hydrate selected identifiers through TSDR. See the trademark API reference for the verified service boundaries, endpoint inventory, and schemas.

API Keys and Service Boundaries

USPTO patent and trademark APIs do not share one credential:

Task Host/service Authentication CLI configuration
Patent search, file wrappers, PTAB, petitions, and bulk-product discovery Open Data Portal at api.uspto.gov ODP key in X-API-KEY USPTO_API_KEY / uspto config set-api-key
Trademark discovery by wording, owner, goods/services, or class Trademark Search companion at tmsearch.uspto.gov None currently required None
Trademark decisions and proceedings (expungement, reexamination, petitions to the Director, administrative orders) Open Data Portal at api.uspto.gov ODP key in X-API-KEY USPTO_API_KEY / uspto config set-api-key
Official trademark status, documents, images, and case artifacts TSDR at tsdrapi.uspto.gov Separate TSDR key in USPTO-API-KEY USPTO_TSDR_API_KEY / uspto config set-tsdr-api-key

Get the ODP key from the MyODP dashboard. Get the separate TSDR key from the USPTO API Manager. Never send one service's key to the other service.

# Recommended: persist both credentials in the user-level config
uspto config set-api-key "YOUR_ODP_KEY"
uspto config set-tsdr-api-key "YOUR_TSDR_KEY"
uspto config show

# Environment-variable alternative
export USPTO_API_KEY="YOUR_ODP_KEY"
export USPTO_TSDR_API_KEY="YOUR_TSDR_KEY"

The legacy TSDR_API_KEY environment name is accepted for compatibility; new setups should use USPTO_TSDR_API_KEY. See the API-key setup guide for account steps, dotenv import, precedence, and key-handling guidance.

Patent Quick Start

# Set your API key once (global)
uspto config set-api-key your-key-here

# Update the CLI binary in place
uspto update

# Search patents
uspto search --title "machine learning" --limit 5

# Get application details
uspto app get 16123456

# One-shot summary (7 API calls combined)
uspto summary 16123456

# Extract claims from a granted patent
uspto app claims 16123456

# One-liner full artifact bundle by publication/patent/app ID
uspto patent bundle US20050021049A1

# JSON output for agents/piping
uspto search --assignee "Google" --granted -f json

Commands

Config

API keys are written at runtime to your user config file and are never baked into the binary during build/package. The two setters preserve the other service's credential.

# Save both keys to global config (works from any directory)
uspto config set-api-key "YOUR_ODP_KEY"
uspto config set-tsdr-api-key "YOUR_TSDR_KEY"

# Import keys from a dotenv file without putting them in shell history
uspto config set-api-key --from-dotenv .env
uspto config set-tsdr-api-key --from-dotenv .env

# Show the config location and both key statuses (masked)
uspto config show

Update

# Install latest release for your OS/arch
uspto update

# Check latest version without installing
uspto update --check

# Install a specific version
uspto update --version v0.1.2

Trademark Search and TSDR

Use uspto trademark (aliases: tm, marks) for the complete trademark surface.

Goal Command
Discover candidate marks trademark search
Search expungement/reexamination proceedings, petitions to the Director and administrative orders; download their PDFs (ODP key) trademark decisions search, get, download
Compact or complete official case data trademark case status, case get
Goods/services, parties, prosecution events, designs, assignments, publications trademark case goods, parties, events, designs, assignments, publications
Registration maintenance data trademark case maintenance
Export status JSON/XML/HTML/PDF/ZIP trademark case export
Create an agent-ready local case directory trademark case bundle
Retrieve many cases in server-safe chunks trademark batch
List/filter/download file-wrapper documents trademark docs list, info, page, fetch, download, download-all, bundle, selected
Download the mark drawing trademark image
Check update metadata or inspect an opaque case-map token trademark last-update, experimental trademark casemap
Inspect sound/motion-mark media trademark multimedia
Retrieve the live contract or any safe GET/POST retrieval route trademark api-spec, trademark request

Decisions and proceedings (Open Data Portal)

trademark decisions (aliases: decision, proceedings) covers the Trademark Decisions and Proceedings dataset the Open Data Portal added in release 5.1 (2026-11-13): expungement and reexamination proceedings, petitions to the Director, and administrative orders and sanctions. It uses the ODP key (USPTO_API_KEY), not the TSDR key.

# Newest petitions to the Director this month
uspto trademark decisions search --category petitions --from 2026-11-01

# Everything on file for one registration, oldest first
uspto trademark decisions search --serial 87712766 --sort decisionActionDate:asc -f json -q

# Full-text search of the documents, restricted to administrative orders
uspto trademark decisions search --text "unauthorized practice" --category administrative -f json -q

# Precedential decisions; proceedings the Director started; expungements against one country's registrants
uspto trademark decisions search --precedential
uspto trademark decisions search --director-initiated --proceeding-type reexamination --limit 10
uspto trademark decisions search --proceeding-type expungement --country CHINA --facets documentTypeDescriptionText --limit 1 -f json -q

# One record, then its PDF
uspto trademark decisions get <documentIdentifier> -f json -q
uspto trademark decisions download <documentIdentifier> -o show-cause-order.pdf

# Export every match (pages of 3000, stitched into one CSV or JSON document)
uspto trademark decisions search --category administrative --download csv > administrative.csv
Flag Field
--category expungement-reexam|petitions|administrative decisionProceedingCategory (ExpungReexam, PetitionsToDirector, Administrative)
--proceeding-type expungement|reexamination proceedingTypeCategory
--serial, --registration serialNumber, registrationNumber (sn: / rn: prefixes accepted)
--mark, --party, --petitioner, --registrant, --country markLiteralText, partyName, petitionerName, registrantName, registrantCitizenshipCountryName
--doc-type, --petition-number, --basis documentTypeDescriptionText, petitionNumber, filingBasis
--text ocrSearchText (the whole document text is searched)
--precedential, --director-initiated precedentialIndicator:true, initiatedByDirectorIndicator:true
--from, --to decisionActionDate range

A positional query uses the ODP simplified syntax and is ANDed with the flags. Things worth knowing:

  • USPTO returns only the first 500 characters of a document's text (ocrSearchText), in search and in get. Download the PDF for the rest.
  • download works for expungement, reexamination and administrative records. Petition-to-the-Director documents are generally not in the decisions file store; the command exits 4 and names the TSDR command for that serial number (uspto trademark docs list sn:<serial>).
  • One search request returns at most 100 rows and one export request 3000. --limit above 100, --all and --download page automatically and add tie-breaking sort fields, because the service orders same-day records differently between requests.
  • --sort takes field:asc|desc. Sortable: decisionActionDate, decisionProceedingCategory, documentTypeDescriptionText, fileSize, filingBasis, investigationNumber, markLiteralText, partyName, petitionNumber, petitionerName, proceedingNumber, proceedingTypeCategory, registrantCitizenshipCountryName, registrantName, registrationNumber, serialNumber.
  • A search with no match is an empty result (exit 0), not an error.
  • With --fields, USPTO returns documentURI and markImageURI only when serialNumber is one of the fields, and leaves fileDownloadURI out. documentIdentifier is always returned.

Search and candidate hydration

Friendly search flags compile to the official Trademark Search field syntax. Positional text is always literal combined-mark text—even when it contains punctuation such as colons. Use --query for expert field tags: CM mark, ON owner, AT attorney, SN serial, RN registration, GS goods/services, IC international class, CC coordinated class, DC design code, and LD live/dead.

# No API key required for these searches
uspto trademark search "OPENAI"
uspto trademark search --owner "Nike" --class 025 --status live --limit 25
uspto trademark search --query 'CM:APPLE AND GS:"computer software"' --count-only -f json -q
uspto trademark search --wordmark ACME --all --max-results 5000 -f ndjson -q

# Advanced search-body escape hatch (file or stdin)
uspto trademark search --raw-body query.json --raw-response -f json

Search is an undocumented companion contract used by the official UI, not TSDR. The CLI discovers its current versioned service URL at runtime, but callers should still tolerate schema or availability changes. When using --raw-body, put paging, _source, sorts, and aggregations in the JSON; typed shaping flags are rejected so an agent cannot mistake ignored flags for applied controls.

Identifiers and official case records

Prefix identifiers whenever the namespace matters:

Prefix Identifier Example
sn: U.S. application serial number sn:97054561
rn: U.S. registration number rn:3500030
ir: International Registration / Madrid number ir:0835690
ref: Opaque USPTO reference identifier ref:Z1231384
pn: Expungement/reexamination proceeding number pn:2022-100001E

Human punctuation is normalized (72-131351 becomes 72131351), but significant letters and leading zeroes are preserved. An unprefixed eight-digit number is treated as a serial number; use --id-type or a prefix for anything ambiguous.

uspto trademark case status sn:97054561 rn:3500030 -f json
uspto trademark case get sn:97054561 --representation parsed -f json
uspto trademark case goods sn:97054561
uspto trademark case parties sn:97054561 -f json
uspto trademark case events sn:97054561 --latest 20
uspto trademark case events sn:97054561 --code R.PR --from 2024-01-01 -f json

Batch, documents, exports, and raw access

# Batch full case transactions in chunks of at most 25
uspto trademark batch serial 97054561 78787878 --chunk-size 25 -f json
uspto trademark batch registration --ids-file registration-numbers.txt -f json -q

# Inspect metadata first, then download only what is needed
uspto trademark docs list sn:72131351 --type SPE --from 2003-01-01 --to 2003-12-31 -f json
# Fast metadata-only triage omits locators; rerun without --fast before selecting an index
uspto trademark docs list sn:72131351 --type SPE --fast
uspto trademark docs download sn:72131351 DOCUMENT_ID --asset pdf -o document.pdf
uspto trademark docs bundle sn:72131351 sn:76515878 --type SPE --asset zip -o specimens.zip
uspto trademark docs download-all sn:72131351 --asset pdf -o ./documents --continue-on-error

# Numeric indices resolve against the current filters and sort. They are scoped
# to each case, so pair serialNumber with index in a multi-case list. Modern CMS
# entries without a legacy document ID use their keyless public USPTO URL.
uspto trademark docs info sn:97238896 2 --sort date:D -f json -q
uspto trademark docs fetch sn:97238896 1 --sort date:D -o native-document.xml
uspto trademark docs selected sn:72131351 --docs 1,3 --asset pdf -o selected.pdf

# Export one official status artifact or a reproducible local case bundle
uspto trademark case export sn:97054561 --asset xml -o status.xml
uspto trademark case export sn:97054561 --asset pdf -o status.pdf
uspto trademark case bundle sn:97054561 -o ./case-97054561
uspto trademark case bundle sn:97054561 -o ./case-97054561-full --include-heavy

# Safe, same-origin GET/POST retrieval escape hatch for routes not wrapped above
uspto trademark api-spec -o tsdr-swagger.json
uspto trademark request /ts/cd/maintenance/rn3500038/info.json -f json
uspto trademark request /ts/cd/casedocs/sn72131351/mega-bundle --method POST --param case=false --param docs=4 --param assignments= --param prosecutionHistory= -o selected.pdf --expected pdf --dry-run
uspto trademark request /ts/cd/pdfs --param f=/safe/server/value --output file.pdf --download --expected pdf

trademark request accepts only relative paths on the configured TSDR origin and strips credentials on cross-host redirects. Parameter order is preserved, and same-namespace identifier commas remain literal for the live bundle service. Binary/download-mode calls require --output before any request. The live Swagger advertises six retrieval POST variants, though live selected-bundle POSTs returned gateway 403 during verification; prefer their GET aliases and use POST for contract testing/future compatibility. Use --download for PDF/ZIP routes so the stricter artifact limiter is applied. The full verified reference is in docs/tsdr-api.

Patent Search

# Field search with shorthand flags
uspto search --title "neural network" --inventor "Smith" --limit 10
uspto search --cpc H04L --status "Patented Case" --filed-within 2y
uspto search --cpc-group H01M --granted-after 2024-01-01 --limit 10
uspto search --assignee "Apple" --granted --sort filingDate:desc
uspto search --publication-number US20190095759A1 --limit 1

# Granted patents only, or applications still pending
uspto search --assignee "Apple" --granted --count-only -f json -q
uspto search --assignee "Apple" --pending --count-only -f json -q

# Assignor / reel-frame (assignment records)
uspto search --assignor "Samsung" --limit 20
uspto search --reel-frame "012345/0001"

# Auto-paginate all results (up to 10,000; a longer result set is cut there, with a warning on stderr)
uspto search --examiner "RILEY" --all -f ndjson
uspto search --assignee "Tesla" --granted --all -f csv > tesla_all.csv

# Count matches only (lightweight sizing call for agents)
uspto search --assignee "Tesla" --granted-after 2023-01-01 --count-only -f json -q

# Export every matching result server-side as raw JSON or CSV.
# Without --limit the CLI counts first, then exports all rows (at most 10,000).
uspto search --title "bicycle saddle" --download csv > saddles.csv
uspto search --assignee "Tesla" --download json > tesla.json
# An explicit --limit exports exactly that many rows and skips the count
uspto search --title "battery" --download csv --limit 500 > batteries_500.csv
# With filters/ranges, --download automatically uses POST body syntax
uspto search --granted --filed-after 2024-01-01 --filter "applicationTypeLabelName=Utility" --download csv > granted_utility.csv

# Structured filters via POST
uspto search --filter "applicationTypeLabelName=Utility" --facets applicationTypeCategory

search auto-selects endpoint mode:

  • Uses POST /search when --filter, --facets, date ranges, or --granted/--pending are present.
  • Uses GET /search for simple query-only cases.
  • For --download, it uses POST /search/download when those advanced parameters are present; otherwise GET /search/download.

--download json|csv (on search and on ptab search, decisions, docs, appeals, interferences):

  • The download endpoints page like the search endpoints and return 25 rows unless told otherwise. So when --limit is not given, the CLI sends one count request, then exports min(total, 10000) rows and prints Exporting N of TOTAL results. on stderr. If the total is above 10,000 it prints a warning instead, even under -q; split the query (for example by date range) to get the rest. When the count is 0 (or --offset is past the end) no export is requested: stdout gets [] for json and nothing for csv, and stderr says Exporting 0 of 0 results.
  • An explicit --limit is sent as given, with no count request. --offset moves the start of the export.
  • --all together with --download means the same full export (and overrides --limit).
  • The value must be json or csv; anything else is a usage error (exit 2).
  • The export is raw server output on stdout, not the CLI envelope. It runs under --timeout (30 s by default); raise it for exports of several thousand rows.
  • --dry-run sends nothing: it prints the count request, then the download request with a placeholder where the counted limit would go.
  • --all -f csv performs client-side page concatenation for CSV export UX (useful when you need paged search semantics instead of --download csv).

--all and the 10,000-result ceiling: USPTO search pages through at most 10,000 results per query. When a query matches more, --all returns the first 10,000 and always prints Warning: returned 10000 of N results; ... on stderr, in every output format and under -q. With -f json the envelope also has "truncated": true inside pagination and the same text in warnings. The exit code stays 0. Split the query (for example by filing-date range) and combine the parts to get everything. If a page comes back empty before the reported total is reached and below 10,000, the warning says so instead (returned N of M results; the API sent an empty page at offset X ...) and truncated is not set, because the ceiling was not the cause.

--granted and --pending:

  • --granted keeps records whose publication categories include Granted/Issued.
  • --pending keeps applications that are still alive: it excludes every record with a Granted/Issued publication category, every status that starts with Abandon or Expressly (the abandonment statuses), and Provisional Application Expired. It does not require a pre-grant publication. PCT international-phase records (for example PCT - International Search Report Mailed to IB) are neither granted nor abandoned and remain in the results; add --filter or --status terms to narrow further.
  • The two flags cannot be combined. A search with neither returns everything, including abandoned applications.

All search flags: --title, --inventor, --assignee, --examiner, --applicant, --assignor, --cpc, --cpc-group, --patent, --pub-number, --publication-number, --docket, --art-unit, --reel-frame, --status, --type, --granted, --pending, --filed-after, --filed-before, --filed-within, --granted-after, --granted-before, --sort, --limit, --offset, --page, --all, --count-only, --filter, --facets, --fields, --download

Patent Bundle

One-command export for the full patent artifact set (not metadata-only). Works with application numbers, publication numbers, or patent numbers.

# Auto-resolve ID and export everything into ./uspto/<id>/
uspto patent bundle US20050021049A1

# Explicit output folder
uspto patent bundle US20050021049A1 --out ./uspto/single/US20050021049A1

# Force identifier type if needed
uspto patent bundle 10924035 --id-type app
uspto patent bundle US20050021049A1 --id-type publication
uspto patent bundle 7284931 --id-type patent

Bundle contents:

  • 00_resolution.json - identifier resolution + core metadata
  • 01_associated-docs.json - grant/pgpub XML metadata
  • 02_fulltext.json - parsed grant XML full text (if available)
  • 03_docs.json - file-wrapper document index
  • 04_download-all.json - PDF download results
  • xml/grant.xml and xml/pgpub.xml (when available)
  • pdf/ directory with downloaded file-wrapper PDFs
  • README.md describing what was downloaded and any gaps

Application Data

19 subcommands for working with individual patent applications:

# Core data
uspto app get <appNumber>              # Full application data
uspto app meta <appNumber>             # Metadata only
uspto app docs <appNumber>             # File wrapper documents
uspto app docs <appNumber> --sort date:asc
uspto app text <appNumber> [documentIdentifier|index]     # Extract one document's text from XML/DOCX
uspto app text-all <appNumber> --codes office-action      # Extract all matching readable document texts
uspto app transactions <appNumber>     # Prosecution history
uspto app continuity <appNumber>       # Parent/child continuity
uspto app assignments <appNumber>      # Assignment/ownership records
uspto app attorney <appNumber>         # Attorney/agent info
uspto app adjustment <appNumber>       # Patent term adjustment
uspto app foreign-priority <appNumber> # Foreign priority claims
uspto app associated-docs <appNumber>  # Associated XML document metadata

# Document downloads
uspto app download <appNumber> [documentIdentifier|index] # Download a specific document file
uspto app download-all <appNumber>     # Download all document files for one format

# Patent XML extraction (grant + pgpub fallback)
uspto app abstract <appNumber>         # Patent abstract
uspto app claims <appNumber>           # Structured claims text
uspto app citations <appNumber>        # Prior art citations
uspto app description <appNumber>      # Full specification text
uspto app fulltext <appNumber>         # Everything: meta + abstract + claims + citations + description

The XML commands (abstract, claims, citations, description, fulltext) parse official patent XML to extract structured data. They prefer grant XML and fall back to the pre-grant publication (pgpub) XML when the application has no grant XML, which is the normal case for a pending application. fulltext is the most comprehensive single-command view.

Every result says which one it used in source:

source Meaning Identifying fields
grant Parsed from the grant: claims and text as granted patentNumber (and grantDate in fulltext); publicationNumber/publicationDate name the earlier publication when the grant lists one
pgpub Parsed from the pre-grant publication: claims and text as published, not as granted publicationNumber, publicationDate; patentNumber is empty and grantDate is absent

citations (and the citation fields of fulltext) need the grant: a publication does not list what was cited. With source: "pgpub" they return an empty list, ok: true, and a warnings entry saying that citations are only available from the grant and none exists. Do not read that as "nothing was cited". In table mode the title shows (Pub. …) instead of (Pat. …) plus a Source: line.

For older patents (especially pre-2010), citation completeness can vary depending on legacy XML structure and source data availability.

app docs now surfaces both available formats and the CLI's preferred direct-text source (xml or docx) for each file-wrapper entry. For file-wrapper office actions and similar documents, app text is the text-first command. It reads the XML archive directly when available, falls back to DOCX, and avoids the separate download-then-open workflow that agents otherwise need. Use app text-all when you want the CLI to emit every matching readable document in one pass rather than selecting them one at a time.

Selecting a document. Every file-wrapper document has a documentIdentifier: the Document ID column of the app docs table and documentIdentifier in its JSON. It is the stable handle, and app download and app text accept it with no other flags:

uspto app docs 16123456 --codes CTNF,CTFR,NOA --sort date:desc
uspto app download 16123456 LMGEU99FGREENX5 -o office-action.pdf
uspto app text 16123456 LMGEU99FGREENX5

The 1-based index (#) still works, but it is a position in one listing, not a property of the document. app docs, app download and app text take the same --codes, --from, --to and --sort flags and number documents the same way, so an index is valid only when the second command repeats the flags of the first:

uspto app docs 16123456 --codes CTNF,CTFR,NOA --sort date:desc       # row 2 is ...
uspto app download 16123456 2 --codes CTNF,CTFR,NOA --sort date:desc # ... this document
uspto app download 16123456 2                                        # NOT the same document

Document code filters (app docs --codes, app dl --codes, app text --codes, app dl-all --codes) support aliases:

  • rejection -> CTNF,CTFR
  • allowance -> NOA
  • claims -> CLM
  • specification / spec -> SPEC
  • abstract -> ABST
  • drawings -> DRWR
  • ids -> IDS

Assignment note:

  • app assign can legitimately return [] for direct-company filings where no post-filing assignment recordation exists in the assignment dataset.

Compound Commands

# One-shot summary: metadata + term adjustment + continuity + assignments + transactions + foreign priority + documents
# Makes 7 API calls and returns a unified view
uspto summary 16123456

# Recursive family tree (follows parent/child continuity chains)
uspto family 16123456 --depth 3
uspto family 16123456 --depth 3 --with-dates

# Prosecution timeline (metadata + transactions + key docs in one view)
uspto prosecution-timeline 16123456
uspto prosecution-timeline 16123456 --codes rejection,allowance,CLM -f json -q

family JSON includes relationship-aware allApplicationNumbers entries so CON/DIV/CIP links are explicit in the flat member list.

summary reads ownership from the assignment records:

  • currentAssignee is the first-named assignee of the latest recorded conveyance that transfers title: an assignment (including nunc pro tunc, confirmatory and corrective assignments), a merger, a change of name or an entity conversion. Two records with the same recorded date are ordered by reel, then frame. Security interests, liens, mortgages, pledges, changes of a lender's agent (notice of succession of agency, successor or administrative agent), licences, government interest agreements and releases are skipped, so a security agreement recorded after the last assignment no longer names the lender as owner.
  • currentAssigneeSource is assignment when the name comes from such a record, with its text in currentAssigneeConveyance and its date in currentAssigneeRecordedDate. It is applicant when no title conveyance is recorded; currentAssignee is then the applicant from the metadata, and the conveyance fields are absent.
  • securityInterests lists each recorded encumbrance, including changes of a lender's agent (holder, conveyance, recordedDate, reelFrame), oldest first. Releases are not matched against them; read uspto app assignments for the full chain.
  • unclassifiedConveyances lists records whose conveyance text is not recognised as any of the above (assignee, conveyance, recordedDate, reelFrame). They are never used as the owner; when the list is present, read it, because one of them may change the answer.
  • Recording order is not chain order. A corrective or nunc pro tunc assignment recorded years later to fix an early link becomes the latest title record and names that early assignee, even if the patent was sold on since. The summary does not reconstruct the chain; check uspto app assignments when ownership matters.

The classification goes by the words of the conveyance text. It is a reading aid, not a title opinion.

Commands that make several requests (summary, family, app download-all, app text-all, patent bundle) report failure in two ways:

  • Nothing worked (unknown application, bad key, every download refused): the command fails with ok: false, the first error, and its typed exit code. It no longer returns an empty result with exit 0.
  • The identifying step failed: summary fails the same way when its metadata request fails, even if other requests succeeded, because without metadata there is no title, status, applicant or inventor to report. family fails when both the metadata and the continuity of the root application fail.
  • Part of it failed: exit code 0 and ok: true, and the JSON envelope adds "partial": true plus a warnings array naming each failed step. -q does not remove them. With -f table, csv or ndjson the same warnings are printed on stderr, also under -q.
uspto summary 16123456 -f json -q | jq '{partial, warnings}'

PTAB (Patent Trial and Appeal Board)

14 subcommands for trials, decisions, appeals, and interferences:

# Trial proceedings
uspto ptab search --type IPR --patent 11369456
uspto ptab search --app 15144741
uspto ptab search --family 15144741
uspto ptab get IPR2025-00816

# Trial decisions
uspto ptab decisions --trial IPR2022-00302
uspto ptab decision <documentId>
uspto ptab decisions-for <trialNumber>        # All decisions for a trial (institution + FWD when available)

# Trial documents
uspto ptab docs --trial IPR2025-01319
uspto ptab doc <documentId>
uspto ptab docs-for <trialNumber>             # All documents for a trial

# Appeals
uspto ptab appeals [query]
uspto ptab appeal <documentId>
uspto ptab appeals-for <appealNumber>         # All decisions for an appeal

# Interferences
uspto ptab interferences [query]
uspto ptab interference <documentId>
uspto ptab interferences-for <interferenceId> # All decisions for an interference

# Export search results as raw CSV/JSON: counts first, then exports all rows (at most 10,000)
uspto ptab search --type IPR --petitioner "Apple" --download csv > apple_iprs.csv
uspto ptab decisions --trial IPR2022-00302 --download json > decisions.json
uspto ptab search --type IPR --download csv --limit 200 > first_200_iprs.csv

Petition Decisions

uspto petition search "revival"
uspto petition search --office "OFFICE OF PETITIONS" --decision GRANTED
uspto petition search --app 15223202
uspto petition search --facets decidedPetitionTypeCodeDescriptionText -f json -q
uspto petition get <recordId> --include-documents

--decision filters the outcome field decidedPetitionTypeCodeDescriptionText: GRANTED (most records), DISMISSED, DENIED or GRANTED-IN-PART.

Bulk Data

# Discover products (weekly patent grants, file wrappers, etc.)
uspto bulk search "patent grant"
uspto bulk search --category "Patent Grant" --frequency WEEKLY   # --title/--category/--frequency filter the catalog locally
uspto bulk get PTGRXML --include-files
uspto bulk get PTGRXML --include-files --latest --type Data

# List and download files
uspto bulk files PTFWPRE --limit 10
uspto bulk download PTGRXML ipg240102.zip -o ./data/
uspto bulk download PTGRXML ipg240102.zip -o ./data/ --download-timeout 2h   # large file or slow link

Status Codes

uspto status 150              # Look up code 150 -> "Patented Case"
uspto status "abandoned"      # Search by description

Output Formats

Data-returning commands support four output formats via -f:

Format Flag Description
Table -f table Human-readable columns (default)
JSON -f json Structured envelope with pagination
NDJSON -f ndjson One JSON object per line (streaming)
CSV -f csv Flat columns with dot-notation keys
# JSON envelope structure
# {"ok": true, "command": "search", "pagination": {...}, "results": [...], "version": "0.3.0"}

# Minified JSON for piping
uspto search --title sensor -f json --minify -q
uspto trademark search --owner "OpenAI" -f json --minify -q
uspto trademark case get sn:97054561 -f json --minify -q

Binary trademark commands preflight and write atomically to --output, validate the expected payload signature, emit a streaming SHA-256, and refuse to replace existing files unless --overwrite is present. trademark case bundle includes those hashes in its manifest and preserves the lossless source XML alongside parsed JSON.

Examples & Use Cases

See EXAMPLES.md for detailed walkthroughs: competitive monitoring, prior art search, patent family trees, file wrapper downloads, PTAB tracking, bulk data exports, AI agent workflows, and more.

Agent Skill

This repo ships its core agent skill as a first-class project asset (not under a hidden config directory):

If your agent runtime loads skills from a user directory (for example ~/.claude/skills/), keep a copy there as runtime config, but treat skills/ in this repo as the canonical source.

Agent-Friendly Design

Built for AI agents and automation:

  • Structured JSON envelope with ok, command, commandPath, provider, pagination, results, facets, warnings, partial, version (warnings and partial appear only when there is something to report)
  • Typed exit codes: 0=OK, 1=general, 2=usage, 3=auth, 4=not-found, 5=rate-limited, 6=server-error. Exit 2 (error.type INVALID_ARGUMENTS) covers every input the caller has to fix: unknown commands, subcommands and flags, flag values that do not parse, failed validation (dates, application numbers, --limit 0, conflicting flags) and unknown -f formats
  • --dry-run shows the API request without executing (all commands)
  • --minify for compact JSON, --quiet suppresses progress output
  • --all auto-paginates up to 10,000 results and never truncates silently: a warning on stderr (also under -q) plus pagination.truncated in JSON
  • --count-only returns just total matches for fast landscape sizing
  • --download server-side export (json or csv) of every matching row, up to 10,000: one count request, then one export; --limit exports fewer
  • --facets returns aggregated counts alongside results
  • Compound commands (summary, family) reduce multi-call workflows to one command, and mark an incomplete result with partial: true and warnings
  • NDJSON format for streaming large result sets
  • Grant XML extraction (claims, citations, abstract, description, fulltext) for structured patent text
  • Typed trademark identifiers prevent silent serial/registration/Madrid namespace mistakes
  • Candidate-to-record workflow separates anonymous trademark discovery from authoritative TSDR hydration
  • Schema-tolerant trademark parsing exposes useful case views and a generic ST.96 element tree under raw; retain an XML export when namespace/lexical fidelity matters
  • Resumable trademark batching chunks requests at 25 cases and reports missed/oversized elements
  • Safe artifact handling validates PDF/ZIP/PNG/XML/JSON/HTML before atomic writes
  • Same-origin raw access rejects absolute URLs so a TSDR credential cannot be sent to another host

A strong agent workflow is: run a narrow trademark search; retain source/provenance and candidate IDs; deduplicate; run case status or batch; then request full case JSON, document metadata, and only the binary artifacts needed for selected records. Use --dry-run to inspect planned routes and -f json --minify -q for machine-readable calls.

Timeouts

Two global flags, for two kinds of request:

Flag Applies to Default
--timeout <seconds> Metadata and search requests on every service, including --download exports of search results 30
--download-timeout <seconds or duration> One file download, start to finish: file-wrapper documents, grant/pgpub XML, bulk data files, and trademark PDFs, ZIPs and images 10 minutes for patent (ODP) files and for trademark (TSDR) files

--download-timeout takes seconds (1800) or a duration (30m, 2h); 0 removes the limit. The limit covers the whole transfer, so a multi-gigabyte bulk file on a slow link needs more than the default:

uspto bulk download PTGRXML ipg240102.zip -o ./data/ --download-timeout 2h
uspto app download-all 16123456 -o ./wrapper/ --download-timeout 0

A download that runs out of time fails without leaving a partial file, and the error names the flag. --timeout no longer limits trademark downloads (it used to cut them off at 30 seconds).

Rate Limiting

The built-in limiters keep requests sequential per key. The TSDR limiter coordinates across processes; the patent ODP limiter sequences requests within one process only, so avoid running several patent commands in parallel. Limits differ by service.

For TSDR, USPTO publishes these per-key tiers:

Request class Peak, 5 a.m.–10 p.m. Eastern Off-peak, 10 p.m.–5 a.m. Eastern
All requests 60/minute 120/minute
PDF/ZIP downloads 4/minute 12/minute
Multi-case PDF/ZIP downloads 4/minute 12/minute

The CLI conservatively leaves at least 1 second between TSDR metadata calls and 15 seconds between PDF/ZIP calls, honors Retry-After as a minimum, and uses a shared file-based limiter so parallel agents do not independently spend the same quota. It auto-retries waits of at most 30 seconds; longer provider windows return a typed rate-limit error with error.retryAfterSeconds so the caller can resume later without an early retry. Prefer metadata-first filtering and avoid unnecessary --include-heavy bundles.

Patent ODP quotas remain service-specific: metadata APIs permit 5M calls/week and document APIs 1.2M calls/week. ODP requests are retried up to three times: a 429 waits 5 seconds (or Retry-After if longer), a 5xx waits 1/2/3 seconds, and a dropped connection is retried after a short pause; a 429 that asks for more than 30 seconds is returned with error.retryAfterSeconds instead. See the ODP rate-limit reference and TSDR operations reference.

Disclaimer

This project is not affiliated with, endorsed by, or sponsored by the United States Patent and Trademark Office (USPTO). Patent data comes from the USPTO Open Data Portal; trademark discovery and record data come from USPTO Trademark Search and TSDR. Review the official TSDR FAQ and USPTO trademark API guide for the governing service documentation.

License

MIT

Explorer des projets similaires

Chargement…