A Modern Python client for accessing United Stated Patent and Trademark Office (USPTO) Open Data Portal (ODP) APIs.
Project description
pyUSPTO
A Python client library for interacting with the United Stated Patent and Trademark Office (USPTO) Open Data Portal APIs.
This package provides clients for interacting with the USPTO Bulk Data API, Patent Data API, Final Petition Decisions API, and PTAB (Patent Trial and Appeal Board) APIs.
[!IMPORTANT] The USPTO is in the process of moving their API. This package is only concerned with the new API. The old API will be retired at the end of 2025.
Quick Start
Requirements: Python ≥3.10
pip install pyUSPTO
[!IMPORTANT] You must have an API key for the USPTO Open Data Portal API.
from pyUSPTO import PatentDataClient
# Initialize with your API key
client = PatentDataClient(api_key="your_api_key_here")
# Search for patent applications
results = client.search_applications(inventor_name_q="Smith", limit=10)
print(f"Found {results.count} applications")
Configuration
All clients can be configured using one of three methods:
Method 1: Direct API Key Initialization
[!NOTE] This method is convenient for quick scripts but not recommended for production use. Consider using environment variables instead.
from pyUSPTO import (
BulkDataClient,
PatentDataClient,
FinalPetitionDecisionsClient,
PTABTrialsClient,
PTABAppealsClient,
PTABInterferencesClient
)
patent_client = PatentDataClient(api_key="your_api_key_here")
bulk_client = BulkDataClient(api_key="your_api_key_here")
petition_client = FinalPetitionDecisionsClient(api_key="your_api_key_here")
trials_client = PTABTrialsClient(api_key="your_api_key_here")
appeals_client = PTABAppealsClient(api_key="your_api_key_here")
interferences_client = PTABInterferencesClient(api_key="your_api_key_here")
Method 2: Using USPTOConfig
from pyUSPTO import (
BulkDataClient,
PatentDataClient,
FinalPetitionDecisionsClient,
PTABTrialsClient,
PTABAppealsClient,
PTABInterferencesClient
)
from pyUSPTO.config import USPTOConfig
config = USPTOConfig(api_key="your_api_key_here")
patent_client = PatentDataClient(config=config)
bulk_client = BulkDataClient(config=config)
petition_client = FinalPetitionDecisionsClient(config=config)
trials_client = PTABTrialsClient(config=config)
appeals_client = PTABAppealsClient(config=config)
interferences_client = PTABInterferencesClient(config=config)
Method 3: Environment Variables (Recommended)
Set the environment variable in your shell:
export USPTO_API_KEY="your_api_key_here"
Then use it in your Python code:
from pyUSPTO import (
BulkDataClient,
PatentDataClient,
FinalPetitionDecisionsClient,
PTABTrialsClient,
PTABAppealsClient,
PTABInterferencesClient
)
from pyUSPTO.config import USPTOConfig
# Load configuration from environment
config = USPTOConfig.from_env()
patent_client = PatentDataClient(config=config)
bulk_client = BulkDataClient(config=config)
petition_client = FinalPetitionDecisionsClient(config=config)
trials_client = PTABTrialsClient(config=config)
appeals_client = PTABAppealsClient(config=config)
interferences_client = PTABInterferencesClient(config=config)
API Usage Examples
[!TIP] For comprehensive examples with detailed explanations, see the
examples/directory.
Patent Data API
from pyUSPTO import PatentDataClient
client = PatentDataClient(api_key="your_api_key_here")
# Search for applications by inventor name
response = client.search_applications(inventor_name_q="Smith", limit=2)
print(f"Found {response.count} applications with 'Smith' as inventor (showing up to 2).")
# Get a specific application
app = client.get_application_by_number("18045436")
if app.application_meta_data:
print(f"Title: {app.application_meta_data.invention_title}")
See examples/patent_data_example.py for detailed examples including downloading documents and publications.
Final Petition Decisions API
from pyUSPTO import FinalPetitionDecisionsClient
client = FinalPetitionDecisionsClient(api_key="your_api_key_here")
# Search for petition decisions
response = client.search_decisions(
decision_date_from_q="2023-01-01", decision_date_to_q="2023-12-31", limit=5
)
print(f"Found {response.count} decisions from 2023.")
# Get a specific decision by ID from search results
response = client.search_decisions(limit=1)
if response.count > 0:
decision_id = response.petition_decision_data_bag[0].petition_decision_record_identifier
decision = client.get_decision_by_id(decision_id)
print(f"Decision Type: {decision.decision_type_code}")
See examples/petition_decisions_example.py for detailed examples including downloading decision documents.
PTAB Trials API
from pyUSPTO import PTABTrialsClient
client = PTABTrialsClient(api_key="your_api_key_here")
# Search for IPR proceedings
response = client.search_proceedings(
trial_type_code_q="IPR",
petition_filing_date_from_q="2023-01-01",
petition_filing_date_to_q="2023-12-31",
limit=5,
)
print(f"Found {response.count} IPR proceedings filed in 2023")
# Paginate through results
for proceeding in client.paginate_proceedings(
trial_type_code_q="IPR",
petition_filing_date_from_q="2024-01-01",
limit=5,
):
print(f"{proceeding.trial_number}")
See examples/ptab_trials_example.py for detailed examples including searching documents and decisions.
PTAB Appeals API
from pyUSPTO import PTABAppealsClient
client = PTABAppealsClient(api_key="your_api_key_here")
# Search for appeal decisions
response = client.search_decisions(
technology_center_number_q="3600",
decision_date_from_q="2023-01-01",
decision_date_to_q="2023-12-31",
limit=5,
)
print(f"Found {response.count} appeal decisions from TC 3600 in 2023")
See examples/ptab_appeals_example.py for detailed examples including searching by decision type and application number.
PTAB Interferences API
from pyUSPTO import PTABInterferencesClient
client = PTABInterferencesClient(api_key="your_api_key_here")
# Search for interference decisions
response = client.search_decisions(
decision_date_from_q="2023-01-01",
limit=5,
)
print(f"Found {response.count} interference decisions since 2023")
See examples/ptab_interferences_example.py for detailed examples including searching by party name and outcome.
Documentation
Full documentation may be found on Read the Docs.
Data Models
The library uses Python dataclasses to represent API responses. All data models include type annotations for attributes and methods, making them fully compatible with static type checkers.
Bulk Data API
BulkDataResponse: Top-level response from the APIBulkDataProduct: Information about a specific productProductFileBag: Container for file data elementsFileData: Information about an individual file
Patent Data API
PatentDataResponse: Top-level response from the APIPatentFileWrapper: Information about a patent applicationApplicationMetaData: Metadata about a patent applicationAddress: Represents an address in the patent dataPerson,Applicant,Inventor,Attorney: Person-related data classesAssignment,Assignor,Assignee: Assignment-related data classesContinuity,ParentContinuity,ChildContinuity: Continuity-related data classesPatentTermAdjustmentData: Patent term adjustment information- And many more specialized classes for different aspects of patent data
Final Petition Decisions API
PetitionDecisionResponse: Top-level response from the APIPetitionDecision: Complete information about a petition decisionPetitionDecisionDocument: Document associated with a petition decisionDocumentDownloadOption: Download options for petition documentsDecisionTypeCode: Enum for petition decision typesDocumentDirectionCategory: Enum for document direction categories
PTAB Trials API
PTABTrialProceedingResponse: Top-level response from the APIPTABTrialProceeding: Information about a PTAB trial proceeding (IPR, PGR, CBM, DER)PTABTrialDocument: Document associated with a trial proceedingPTABTrialDecision: Decision information for a trial proceedingRegularPetitionerData,RespondentData,DerivationPetitionerData: Party data for different trial typesPTABTrialMetaData: Trial metadata and status information
PTAB Appeals API
PTABAppealResponse: Top-level response from the APIPTABAppealDecision: Ex parte appeal decision informationAppellantData: Appellant information and application detailsPTABAppealMetaData: Appeal metadata and filing informationPTABAppealDocumentData: Document and decision details
PTAB Interferences API
PTABInterferenceResponse: Top-level response from the APIPTABInterferenceDecision: Interference proceeding decision informationSeniorPartyData,JuniorPartyData,AdditionalPartyData: Party data classesPTABInterferenceMetaData: Interference metadata and status informationPTABInterferenceDocumentData: Document and outcome details
Advanced Topics
Advanced HTTP Configuration
Control timeout behavior, retry logic, and connection pooling using HTTPConfig:
from pyUSPTO import PatentDataClient, USPTOConfig, HTTPConfig
# Create HTTP configuration
http_config = HTTPConfig(
timeout=60.0, # 60 second read timeout
connect_timeout=10.0, # 10 seconds to establish connection
max_retries=5, # Retry up to 5 times on failure
backoff_factor=2.0, # Exponential backoff: 2, 4, 8, 16, 32 seconds
retry_status_codes=[429, 500, 502, 503, 504], # Retry on these status codes
pool_connections=20, # Connection pool size
pool_maxsize=20, # Max connections per pool
custom_headers={ # Additional headers for all requests
"User-Agent": "MyApp/1.0",
"X-Tracking-ID": "abc123"
}
)
# Pass HTTPConfig via USPTOConfig
config = USPTOConfig(
api_key="your_api_key",
http_config=http_config
)
client = PatentDataClient(config=config)
Configure HTTP settings via environment variables:
export USPTO_REQUEST_TIMEOUT=60.0 # Read timeout
export USPTO_CONNECT_TIMEOUT=10.0 # Connection timeout
export USPTO_MAX_RETRIES=5 # Max retry attempts
export USPTO_BACKOFF_FACTOR=2.0 # Retry backoff multiplier
export USPTO_POOL_CONNECTIONS=20 # Connection pool size
export USPTO_POOL_MAXSIZE=20 # Max connections per pool
Then create config from environment:
config = USPTOConfig.from_env() # Reads both API and HTTP config from env
client = PatentDataClient(config=config)
Share HTTP configuration across multiple clients:
# Create once, use multiple times
http_config = HTTPConfig(timeout=60.0, max_retries=5)
patent_config = USPTOConfig(api_key="key1", http_config=http_config)
petition_config = USPTOConfig(api_key="key2", http_config=http_config)
patent_client = PatentDataClient(config=patent_config)
petition_client = FinalPetitionDecisionsClient(config=petition_config)
Warning Control
The library uses Python's standard warnings module to report data parsing issues. This allows you to control how warnings are handled based on your needs.
Warning Categories
All warnings inherit from USPTODataWarning:
USPTODateParseWarning: Date/datetime string parsing failuresUSPTOBooleanParseWarning: Y/N boolean string parsing failuresUSPTOTimezoneWarning: Timezone-related issuesUSPTOEnumParseWarning: Enum value parsing failures
Controlling Warnings
import warnings
from pyUSPTO.warnings import (
USPTODataWarning,
USPTODateParseWarning,
USPTOBooleanParseWarning,
USPTOTimezoneWarning,
USPTOEnumParseWarning
)
# Suppress all pyUSPTO data warnings
warnings.filterwarnings('ignore', category=USPTODataWarning)
# Suppress only date parsing warnings
warnings.filterwarnings('ignore', category=USPTODateParseWarning)
# Turn warnings into errors (strict mode)
warnings.filterwarnings('error', category=USPTODataWarning)
# Show warnings once per location
warnings.filterwarnings('once', category=USPTODataWarning)
# Always show all warnings (default Python behavior)
warnings.filterwarnings('always', category=USPTODataWarning)
The library's permissive parsing philosophy returns None for fields that cannot be parsed, allowing you to retrieve partial data even when some fields have issues. Warnings inform you when this happens without stopping execution.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to contribute to this project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyuspto-0.3.2.tar.gz.
File metadata
- Download URL: pyuspto-0.3.2.tar.gz
- Upload date:
- Size: 8.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a89dd7810a2b52155279de38165b6a2966f5d21a33fa3c9e60707115f02f2457
|
|
| MD5 |
3e097f2937d5850575013a8ab33136ff
|
|
| BLAKE2b-256 |
628bde562785553414c8f92ddbe2861c614d3b840d820417c9c68f58d17c4ed6
|
Provenance
The following attestation bundles were made for pyuspto-0.3.2.tar.gz:
Publisher:
publish-to-test-pypi.yml on DunlapCoddingPC/pyUSPTO
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyuspto-0.3.2.tar.gz -
Subject digest:
a89dd7810a2b52155279de38165b6a2966f5d21a33fa3c9e60707115f02f2457 - Sigstore transparency entry: 786160552
- Sigstore integration time:
-
Permalink:
DunlapCoddingPC/pyUSPTO@089b26f0a6fe15f4d81d65e26db53fc918117b02 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/DunlapCoddingPC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@089b26f0a6fe15f4d81d65e26db53fc918117b02 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyuspto-0.3.2-py3-none-any.whl.
File metadata
- Download URL: pyuspto-0.3.2-py3-none-any.whl
- Upload date:
- Size: 85.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fe6cc8034102da939c319b011e85a5e31e49622ead22778e3f661163c6bf4d6
|
|
| MD5 |
684084fa99ecc635aabfb77a93874a6a
|
|
| BLAKE2b-256 |
234d22533828d933fbe088e26a4720fd012885eb79182590df9fae529bb0f195
|
Provenance
The following attestation bundles were made for pyuspto-0.3.2-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on DunlapCoddingPC/pyUSPTO
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyuspto-0.3.2-py3-none-any.whl -
Subject digest:
1fe6cc8034102da939c319b011e85a5e31e49622ead22778e3f661163c6bf4d6 - Sigstore transparency entry: 786160566
- Sigstore integration time:
-
Permalink:
DunlapCoddingPC/pyUSPTO@089b26f0a6fe15f4d81d65e26db53fc918117b02 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/DunlapCoddingPC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@089b26f0a6fe15f4d81d65e26db53fc918117b02 -
Trigger Event:
push
-
Statement type: