Skip to content

API Reference - Client

USPTOClient

The main client class for interacting with the USPTO Open Data Portal API.

uspto_odp.controller.uspto_odp_client.USPTOClient

Async client for USPTO Patent Application API

Source code in src/uspto_odp/controller/uspto_odp_client.py
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
class USPTOClient:
    """Async client for USPTO Patent Application API"""

    BASE_API_URL = "https://api.uspto.gov/api"

    def __init__(self, api_key: str, session: Optional[aiohttp.ClientSession] = None):
        self.API_KEY = api_key
        self.headers = {
            "accept": "application/json",
            "X-API-KEY": self.API_KEY
        }
        self.session = session or aiohttp.ClientSession()

    @property
    def _patent_applications_endpoint(self) -> str:
        """
        Patent Applications service endpoint.
        Base path: /v1/patent/applications
        """
        return f"{self.BASE_API_URL}/v1/patent/applications"

    @property
    def _bulk_data_endpoint(self) -> str:
        """
        Bulk Data service endpoint (for future implementation).
        Base path: /v1/bulkdata
        """
        return f"{self.BASE_API_URL}/v1/bulkdata"

    @property
    def _bulk_datasets_endpoint(self) -> str:
        """
        Bulk Datasets service endpoint.
        Base path: /v1/datasets/products
        """
        return f"{self.BASE_API_URL}/v1/datasets/products"

    @property
    def _petition_decisions_endpoint(self) -> str:
        """
        Petition Decisions service endpoint.
        Base path: /v1/petition/decisions
        """
        return f"{self.BASE_API_URL}/v1/petition/decisions"

    @property
    def _ptab_trials_endpoint(self) -> str:
        """
        PTAB Trials service endpoint (for future implementation).
        Base path: /v1/ptab/trials
        """
        return f"{self.BASE_API_URL}/v1/ptab/trials"

    @property
    def _ptab_trials_proceedings_endpoint(self) -> str:
        """
        PTAB Trials Proceedings service endpoint.
        Base path: /v1/patent/trials/proceedings
        """
        return f"{self.BASE_API_URL}/v1/patent/trials/proceedings"

    @property
    def _ptab_trials_decisions_endpoint(self) -> str:
        """
        PTAB Trials Decisions service endpoint.
        Base path: /v1/patent/trials/decisions
        """
        return f"{self.BASE_API_URL}/v1/patent/trials/decisions"

    @property
    def _ptab_trials_documents_endpoint(self) -> str:
        """
        PTAB Trials Documents service endpoint.
        Base path: /v1/patent/trials/documents
        """
        return f"{self.BASE_API_URL}/v1/patent/trials/documents"

    @property
    def _ptab_appeals_decisions_endpoint(self) -> str:
        """
        PTAB Appeals Decisions service endpoint.
        Base path: /v1/patent/appeals/decisions
        """
        return f"{self.BASE_API_URL}/v1/patent/appeals/decisions"

    @property
    def _ptab_interferences_decisions_endpoint(self) -> str:
        """
        PTAB Interferences Decisions service endpoint.
        Base path: /v1/patent/interferences/decisions
        """
        return f"{self.BASE_API_URL}/v1/patent/interferences/decisions"

    @property
    def _status_codes_endpoint(self) -> str:
        """
        Status Codes service endpoint.
        Base path: /v1/patent/status-codes
        """
        return f"{self.BASE_API_URL}/v1/patent/status-codes"

    def _build_url(self, service_endpoint: str, *path_segments: str) -> str:
        """
        Build a full URL from a service endpoint and additional path segments.

        Args:
            service_endpoint: The base service endpoint (e.g., from _patent_applications_endpoint)
            *path_segments: Additional path segments to append

        Returns:
            str: Complete URL

        Example:
            url = self._build_url(self._patent_applications_endpoint, "12345678", "documents")
            # Returns: https://api.uspto.gov/api/v1/patent/applications/12345678/documents
        """
        path = "/".join(str(segment) for segment in path_segments if segment)
        if path:
            return f"{service_endpoint}/{path}"
        return service_endpoint

    async def _handle_response(self, response, parse_func):
        try:
            data = await response.json()
        except Exception:
            data = {}

        if response.status == 200:
            return parse_func(data)

        error = USPTOError.from_dict(data, response.status)
        self._log_error(error)
        raise error

    def _log_error(self, error: USPTOError):
        logger.error(
            f"USPTO API Error: {error.code}\n"
            f"Error Message: {error.error}\n"
            f"Details: {error.error_details or 'No details provided'}\n"
            f"Request ID: {error.request_identifier or 'No request ID provided'}"
        )

    async def get_patent_wrapper(self, serial_number: str) -> PatentFileWrapper:
        """
        Retrieve the patent application wrapper information.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456' or 'PCTUS2004027676')
                               If a non-PCT number starts with 'US', it will be stripped (e.g., 'US0506853' -> '0506853')

        Returns:
            PatentFileWrapper: Object containing patent wrapper information

        Raises:
            USPTOError: If the API request fails
        """
        # Strip 'US' prefix from non-PCT application numbers
        if serial_number.startswith('US'):
            serial_number = serial_number[2:]

        # Check if this is a PCT application number
        if serial_number.startswith('PCT'):
            # Pattern to match PCT numbers and extract country code, year and remaining digits
            # Group 1: Country code (US|IB|AU)
            # Group 2: Year (2 digits, optionally prefixed with 20)
            # Group 3: Remaining digits
            pct_pattern = r'PCT(US|IB|AU)?(?:20)?(\d{2})(\d+)'
            match = re.match(pct_pattern, serial_number)

            if match:
                country, year, number = match.groups()
                # Use US as default if no country code
                country = country or 'US'
                # First try with original number
                standardized = f"PCT{country}{year}{number}"

                try:
                    url = self._build_url(self._patent_applications_endpoint, standardized)
                    async with self.session.get(url, headers=self.headers) as response:
                        if response.status == 404 and number.startswith('0'):
                            # If 404 and has leading zero, try without it
                            number_no_zero = str(int(number))
                            standardized = f"PCT{country}{year}{number_no_zero}"
                            url = self._build_url(self._patent_applications_endpoint, standardized)
                            async with self.session.get(url, headers=self.headers) as retry_response:
                                return await self._handle_response(retry_response, PatentFileWrapper.parse_response)
                        return await self._handle_response(response, PatentFileWrapper.parse_response)
                except Exception as e:
                    # If any error occurs during retry, raise the original error
                    raise e
            else:
                raise ValueError(f"Invalid PCT application number format: {serial_number}")

        url = self._build_url(self._patent_applications_endpoint, serial_number)
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, PatentFileWrapper.parse_response)

    async def get_patent_documents(
        self, 
        serial_number: str,
        official_date_from: Optional[str] = None,
        official_date_to: Optional[str] = None,
        document_codes: Optional[str] = None
    ) -> PatentDocumentCollection:
        """
        Retrieve all documents associated with a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')
            official_date_from (str, optional): Filter documents by official date from. 
                                               Format: 'yyyy-MM-dd' (e.g., '2023-01-01')
            official_date_to (str, optional): Filter documents by official date to. 
                                             Format: 'yyyy-MM-dd' (e.g., '2023-12-31')
            document_codes (str, optional): Filter by document codes. Single code or comma-separated 
                                           codes (e.g., 'WFEE' or 'SRFW,SRNT')

        Returns:
            PatentDocumentCollection: Collection of patent documents

        Raises:
            USPTOError: If the API request fails

        Examples:
            # Get all documents
            documents = await client.get_patent_documents("18571476")

            # Filter by date range
            documents = await client.get_patent_documents(
                "18571476",
                official_date_from="2023-01-01",
                official_date_to="2023-12-31"
            )

            # Filter by document codes
            documents = await client.get_patent_documents(
                "18571476",
                document_codes="WFEE"
            )

            # Combine filters
            documents = await client.get_patent_documents(
                "18571476",
                official_date_from="2023-01-01",
                official_date_to="2023-12-31",
                document_codes="SRFW,SRNT"
            )
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "documents")

        # Build query parameters, only including non-None values
        params = {}
        if official_date_from is not None:
            params['officialDateFrom'] = official_date_from
        if official_date_to is not None:
            params['officialDateTo'] = official_date_to
        if document_codes is not None:
            params['documentCodes'] = document_codes

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, PatentDocumentCollection.from_dict)

    async def download_document(
        self, 
        document: PatentDocument, 
        save_path: str,
        filename: Optional[str] = None,
        mime_type: str = "PDF"
    ) -> str:
        """
        Download a specific patent document to local storage.

        Args:
            document (PatentDocument): The patent document object to download
            save_path (str): Directory path where the file should be saved
            filename (Optional[str]): Custom filename for the downloaded document. 
                                    If None, generates automatic filename
            mime_type (str): Document format to download. Options: "PDF", "MS_WORD", "XML"

        Returns:
            str: Full path to the downloaded file

        Raises:
            FileNotFoundError: If save_path doesn't exist
            PermissionError: If save_path isn't writable
            ValueError: If requested mime_type isn't available
            USPTOError: If the API request fails
            Exception: If download fails
        """
        if not os.path.exists(save_path):
            raise FileNotFoundError(f"Save path does not exist: {save_path}")
        if not os.access(save_path, os.W_OK):
            raise PermissionError(f"Save path is not writable: {save_path}")

        download_option = next(
            (opt for opt in document.download_options if opt.mime_type == mime_type),
            None
        )

        if not download_option:
            available_types = [opt.mime_type for opt in document.download_options]
            raise ValueError(
                f"Mime type '{mime_type}' not available for this document. "
                f"Available types: {', '.join(available_types)}"
            )

        if not filename:
            extension = ".pdf" if mime_type == "PDF" else ".doc" if mime_type == "MS_WORD" else ".xml"
            filename = f"{document.application_number}_{document.document_code}_{document.document_identifier}{extension}"

        full_path = os.path.join(save_path, filename)

        async with self.session.get(download_option.download_url, headers=self.headers) as response:
            if response.status != 200:
                raise Exception(f"Download failed with status {response.status}")

            with open(full_path, 'wb') as f:
                while True:
                    chunk = await response.content.read(8192)
                    if not chunk:
                        break
                    f.write(chunk)

        logger.info(
            f"Successfully downloaded document {document.document_identifier} "
            f"({mime_type}) to {full_path}"
        )

        return full_path

    async def get_continuity(self, serial_number: str) -> ContinuityCollection:
        """
        Retrieve continuity information for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            ContinuityCollection: Collection of continuity relationships

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "continuity")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, ContinuityCollection.from_dict)

    async def get_foreign_priority(self, serial_number: str) -> ForeignPriorityCollection:
        """
        Retrieve foreign priority claims for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            ForeignPriorityCollection: Collection of foreign priority claims

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "foreign-priority")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, ForeignPriorityCollection.from_dict)

    async def get_patent_transactions(self, serial_number: str) -> TransactionCollection:
        """
        Retrieve transaction history for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            TransactionCollection: Collection of patent transactions

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "transactions")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, TransactionCollection.from_dict)

    async def get_patent_assignments(self, serial_number: str) -> AssignmentCollection:
        """
        Retrieve assignment information for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            AssignmentCollection: Collection of patent assignments

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "assignment")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, AssignmentCollection.from_dict)

    async def get_attorney(self, serial_number: str) -> AttorneyResponse:
        """
        Retrieve attorney/agent information for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            AttorneyResponse: Attorney/agent data for the application

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "attorney")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, AttorneyResponse.from_dict)

    async def get_adjustment(self, serial_number: str) -> AdjustmentResponse:
        """
        Retrieve patent term adjustment information for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            AdjustmentResponse: Patent term adjustment data for the application

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "adjustment")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, AdjustmentResponse.from_dict)

    async def get_associated_documents(self, serial_number: str) -> AssociatedDocumentsResponse:
        """
        Retrieve associated documents (PGPub and Grant) metadata for a patent application.

        Args:
            serial_number (str): The USPTO patent application serial number (e.g., '16123456')

        Returns:
            AssociatedDocumentsResponse: Associated documents metadata for the application

        Raises:
            USPTOError: If the API request fails
        """
        url = self._build_url(self._patent_applications_endpoint, serial_number, "associated-documents")
        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, AssociatedDocumentsResponse.from_dict)

    async def search_patent_applications(self, payload: dict) -> dict:
        """
        Search for patent applications using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/applications/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, etc.

        Returns:
            dict: The search results as returned by the USPTO API

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 413, 500)
        """
        url = self._build_url(self._patent_applications_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, lambda x: x)  # Return raw JSON response

    async def search_patent_applications_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> dict:
        """
        Search for patent applications using query parameters (GET method).

        Endpoint: GET /api/v1/patent/applications/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'applicationNumberText:14412875'
            sort (str, optional): Field to sort by followed by order. Example: 'applicationMetaData.filingDate asc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
                                   Example: 'applicationMetaData.applicationTypeCode,applicationMetaData.docketNumber'
            fields (str, optional): Comma-separated list of fields to include in response.
                                   Example: 'applicationNumberText,applicationMetaData.patentNumber'
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
                                    Example: 'applicationMetaData.applicationTypeCode UTL,DES'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'applicationMetaData.grantDate 2010-01-01:2011-01-01'

        Returns:
            dict: The search results as returned by the USPTO API

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 413, 500)

        Examples:
            # Search by application number
            results = await client.search_patent_applications_get(q='applicationNumberText:14412875')

            # Search with pagination
            results = await client.search_patent_applications_get(q='Utility', limit=50, offset=0)

            # Complex search with sorting and filtering
            results = await client.search_patent_applications_get(
                q='applicationMetaData.inventorBag.inventorNameText:Smith',
                sort='applicationMetaData.filingDate desc',
                filters='applicationMetaData.applicationTypeCode UTL',
                limit=100
            )

            # Complex search by partial docket number and customer number with specific fields
            # This example searches for docket numbers beginning with "3NG" AND customerNumber 51886,
            # returns only specified fields, sorted by filing date descending
            results = await client.search_patent_applications_get(
                q='applicationMetaData.docketNumber:3NG* AND applicationMetaData.customerNumber:51886',
                fields='applicationNumberText,applicationMetaData.inventionTitle,applicationMetaData.patentNumber,applicationMetaData.filingDate,applicationMetaData.docketNumber',
                sort='applicationMetaData.filingDate desc',
                limit=50,
                offset=0
            )
            # Expected response includes:
            # - count: total number of matching results
            # - patentFileWrapperDataBag: array of applications with requested fields
            # - Each application includes: applicationNumberText and applicationMetaData with
            #   inventionTitle, patentNumber, filingDate, and docketNumber fields
        """
        url = self._build_url(self._patent_applications_endpoint, "search")

        # Build query parameters, only including non-None values
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, lambda x: x)  # Return raw JSON response

    async def search_patent_applications_download(self, payload: dict) -> PatentDataResponse:
        """
        Download patent application search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/applications/search/download

        This endpoint is similar to search_patent_applications but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, etc.

        Returns:
            PatentDataResponse: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 413, 500)
        """
        url = self._build_url(self._patent_applications_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, PatentDataResponse.from_dict)

    async def search_patent_applications_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> PatentDataResponse:
        """
        Download patent application search results using query parameters (GET method).

        Endpoint: GET /api/v1/patent/applications/search/download

        This endpoint is similar to search_patent_applications_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'applicationNumberText:14412875'
            sort (str, optional): Field to sort by followed by order. Example: 'applicationMetaData.filingDate asc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
                                   Example: 'applicationMetaData.applicationTypeCode,applicationMetaData.docketNumber'
            fields (str, optional): Comma-separated list of fields to include in response.
                                   Example: 'applicationNumberText,applicationMetaData.patentNumber'
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
                                    Example: 'applicationMetaData.applicationTypeCode UTL,DES'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'applicationMetaData.grantDate 2010-01-01:2011-01-01'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            PatentDataResponse: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 413, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_patent_applications_download_get(q='applicationNumberText:14412875', format='json')

            # Download search results in CSV format
            results = await client.search_patent_applications_download_get(q='Utility', format='csv', limit=100)
        """
        url = self._build_url(self._patent_applications_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, PatentDataResponse.from_dict)

    async def search_petition_decisions(self, payload: dict) -> PetitionDecisionResponseBag:
        """
        Search petition decisions using a JSON payload (POST method).

        Endpoint: POST /api/v1/petition/decisions/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, pagination, etc.

        Returns:
            PetitionDecisionResponseBag: The search response containing petition decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._petition_decisions_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

    async def search_petition_decisions_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> PetitionDecisionResponseBag:
        """
        Search petition decisions using query parameters (GET method).

        Endpoint: GET /api/v1/petition/decisions/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'decisionTypeCodeDescriptionText:Denied'
            sort (str, optional): Field to sort by followed by order. Example: 'petitionMailDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'petitionMailDate 2021-01-01:2025-01-01'

        Returns:
            PetitionDecisionResponseBag: The search response containing petition decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for denied decisions
            results = await client.search_petition_decisions_get(q='decisionTypeCodeDescriptionText:Denied')

            # Search with filters and pagination
            results = await client.search_petition_decisions_get(
                q='Denied',
                filters='businessEntityStatusCategory Small',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._petition_decisions_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

    async def search_petition_decisions_download(self, payload: dict) -> PetitionDecisionResponseBag:
        """
        Download petition decision search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/petition/decisions/search/download

        This endpoint is similar to search_petition_decisions but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.

        Returns:
            PetitionDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._petition_decisions_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

    async def search_petition_decisions_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> PetitionDecisionResponseBag:
        """
        Download petition decision search results using query parameters (GET method).

        Endpoint: GET /api/v1/petition/decisions/search/download

        This endpoint is similar to search_petition_decisions_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string.
            sort (str, optional): Field to sort by followed by order.
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            PetitionDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_petition_decisions_download_get(q='Denied', format='json')

            # Download search results in CSV format
            results = await client.search_petition_decisions_download_get(q='Denied', format='csv', limit=100)
        """
        url = self._build_url(self._petition_decisions_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

    async def get_petition_decision(
        self,
        petition_decision_record_identifier: str,
        include_documents: bool = False
    ) -> PetitionDecisionIdentifierResponseBag:
        """
        Retrieve a specific petition decision by its record identifier.

        Endpoint: GET /api/v1/petition/decisions/{petitionDecisionRecordIdentifier}

        Args:
            petition_decision_record_identifier (str): The petition decision record identifier (UUID format)
            include_documents (bool, optional): Whether to include petition decision documents in the response.
                                               Default: False

        Returns:
            PetitionDecisionIdentifierResponseBag: The petition decision data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get petition decision without documents
            decision = await client.get_petition_decision('6779f1be-0f3b-5775-b9d3-dcfdb83171c3')

            # Get petition decision with documents
            decision = await client.get_petition_decision('6779f1be-0f3b-5775-b9d3-dcfdb83171c3', include_documents=True)
        """
        url = self._build_url(self._petition_decisions_endpoint, petition_decision_record_identifier)
        params = {}
        if include_documents:
            params['includeDocuments'] = 'true'
        else:
            params['includeDocuments'] = 'false'

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, PetitionDecisionIdentifierResponseBag.from_dict)

    async def search_trial_proceedings(self, payload: dict) -> TrialProceedingResponseBag:
        """
        Search trial proceedings using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/trials/proceedings/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, pagination, etc.

        Returns:
            TrialProceedingResponseBag: The search response containing trial proceeding results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_trials_proceedings_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

    async def search_trial_proceedings_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> TrialProceedingResponseBag:
        """
        Search trial proceedings using query parameters (GET method).

        Endpoint: GET /api/v1/patent/trials/proceedings/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'trialType:IPR'
            sort (str, optional): Field to sort by followed by order. Example: 'filingDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'filingDate 2021-01-01:2025-01-01'

        Returns:
            TrialProceedingResponseBag: The search response containing trial proceeding results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for IPR trials
            results = await client.search_trial_proceedings_get(q='trialType:IPR')

            # Search with filters and pagination
            results = await client.search_trial_proceedings_get(
                q='IPR',
                filters='proceedingStatus Instituted',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._ptab_trials_proceedings_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

    async def search_trial_proceedings_download(self, payload: dict) -> TrialProceedingResponseBag:
        """
        Download trial proceeding search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/trials/proceedings/search/download

        This endpoint is similar to search_trial_proceedings but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.

        Returns:
            TrialProceedingResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_trials_proceedings_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

    async def search_trial_proceedings_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> TrialProceedingResponseBag:
        """
        Download trial proceeding search results using query parameters (GET method).

        Endpoint: GET /api/v1/patent/trials/proceedings/search/download

        This endpoint is similar to search_trial_proceedings_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string.
            sort (str, optional): Field to sort by followed by order.
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            TrialProceedingResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_trial_proceedings_download_get(q='IPR', format='json')

            # Download search results in CSV format
            results = await client.search_trial_proceedings_download_get(q='IPR', format='csv', limit=100)
        """
        url = self._build_url(self._ptab_trials_proceedings_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

    async def get_trial_proceeding(self, trial_number: str) -> TrialProceedingIdentifierResponseBag:
        """
        Retrieve a specific trial proceeding by its trial number.

        Endpoint: GET /api/v1/patent/trials/proceedings/{trialNumber}

        Args:
            trial_number (str): The trial number identifier

        Returns:
            TrialProceedingIdentifierResponseBag: The trial proceeding data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get trial proceeding
            proceeding = await client.get_trial_proceeding('IPR2020-00001')
        """
        url = self._build_url(self._ptab_trials_proceedings_endpoint, trial_number)

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, TrialProceedingIdentifierResponseBag.from_dict)

    async def search_trial_decisions(self, payload: dict) -> TrialDecisionResponseBag:
        """
        Search trial decisions using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/trials/decisions/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, pagination, etc.

        Returns:
            TrialDecisionResponseBag: The search response containing trial decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_trials_decisions_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

    async def search_trial_decisions_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> TrialDecisionResponseBag:
        """
        Search trial decisions using query parameters (GET method).

        Endpoint: GET /api/v1/patent/trials/decisions/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'trialType:IPR'
            sort (str, optional): Field to sort by followed by order. Example: 'decisionDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'decisionDate 2021-01-01:2025-01-01'

        Returns:
            TrialDecisionResponseBag: The search response containing trial decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for IPR trial decisions
            results = await client.search_trial_decisions_get(q='IPR')

            # Search with filters and pagination
            results = await client.search_trial_decisions_get(
                q='IPR',
                filters='decisionType Final',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._ptab_trials_decisions_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

    async def search_trial_decisions_download(self, payload: dict) -> TrialDecisionResponseBag:
        """
        Download trial decision search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/trials/decisions/search/download

        This endpoint is similar to search_trial_decisions but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.

        Returns:
            TrialDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_trials_decisions_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

    async def search_trial_decisions_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> TrialDecisionResponseBag:
        """
        Download trial decision search results using query parameters (GET method).

        Endpoint: GET /api/v1/patent/trials/decisions/search/download

        This endpoint is similar to search_trial_decisions_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string.
            sort (str, optional): Field to sort by followed by order.
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            TrialDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_trial_decisions_download_get(q='IPR', format='json')

            # Download search results in CSV format
            results = await client.search_trial_decisions_download_get(q='IPR', format='csv', limit=100)
        """
        url = self._build_url(self._ptab_trials_decisions_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

    async def get_trial_decision(self, document_identifier: str) -> TrialDecisionIdentifierResponseBag:
        """
        Retrieve a specific trial decision by its document identifier.

        Endpoint: GET /api/v1/patent/trials/decisions/{documentIdentifier}

        Args:
            document_identifier (str): The trial decision document identifier

        Returns:
            TrialDecisionIdentifierResponseBag: The trial decision data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get trial decision by document identifier
            decision = await client.get_trial_decision('DOC-12345')
        """
        url = self._build_url(self._ptab_trials_decisions_endpoint, document_identifier)

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, TrialDecisionIdentifierResponseBag.from_dict)

    async def get_trial_decisions_by_trial(self, trial_number: str) -> TrialDecisionByTrialResponseBag:
        """
        Retrieve all trial decisions for a specific trial number.

        Endpoint: GET /api/v1/patent/trials/{trialNumber}/decisions

        Args:
            trial_number (str): The trial number identifier (e.g., "IPR2020-00001")

        Returns:
            TrialDecisionByTrialResponseBag: The trial decisions data for the specified trial

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get all decisions for a trial
            decisions = await client.get_trial_decisions_by_trial('IPR2020-00001')
        """
        # Build URL: /api/v1/patent/trials/{trialNumber}/decisions
        url = self._build_url(
            f"{self.BASE_API_URL}/v1/patent/trials",
            trial_number,
            "decisions"
        )

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, TrialDecisionByTrialResponseBag.from_dict)

    async def search_trial_documents(self, payload: dict) -> TrialDocumentResponseBag:
        """
        Search trial documents using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/trials/documents/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, pagination, etc.

        Returns:
            TrialDocumentResponseBag: The search response containing trial document results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_trials_documents_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

    async def search_trial_documents_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> TrialDocumentResponseBag:
        """
        Search trial documents using query parameters (GET method).

        Endpoint: GET /api/v1/patent/trials/documents/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'trialType:IPR'
            sort (str, optional): Field to sort by followed by order. Example: 'documentDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'documentDate 2021-01-01:2025-01-01'

        Returns:
            TrialDocumentResponseBag: The search response containing trial document results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for IPR trial documents
            results = await client.search_trial_documents_get(q='IPR')

            # Search with filters and pagination
            results = await client.search_trial_documents_get(
                q='IPR',
                filters='documentType Petition',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._ptab_trials_documents_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

    async def search_trial_documents_download(self, payload: dict) -> TrialDocumentResponseBag:
        """
        Download trial document search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/trials/documents/search/download

        This endpoint is similar to search_trial_documents but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.

        Returns:
            TrialDocumentResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_trials_documents_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

    async def search_trial_documents_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> TrialDocumentResponseBag:
        """
        Download trial document search results using query parameters (GET method).

        Endpoint: GET /api/v1/patent/trials/documents/search/download

        This endpoint is similar to search_trial_documents_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string.
            sort (str, optional): Field to sort by followed by order.
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            TrialDocumentResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_trial_documents_download_get(q='IPR', format='json')

            # Download search results in CSV format
            results = await client.search_trial_documents_download_get(q='IPR', format='csv', limit=100)
        """
        url = self._build_url(self._ptab_trials_documents_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

    async def get_trial_document(self, document_identifier: str) -> TrialDocumentIdentifierResponseBag:
        """
        Retrieve a specific trial document by its document identifier.

        Endpoint: GET /api/v1/patent/trials/documents/{documentIdentifier}

        Args:
            document_identifier (str): The trial document identifier

        Returns:
            TrialDocumentIdentifierResponseBag: The trial document data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get trial document by document identifier
            document = await client.get_trial_document('DOC-12345')
        """
        url = self._build_url(self._ptab_trials_documents_endpoint, document_identifier)

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, TrialDocumentIdentifierResponseBag.from_dict)

    async def get_trial_documents_by_trial(self, trial_number: str) -> TrialDocumentByTrialResponseBag:
        """
        Retrieve all trial documents for a specific trial number.

        Endpoint: GET /api/v1/patent/trials/{trialNumber}/documents

        Args:
            trial_number (str): The trial number identifier (e.g., "IPR2020-00001")

        Returns:
            TrialDocumentByTrialResponseBag: The trial documents data for the specified trial

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get all documents for a trial
            documents = await client.get_trial_documents_by_trial('IPR2020-00001')
        """
        # Build URL: /api/v1/patent/trials/{trialNumber}/documents
        url = self._build_url(
            f"{self.BASE_API_URL}/v1/patent/trials",
            trial_number,
            "documents"
        )

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, TrialDocumentByTrialResponseBag.from_dict)

    async def search_appeal_decisions(self, payload: dict) -> AppealDecisionResponseBag:
        """
        Search appeal decisions using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/appeals/decisions/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, pagination, etc.

        Returns:
            AppealDecisionResponseBag: The search response containing appeal decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_appeals_decisions_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

    async def search_appeal_decisions_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> AppealDecisionResponseBag:
        """
        Search appeal decisions using query parameters (GET method).

        Endpoint: GET /api/v1/patent/appeals/decisions/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'decisionType:Final'
            sort (str, optional): Field to sort by followed by order. Example: 'decisionDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'decisionDate 2021-01-01:2025-01-01'

        Returns:
            AppealDecisionResponseBag: The search response containing appeal decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for appeal decisions
            results = await client.search_appeal_decisions_get(q='Final')

            # Search with filters and pagination
            results = await client.search_appeal_decisions_get(
                q='Final',
                filters='decisionType Final',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._ptab_appeals_decisions_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

    async def search_appeal_decisions_download(self, payload: dict) -> AppealDecisionResponseBag:
        """
        Download appeal decision search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/appeals/decisions/search/download

        This endpoint is similar to search_appeal_decisions but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.

        Returns:
            AppealDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_appeals_decisions_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

    async def search_appeal_decisions_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> AppealDecisionResponseBag:
        """
        Download appeal decision search results using query parameters (GET method).

        Endpoint: GET /api/v1/patent/appeals/decisions/search/download

        This endpoint is similar to search_appeal_decisions_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string.
            sort (str, optional): Field to sort by followed by order.
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            AppealDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_appeal_decisions_download_get(q='Final', format='json')

            # Download search results in CSV format
            results = await client.search_appeal_decisions_download_get(q='Final', format='csv', limit=100)
        """
        url = self._build_url(self._ptab_appeals_decisions_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

    async def get_appeal_decision(self, document_identifier: str) -> AppealDecisionIdentifierResponseBag:
        """
        Retrieve a specific appeal decision by its document identifier.

        Endpoint: GET /api/v1/patent/appeals/decisions/{documentIdentifier}

        Args:
            document_identifier (str): The appeal decision document identifier

        Returns:
            AppealDecisionIdentifierResponseBag: The appeal decision data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get appeal decision by document identifier
            decision = await client.get_appeal_decision('DOC-12345')
        """
        url = self._build_url(self._ptab_appeals_decisions_endpoint, document_identifier)

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, AppealDecisionIdentifierResponseBag.from_dict)

    async def get_appeal_decisions_by_appeal(self, appeal_number: str) -> AppealDecisionByAppealResponseBag:
        """
        Retrieve all appeal decisions for a specific appeal number.

        Endpoint: GET /api/v1/patent/appeals/{appealNumber}/decisions

        Args:
            appeal_number (str): The appeal number identifier (e.g., "2020-001234")

        Returns:
            AppealDecisionByAppealResponseBag: The appeal decisions data for the specified appeal

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get all decisions for an appeal
            decisions = await client.get_appeal_decisions_by_appeal('2020-001234')
        """
        # Build URL: /api/v1/patent/appeals/{appealNumber}/decisions
        url = self._build_url(
            f"{self.BASE_API_URL}/v1/patent/appeals",
            appeal_number,
            "decisions"
        )

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, AppealDecisionByAppealResponseBag.from_dict)

    async def search_interference_decisions(self, payload: dict) -> InterferenceDecisionResponseBag:
        """
        Search interference decisions using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/interferences/decisions/search

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, sort options, filters, pagination, etc.

        Returns:
            InterferenceDecisionResponseBag: The search response containing interference decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_interferences_decisions_endpoint, "search")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

    async def search_interference_decisions_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> InterferenceDecisionResponseBag:
        """
        Search interference decisions using query parameters (GET method).

        Endpoint: GET /api/v1/patent/interferences/decisions/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'decisionType:Final'
            sort (str, optional): Field to sort by followed by order. Example: 'decisionDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'decisionDate 2021-01-01:2025-01-01'

        Returns:
            InterferenceDecisionResponseBag: The search response containing interference decision results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for interference decisions
            results = await client.search_interference_decisions_get(q='Final')

            # Search with filters and pagination
            results = await client.search_interference_decisions_get(
                q='Final',
                filters='decisionType Final',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._ptab_interferences_decisions_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

    async def search_interference_decisions_download(self, payload: dict) -> InterferenceDecisionResponseBag:
        """
        Download interference decision search results using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/interferences/decisions/search/download

        This endpoint is similar to search_interference_decisions but optimized for downloads.

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.

        Returns:
            InterferenceDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)
        """
        url = self._build_url(self._ptab_interferences_decisions_endpoint, "search", "download")
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

    async def search_interference_decisions_download_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None,
        format: Optional[str] = None
    ) -> InterferenceDecisionResponseBag:
        """
        Download interference decision search results using query parameters (GET method).

        Endpoint: GET /api/v1/patent/interferences/decisions/search/download

        This endpoint is similar to search_interference_decisions_get but optimized for downloads.
        Supports a format parameter for download format (json or csv).

        Args:
            q (str, optional): Search query string.
            sort (str, optional): Field to sort by followed by order.
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
            format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

        Returns:
            InterferenceDecisionResponseBag: The download response containing search results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Download search results in JSON format
            results = await client.search_interference_decisions_download_get(q='Final', format='json')

            # Download search results in CSV format
            results = await client.search_interference_decisions_download_get(q='Final', format='csv', limit=100)
        """
        url = self._build_url(self._ptab_interferences_decisions_endpoint, "search", "download")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters
        if format is not None:
            params['format'] = format

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

    async def get_interference_decision(self, document_identifier: str) -> InterferenceDecisionIdentifierResponseBag:
        """
        Retrieve a specific interference decision by its document identifier.

        Endpoint: GET /api/v1/patent/interferences/decisions/{documentIdentifier}

        Args:
            document_identifier (str): The interference decision document identifier

        Returns:
            InterferenceDecisionIdentifierResponseBag: The interference decision data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get interference decision by document identifier
            decision = await client.get_interference_decision('DOC-12345')
        """
        url = self._build_url(self._ptab_interferences_decisions_endpoint, document_identifier)

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, InterferenceDecisionIdentifierResponseBag.from_dict)

    async def get_interference_decisions_by_interference(self, interference_number: str) -> InterferenceDecisionByInterferenceResponseBag:
        """
        Retrieve all interference decisions for a specific interference number.

        Endpoint: GET /api/v1/patent/interferences/{interferenceNumber}/decisions

        Args:
            interference_number (str): The interference number identifier (e.g., "106,001")

        Returns:
            InterferenceDecisionByInterferenceResponseBag: The interference decisions data for the specified interference

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get all decisions for an interference
            decisions = await client.get_interference_decisions_by_interference('106,001')
        """
        # Build URL: /api/v1/patent/interferences/{interferenceNumber}/decisions
        url = self._build_url(
            f"{self.BASE_API_URL}/v1/patent/interferences",
            interference_number,
            "decisions"
        )

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, InterferenceDecisionByInterferenceResponseBag.from_dict)

    async def search_dataset_products_get(
        self,
        q: Optional[str] = None,
        sort: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        facets: Optional[str] = None,
        fields: Optional[str] = None,
        filters: Optional[str] = None,
        range_filters: Optional[str] = None
    ) -> DatasetProductSearchResponseBag:
        """
        Search dataset products using query parameters (GET method).

        Endpoint: GET /api/v1/datasets/products/search

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). Example: 'productType:Patent'
            sort (str, optional): Field to sort by followed by order. Example: 'releaseDate desc'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25
            facets (str, optional): Comma-separated list of fields to facet.
            fields (str, optional): Comma-separated list of fields to include in response.
            filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
            range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                          Example: 'releaseDate 2021-01-01:2025-01-01'

        Returns:
            DatasetProductSearchResponseBag: The search response containing dataset product results

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search for dataset products
            results = await client.search_dataset_products_get(q='Patent')

            # Search with filters and pagination
            results = await client.search_dataset_products_get(
                q='Patent',
                filters='productType Patent',
                limit=50,
                offset=0
            )
        """
        url = self._build_url(self._bulk_datasets_endpoint, "search")
        params = {}
        if q is not None:
            params['q'] = q
        if sort is not None:
            params['sort'] = sort
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if facets is not None:
            params['facets'] = facets
        if fields is not None:
            params['fields'] = fields
        if filters is not None:
            params['filters'] = filters
        if range_filters is not None:
            params['rangeFilters'] = range_filters

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, DatasetProductSearchResponseBag.from_dict)

    async def get_dataset_product(
        self,
        product_identifier: str,
        file_data_from_date: Optional[str] = None,
        file_data_to_date: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        include_files: Optional[str] = None,
        latest: Optional[str] = None
    ) -> DatasetProductResponseBag:
        """
        Retrieve a specific dataset product by its product identifier.

        Endpoint: GET /api/v1/datasets/products/{productIdentifier}

        Args:
            product_identifier (str): The dataset product identifier
            file_data_from_date (str, optional): Filter product files by date from.
                                                Format: 'yyyy-MM-dd' (e.g., '2023-01-01')
            file_data_to_date (str, optional): Filter product files by date to.
                                              Format: 'yyyy-MM-dd' (e.g., '2023-12-31')
            offset (int, optional): Number of product file records to skip. Default: 0
            limit (int, optional): Number of product file records to collect
            include_files (str, optional): Set to 'true' to include product files in response,
                                          'false' to omit them. Default: None (API default behavior)
            latest (str, optional): Set to 'true' to return only the latest product file,
                                   'false' otherwise. Default: None (API default behavior)

        Returns:
            DatasetProductResponseBag: The dataset product data

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get dataset product by product identifier
            product = await client.get_dataset_product('product-12345')

            # Get product with date range filter
            product = await client.get_dataset_product(
                'product-12345',
                file_data_from_date='2023-01-01',
                file_data_to_date='2023-12-31'
            )

            # Get product with latest file only
            product = await client.get_dataset_product('product-12345', latest='true')

            # Get product without files included
            product = await client.get_dataset_product('product-12345', include_files='false')
        """
        url = self._build_url(self._bulk_datasets_endpoint, product_identifier)
        params = {}

        if file_data_from_date is not None:
            params['fileDataFromDate'] = file_data_from_date
        if file_data_to_date is not None:
            params['fileDataToDate'] = file_data_to_date
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit
        if include_files is not None:
            params['includeFiles'] = include_files
        if latest is not None:
            params['latest'] = latest

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, DatasetProductResponseBag.from_dict)

    async def get_dataset_file(self, product_identifier: str, file_name: str) -> DatasetFileResponseBag:
        """
        Retrieve a specific dataset file by product identifier and file name.

        Endpoint: GET /api/v1/datasets/products/files/{productIdentifier}/{fileName}

        Args:
            product_identifier (str): The dataset product identifier
            file_name (str): The file name within the product

        Returns:
            DatasetFileResponseBag: The dataset file data (may contain download URL or metadata)

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Get dataset file by product identifier and file name
            file_info = await client.get_dataset_file('product-12345', 'data.csv')
        """
        url = self._build_url(self._bulk_datasets_endpoint, "files", product_identifier, file_name)

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, DatasetFileResponseBag.from_dict)

    async def get_app_metadata(self, application_number: str) -> ApplicationMetadataResponse:
        """
        Get application metadata directly from the /meta-data endpoint using an application number.

        This is the direct implementation of the /api/v1/patent/applications/{applicationNumberText}/meta-data endpoint.

        Args:
            application_number (str): The application number (e.g., "14412875" or "14/412,875")

        Returns:
            ApplicationMetadataResponse: The application metadata response containing application number and metadata

        Raises:
            USPTOError: If the API request fails (e.g., 404 if application not found)
        """
        # Build URL for the meta-data endpoint: /api/v1/patent/applications/{applicationNumberText}/meta-data
        url = self._build_url(self._patent_applications_endpoint, application_number, "meta-data")

        async with self.session.get(url, headers=self.headers) as response:
            return await self._handle_response(response, ApplicationMetadataResponse.from_dict)

    async def get_app_metadata_from_patent_number(self, patent_number: str) -> Optional[ApplicationMetadataResponse]:
        """
        Get the application metadata associated with a patent number.

        This method searches for the application number using the patent number, then calls
        the direct meta-data endpoint. This is a convenience method for users who have a patent
        number but need the application metadata.

        Args:
            patent_number (str): The patent number to search for (e.g., "US9,022,434" or "9022434")

        Returns:
            Optional[ApplicationMetadataResponse]: The application metadata if found, None otherwise

        Raises:
            USPTOError: If the API request fails
        """
        # Sanitize the patent number by removing "US" prefix and any non-digit characters
        sanitized_patent = ''.join(c for c in patent_number if c.isdigit())

        # Create the search payload to find the application number from the patent number
        payload = {
            "q" : "applicationMetaData.patentNumber:" + sanitized_patent,
            "filters": [
                {
                    "name": "applicationMetaData.applicationTypeLabelName",
                    "value": ["Utility"]
                },
                {
                    "name": "applicationMetaData.publicationCategoryBag",
                    "value": ["Granted/Issued"]
                }
            ],
            "sort": [
                {
                    "field": "applicationMetaData.filingDate",
                    "order": "desc"
                }
            ],
            "pagination": {
                "offset": 0,
                "limit": 25
            },
            "fields": ["applicationNumberText", "applicationMetaData"],
            "facets": [
                "applicationMetaData.applicationTypeLabelName"
            ]        
        }

        # Make the search request to find the application number
        response = await self.search_patent_applications(payload)

        # Check if we got results
        if response.get('count', 0) > 0 and 'patentFileWrapperDataBag' in response:
            # Extract the application number from the first result
            application_number = response['patentFileWrapperDataBag'][0].get('applicationNumberText')

            if application_number:
                # Use the direct meta-data endpoint with the found application number
                return await self.get_app_metadata(application_number)

        return None

    async def search_status_codes_get(
        self,
        q: Optional[str] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None
    ) -> StatusCodeCollection:
        """
        Search for patent application status codes using query parameters (GET method).

        Endpoint: GET /api/v1/patent/status-codes

        Args:
            q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                              wildcards (*), and exact phrases (""). 
                              Example: 'applicationStatusDescriptionText:Preexam'
            offset (int, optional): Position in dataset to start from. Default: 0
            limit (int, optional): Number of results to return. Default: 25

        Returns:
            StatusCodeCollection: Collection of status codes matching the search criteria

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Examples:
            # Search by status description
            result = await client.search_status_codes_get(q='applicationStatusDescriptionText:Preexam')

            # Search with comparison operator
            result = await client.search_status_codes_get(q='applicationStatusCode:>100', limit=50)

            # Search with pagination
            result = await client.search_status_codes_get(q='Application AND Preexam', limit=10, offset=0)
        """
        url = self._build_url(self._status_codes_endpoint)

        # Build query parameters, only including non-None values
        params = {}
        if q is not None:
            params['q'] = q
        if offset is not None:
            params['offset'] = offset
        if limit is not None:
            params['limit'] = limit

        async with self.session.get(url, params=params, headers=self.headers) as response:
            return await self._handle_response(response, StatusCodeCollection.from_dict)

    async def search_status_codes(self, payload: dict) -> StatusCodeCollection:
        """
        Search for patent application status codes using a JSON payload (POST method).

        Endpoint: POST /api/v1/patent/status-codes

        Args:
            payload (dict): The search criteria as a JSON-compatible dictionary.
                           Can include fields like query text, pagination, etc.
                           All fields in the request are optional.

        Returns:
            StatusCodeCollection: Collection of status codes matching the search criteria

        Raises:
            USPTOError: If the API request fails (400, 403, 404, 500)

        Example:
            payload = {
                "q": "applicationStatusCode:>100",
                "pagination": {
                    "offset": 0,
                    "limit": 25
                }
            }
            result = await client.search_status_codes(payload)
        """
        url = self._build_url(self._status_codes_endpoint)
        async with self.session.post(url, json=payload, headers=self.headers) as response:
            return await self._handle_response(response, StatusCodeCollection.from_dict)

Functions

get_patent_wrapper async

get_patent_wrapper(serial_number)

Retrieve the patent application wrapper information.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456' or 'PCTUS2004027676') If a non-PCT number starts with 'US', it will be stripped (e.g., 'US0506853' -> '0506853')

required

Returns:

Name Type Description
PatentFileWrapper PatentFileWrapper

Object containing patent wrapper information

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_patent_wrapper(self, serial_number: str) -> PatentFileWrapper:
    """
    Retrieve the patent application wrapper information.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456' or 'PCTUS2004027676')
                           If a non-PCT number starts with 'US', it will be stripped (e.g., 'US0506853' -> '0506853')

    Returns:
        PatentFileWrapper: Object containing patent wrapper information

    Raises:
        USPTOError: If the API request fails
    """
    # Strip 'US' prefix from non-PCT application numbers
    if serial_number.startswith('US'):
        serial_number = serial_number[2:]

    # Check if this is a PCT application number
    if serial_number.startswith('PCT'):
        # Pattern to match PCT numbers and extract country code, year and remaining digits
        # Group 1: Country code (US|IB|AU)
        # Group 2: Year (2 digits, optionally prefixed with 20)
        # Group 3: Remaining digits
        pct_pattern = r'PCT(US|IB|AU)?(?:20)?(\d{2})(\d+)'
        match = re.match(pct_pattern, serial_number)

        if match:
            country, year, number = match.groups()
            # Use US as default if no country code
            country = country or 'US'
            # First try with original number
            standardized = f"PCT{country}{year}{number}"

            try:
                url = self._build_url(self._patent_applications_endpoint, standardized)
                async with self.session.get(url, headers=self.headers) as response:
                    if response.status == 404 and number.startswith('0'):
                        # If 404 and has leading zero, try without it
                        number_no_zero = str(int(number))
                        standardized = f"PCT{country}{year}{number_no_zero}"
                        url = self._build_url(self._patent_applications_endpoint, standardized)
                        async with self.session.get(url, headers=self.headers) as retry_response:
                            return await self._handle_response(retry_response, PatentFileWrapper.parse_response)
                    return await self._handle_response(response, PatentFileWrapper.parse_response)
            except Exception as e:
                # If any error occurs during retry, raise the original error
                raise e
        else:
            raise ValueError(f"Invalid PCT application number format: {serial_number}")

    url = self._build_url(self._patent_applications_endpoint, serial_number)
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, PatentFileWrapper.parse_response)

get_patent_documents async

get_patent_documents(serial_number, official_date_from=None, official_date_to=None, document_codes=None)

Retrieve all documents associated with a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required
official_date_from str

Filter documents by official date from. Format: 'yyyy-MM-dd' (e.g., '2023-01-01')

None
official_date_to str

Filter documents by official date to. Format: 'yyyy-MM-dd' (e.g., '2023-12-31')

None
document_codes str

Filter by document codes. Single code or comma-separated codes (e.g., 'WFEE' or 'SRFW,SRNT')

None

Returns:

Name Type Description
PatentDocumentCollection PatentDocumentCollection

Collection of patent documents

Raises:

Type Description
USPTOError

If the API request fails

Examples:

Get all documents

documents = await client.get_patent_documents("18571476")

Filter by date range

documents = await client.get_patent_documents( "18571476", official_date_from="2023-01-01", official_date_to="2023-12-31" )

Filter by document codes

documents = await client.get_patent_documents( "18571476", document_codes="WFEE" )

Combine filters

documents = await client.get_patent_documents( "18571476", official_date_from="2023-01-01", official_date_to="2023-12-31", document_codes="SRFW,SRNT" )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_patent_documents(
    self, 
    serial_number: str,
    official_date_from: Optional[str] = None,
    official_date_to: Optional[str] = None,
    document_codes: Optional[str] = None
) -> PatentDocumentCollection:
    """
    Retrieve all documents associated with a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')
        official_date_from (str, optional): Filter documents by official date from. 
                                           Format: 'yyyy-MM-dd' (e.g., '2023-01-01')
        official_date_to (str, optional): Filter documents by official date to. 
                                         Format: 'yyyy-MM-dd' (e.g., '2023-12-31')
        document_codes (str, optional): Filter by document codes. Single code or comma-separated 
                                       codes (e.g., 'WFEE' or 'SRFW,SRNT')

    Returns:
        PatentDocumentCollection: Collection of patent documents

    Raises:
        USPTOError: If the API request fails

    Examples:
        # Get all documents
        documents = await client.get_patent_documents("18571476")

        # Filter by date range
        documents = await client.get_patent_documents(
            "18571476",
            official_date_from="2023-01-01",
            official_date_to="2023-12-31"
        )

        # Filter by document codes
        documents = await client.get_patent_documents(
            "18571476",
            document_codes="WFEE"
        )

        # Combine filters
        documents = await client.get_patent_documents(
            "18571476",
            official_date_from="2023-01-01",
            official_date_to="2023-12-31",
            document_codes="SRFW,SRNT"
        )
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "documents")

    # Build query parameters, only including non-None values
    params = {}
    if official_date_from is not None:
        params['officialDateFrom'] = official_date_from
    if official_date_to is not None:
        params['officialDateTo'] = official_date_to
    if document_codes is not None:
        params['documentCodes'] = document_codes

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, PatentDocumentCollection.from_dict)

download_document async

download_document(document, save_path, filename=None, mime_type='PDF')

Download a specific patent document to local storage.

Parameters:

Name Type Description Default
document PatentDocument

The patent document object to download

required
save_path str

Directory path where the file should be saved

required
filename Optional[str]

Custom filename for the downloaded document. If None, generates automatic filename

None
mime_type str

Document format to download. Options: "PDF", "MS_WORD", "XML"

'PDF'

Returns:

Name Type Description
str str

Full path to the downloaded file

Raises:

Type Description
FileNotFoundError

If save_path doesn't exist

PermissionError

If save_path isn't writable

ValueError

If requested mime_type isn't available

USPTOError

If the API request fails

Exception

If download fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def download_document(
    self, 
    document: PatentDocument, 
    save_path: str,
    filename: Optional[str] = None,
    mime_type: str = "PDF"
) -> str:
    """
    Download a specific patent document to local storage.

    Args:
        document (PatentDocument): The patent document object to download
        save_path (str): Directory path where the file should be saved
        filename (Optional[str]): Custom filename for the downloaded document. 
                                If None, generates automatic filename
        mime_type (str): Document format to download. Options: "PDF", "MS_WORD", "XML"

    Returns:
        str: Full path to the downloaded file

    Raises:
        FileNotFoundError: If save_path doesn't exist
        PermissionError: If save_path isn't writable
        ValueError: If requested mime_type isn't available
        USPTOError: If the API request fails
        Exception: If download fails
    """
    if not os.path.exists(save_path):
        raise FileNotFoundError(f"Save path does not exist: {save_path}")
    if not os.access(save_path, os.W_OK):
        raise PermissionError(f"Save path is not writable: {save_path}")

    download_option = next(
        (opt for opt in document.download_options if opt.mime_type == mime_type),
        None
    )

    if not download_option:
        available_types = [opt.mime_type for opt in document.download_options]
        raise ValueError(
            f"Mime type '{mime_type}' not available for this document. "
            f"Available types: {', '.join(available_types)}"
        )

    if not filename:
        extension = ".pdf" if mime_type == "PDF" else ".doc" if mime_type == "MS_WORD" else ".xml"
        filename = f"{document.application_number}_{document.document_code}_{document.document_identifier}{extension}"

    full_path = os.path.join(save_path, filename)

    async with self.session.get(download_option.download_url, headers=self.headers) as response:
        if response.status != 200:
            raise Exception(f"Download failed with status {response.status}")

        with open(full_path, 'wb') as f:
            while True:
                chunk = await response.content.read(8192)
                if not chunk:
                    break
                f.write(chunk)

    logger.info(
        f"Successfully downloaded document {document.document_identifier} "
        f"({mime_type}) to {full_path}"
    )

    return full_path

get_continuity async

get_continuity(serial_number)

Retrieve continuity information for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
ContinuityCollection ContinuityCollection

Collection of continuity relationships

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_continuity(self, serial_number: str) -> ContinuityCollection:
    """
    Retrieve continuity information for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        ContinuityCollection: Collection of continuity relationships

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "continuity")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, ContinuityCollection.from_dict)

get_foreign_priority async

get_foreign_priority(serial_number)

Retrieve foreign priority claims for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
ForeignPriorityCollection ForeignPriorityCollection

Collection of foreign priority claims

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_foreign_priority(self, serial_number: str) -> ForeignPriorityCollection:
    """
    Retrieve foreign priority claims for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        ForeignPriorityCollection: Collection of foreign priority claims

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "foreign-priority")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, ForeignPriorityCollection.from_dict)

get_patent_transactions async

get_patent_transactions(serial_number)

Retrieve transaction history for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
TransactionCollection TransactionCollection

Collection of patent transactions

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_patent_transactions(self, serial_number: str) -> TransactionCollection:
    """
    Retrieve transaction history for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        TransactionCollection: Collection of patent transactions

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "transactions")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, TransactionCollection.from_dict)

get_patent_assignments async

get_patent_assignments(serial_number)

Retrieve assignment information for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
AssignmentCollection AssignmentCollection

Collection of patent assignments

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_patent_assignments(self, serial_number: str) -> AssignmentCollection:
    """
    Retrieve assignment information for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        AssignmentCollection: Collection of patent assignments

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "assignment")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, AssignmentCollection.from_dict)

get_attorney async

get_attorney(serial_number)

Retrieve attorney/agent information for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
AttorneyResponse AttorneyResponse

Attorney/agent data for the application

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_attorney(self, serial_number: str) -> AttorneyResponse:
    """
    Retrieve attorney/agent information for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        AttorneyResponse: Attorney/agent data for the application

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "attorney")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, AttorneyResponse.from_dict)

get_adjustment async

get_adjustment(serial_number)

Retrieve patent term adjustment information for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
AdjustmentResponse AdjustmentResponse

Patent term adjustment data for the application

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_adjustment(self, serial_number: str) -> AdjustmentResponse:
    """
    Retrieve patent term adjustment information for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        AdjustmentResponse: Patent term adjustment data for the application

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "adjustment")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, AdjustmentResponse.from_dict)

get_associated_documents async

get_associated_documents(serial_number)

Retrieve associated documents (PGPub and Grant) metadata for a patent application.

Parameters:

Name Type Description Default
serial_number str

The USPTO patent application serial number (e.g., '16123456')

required

Returns:

Name Type Description
AssociatedDocumentsResponse AssociatedDocumentsResponse

Associated documents metadata for the application

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_associated_documents(self, serial_number: str) -> AssociatedDocumentsResponse:
    """
    Retrieve associated documents (PGPub and Grant) metadata for a patent application.

    Args:
        serial_number (str): The USPTO patent application serial number (e.g., '16123456')

    Returns:
        AssociatedDocumentsResponse: Associated documents metadata for the application

    Raises:
        USPTOError: If the API request fails
    """
    url = self._build_url(self._patent_applications_endpoint, serial_number, "associated-documents")
    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, AssociatedDocumentsResponse.from_dict)

search_patent_applications async

search_patent_applications(payload)

Search for patent applications using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/applications/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, etc.

required

Returns:

Name Type Description
dict dict

The search results as returned by the USPTO API

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 413, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_patent_applications(self, payload: dict) -> dict:
    """
    Search for patent applications using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/applications/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, etc.

    Returns:
        dict: The search results as returned by the USPTO API

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 413, 500)
    """
    url = self._build_url(self._patent_applications_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, lambda x: x)  # Return raw JSON response

search_patent_applications_get async

search_patent_applications_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search for patent applications using query parameters (GET method).

Endpoint: GET /api/v1/patent/applications/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'applicationNumberText:14412875'

None
sort str

Field to sort by followed by order. Example: 'applicationMetaData.filingDate asc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet. Example: 'applicationMetaData.applicationTypeCode,applicationMetaData.docketNumber'

None
fields str

Comma-separated list of fields to include in response. Example: 'applicationNumberText,applicationMetaData.patentNumber'

None
filters str

Filter by field value. Format: 'fieldName value1,value2' Example: 'applicationMetaData.applicationTypeCode UTL,DES'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'applicationMetaData.grantDate 2010-01-01:2011-01-01'

None

Returns:

Name Type Description
dict dict

The search results as returned by the USPTO API

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 413, 500)

Examples:

Search by application number

results = await client.search_patent_applications_get(q='applicationNumberText:14412875')

Search with pagination

results = await client.search_patent_applications_get(q='Utility', limit=50, offset=0)

Complex search with sorting and filtering

results = await client.search_patent_applications_get( q='applicationMetaData.inventorBag.inventorNameText:Smith', sort='applicationMetaData.filingDate desc', filters='applicationMetaData.applicationTypeCode UTL', limit=100 )

Complex search by partial docket number and customer number with specific fields
This example searches for docket numbers beginning with "3NG" AND customerNumber 51886,
returns only specified fields, sorted by filing date descending

results = await client.search_patent_applications_get( q='applicationMetaData.docketNumber:3NG* AND applicationMetaData.customerNumber:51886', fields='applicationNumberText,applicationMetaData.inventionTitle,applicationMetaData.patentNumber,applicationMetaData.filingDate,applicationMetaData.docketNumber', sort='applicationMetaData.filingDate desc', limit=50, offset=0 )

Expected response includes:
- count: total number of matching results
- patentFileWrapperDataBag: array of applications with requested fields
- Each application includes: applicationNumberText and applicationMetaData with
inventionTitle, patentNumber, filingDate, and docketNumber fields
Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_patent_applications_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> dict:
    """
    Search for patent applications using query parameters (GET method).

    Endpoint: GET /api/v1/patent/applications/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'applicationNumberText:14412875'
        sort (str, optional): Field to sort by followed by order. Example: 'applicationMetaData.filingDate asc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
                               Example: 'applicationMetaData.applicationTypeCode,applicationMetaData.docketNumber'
        fields (str, optional): Comma-separated list of fields to include in response.
                               Example: 'applicationNumberText,applicationMetaData.patentNumber'
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
                                Example: 'applicationMetaData.applicationTypeCode UTL,DES'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'applicationMetaData.grantDate 2010-01-01:2011-01-01'

    Returns:
        dict: The search results as returned by the USPTO API

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 413, 500)

    Examples:
        # Search by application number
        results = await client.search_patent_applications_get(q='applicationNumberText:14412875')

        # Search with pagination
        results = await client.search_patent_applications_get(q='Utility', limit=50, offset=0)

        # Complex search with sorting and filtering
        results = await client.search_patent_applications_get(
            q='applicationMetaData.inventorBag.inventorNameText:Smith',
            sort='applicationMetaData.filingDate desc',
            filters='applicationMetaData.applicationTypeCode UTL',
            limit=100
        )

        # Complex search by partial docket number and customer number with specific fields
        # This example searches for docket numbers beginning with "3NG" AND customerNumber 51886,
        # returns only specified fields, sorted by filing date descending
        results = await client.search_patent_applications_get(
            q='applicationMetaData.docketNumber:3NG* AND applicationMetaData.customerNumber:51886',
            fields='applicationNumberText,applicationMetaData.inventionTitle,applicationMetaData.patentNumber,applicationMetaData.filingDate,applicationMetaData.docketNumber',
            sort='applicationMetaData.filingDate desc',
            limit=50,
            offset=0
        )
        # Expected response includes:
        # - count: total number of matching results
        # - patentFileWrapperDataBag: array of applications with requested fields
        # - Each application includes: applicationNumberText and applicationMetaData with
        #   inventionTitle, patentNumber, filingDate, and docketNumber fields
    """
    url = self._build_url(self._patent_applications_endpoint, "search")

    # Build query parameters, only including non-None values
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, lambda x: x)  # Return raw JSON response

search_patent_applications_download async

search_patent_applications_download(payload)

Download patent application search results using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/applications/search/download

This endpoint is similar to search_patent_applications but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, etc.

required

Returns:

Name Type Description
PatentDataResponse PatentDataResponse

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 413, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_patent_applications_download(self, payload: dict) -> PatentDataResponse:
    """
    Download patent application search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/applications/search/download

    This endpoint is similar to search_patent_applications but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, etc.

    Returns:
        PatentDataResponse: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 413, 500)
    """
    url = self._build_url(self._patent_applications_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, PatentDataResponse.from_dict)

search_patent_applications_download_get async

search_patent_applications_download_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None, format=None)

Download patent application search results using query parameters (GET method).

Endpoint: GET /api/v1/patent/applications/search/download

This endpoint is similar to search_patent_applications_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'applicationNumberText:14412875'

None
sort str

Field to sort by followed by order. Example: 'applicationMetaData.filingDate asc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet. Example: 'applicationMetaData.applicationTypeCode,applicationMetaData.docketNumber'

None
fields str

Comma-separated list of fields to include in response. Example: 'applicationNumberText,applicationMetaData.patentNumber'

None
filters str

Filter by field value. Format: 'fieldName value1,value2' Example: 'applicationMetaData.applicationTypeCode UTL,DES'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'applicationMetaData.grantDate 2010-01-01:2011-01-01'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
PatentDataResponse PatentDataResponse

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 413, 500)

Examples:

Download search results in JSON format

results = await client.search_patent_applications_download_get(q='applicationNumberText:14412875', format='json')

Download search results in CSV format

results = await client.search_patent_applications_download_get(q='Utility', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_patent_applications_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> PatentDataResponse:
    """
    Download patent application search results using query parameters (GET method).

    Endpoint: GET /api/v1/patent/applications/search/download

    This endpoint is similar to search_patent_applications_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'applicationNumberText:14412875'
        sort (str, optional): Field to sort by followed by order. Example: 'applicationMetaData.filingDate asc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
                               Example: 'applicationMetaData.applicationTypeCode,applicationMetaData.docketNumber'
        fields (str, optional): Comma-separated list of fields to include in response.
                               Example: 'applicationNumberText,applicationMetaData.patentNumber'
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
                                Example: 'applicationMetaData.applicationTypeCode UTL,DES'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'applicationMetaData.grantDate 2010-01-01:2011-01-01'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        PatentDataResponse: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 413, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_patent_applications_download_get(q='applicationNumberText:14412875', format='json')

        # Download search results in CSV format
        results = await client.search_patent_applications_download_get(q='Utility', format='csv', limit=100)
    """
    url = self._build_url(self._patent_applications_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, PatentDataResponse.from_dict)

search_petition_decisions async

search_petition_decisions(payload)

Search petition decisions using a JSON payload (POST method).

Endpoint: POST /api/v1/petition/decisions/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, pagination, etc.

required

Returns:

Name Type Description
PetitionDecisionResponseBag PetitionDecisionResponseBag

The search response containing petition decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_petition_decisions(self, payload: dict) -> PetitionDecisionResponseBag:
    """
    Search petition decisions using a JSON payload (POST method).

    Endpoint: POST /api/v1/petition/decisions/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, pagination, etc.

    Returns:
        PetitionDecisionResponseBag: The search response containing petition decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._petition_decisions_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

search_petition_decisions_get async

search_petition_decisions_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search petition decisions using query parameters (GET method).

Endpoint: GET /api/v1/petition/decisions/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'decisionTypeCodeDescriptionText:Denied'

None
sort str

Field to sort by followed by order. Example: 'petitionMailDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'petitionMailDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
PetitionDecisionResponseBag PetitionDecisionResponseBag

The search response containing petition decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for denied decisions

results = await client.search_petition_decisions_get(q='decisionTypeCodeDescriptionText:Denied')

Search with filters and pagination

results = await client.search_petition_decisions_get( q='Denied', filters='businessEntityStatusCategory Small', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_petition_decisions_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> PetitionDecisionResponseBag:
    """
    Search petition decisions using query parameters (GET method).

    Endpoint: GET /api/v1/petition/decisions/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'decisionTypeCodeDescriptionText:Denied'
        sort (str, optional): Field to sort by followed by order. Example: 'petitionMailDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'petitionMailDate 2021-01-01:2025-01-01'

    Returns:
        PetitionDecisionResponseBag: The search response containing petition decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for denied decisions
        results = await client.search_petition_decisions_get(q='decisionTypeCodeDescriptionText:Denied')

        # Search with filters and pagination
        results = await client.search_petition_decisions_get(
            q='Denied',
            filters='businessEntityStatusCategory Small',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._petition_decisions_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

search_petition_decisions_download async

search_petition_decisions_download(payload)

Download petition decision search results using a JSON payload (POST method).

Endpoint: POST /api/v1/petition/decisions/search/download

This endpoint is similar to search_petition_decisions but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary.

required

Returns:

Name Type Description
PetitionDecisionResponseBag PetitionDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_petition_decisions_download(self, payload: dict) -> PetitionDecisionResponseBag:
    """
    Download petition decision search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/petition/decisions/search/download

    This endpoint is similar to search_petition_decisions but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.

    Returns:
        PetitionDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._petition_decisions_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

search_petition_decisions_download_get async

search_petition_decisions_download_get(q=None, sort=None, offset=None, limit=None, fields=None, filters=None, range_filters=None, format=None)

Download petition decision search results using query parameters (GET method).

Endpoint: GET /api/v1/petition/decisions/search/download

This endpoint is similar to search_petition_decisions_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string.

None
sort str

Field to sort by followed by order.

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
PetitionDecisionResponseBag PetitionDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Download search results in JSON format

results = await client.search_petition_decisions_download_get(q='Denied', format='json')

Download search results in CSV format

results = await client.search_petition_decisions_download_get(q='Denied', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_petition_decisions_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> PetitionDecisionResponseBag:
    """
    Download petition decision search results using query parameters (GET method).

    Endpoint: GET /api/v1/petition/decisions/search/download

    This endpoint is similar to search_petition_decisions_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string.
        sort (str, optional): Field to sort by followed by order.
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        PetitionDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_petition_decisions_download_get(q='Denied', format='json')

        # Download search results in CSV format
        results = await client.search_petition_decisions_download_get(q='Denied', format='csv', limit=100)
    """
    url = self._build_url(self._petition_decisions_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, PetitionDecisionResponseBag.from_dict)

get_petition_decision async

get_petition_decision(petition_decision_record_identifier, include_documents=False)

Retrieve a specific petition decision by its record identifier.

Endpoint: GET /api/v1/petition/decisions/{petitionDecisionRecordIdentifier}

Parameters:

Name Type Description Default
petition_decision_record_identifier str

The petition decision record identifier (UUID format)

required
include_documents bool

Whether to include petition decision documents in the response. Default: False

False

Returns:

Name Type Description
PetitionDecisionIdentifierResponseBag PetitionDecisionIdentifierResponseBag

The petition decision data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get petition decision without documents

decision = await client.get_petition_decision('6779f1be-0f3b-5775-b9d3-dcfdb83171c3')

Get petition decision with documents

decision = await client.get_petition_decision('6779f1be-0f3b-5775-b9d3-dcfdb83171c3', include_documents=True)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_petition_decision(
    self,
    petition_decision_record_identifier: str,
    include_documents: bool = False
) -> PetitionDecisionIdentifierResponseBag:
    """
    Retrieve a specific petition decision by its record identifier.

    Endpoint: GET /api/v1/petition/decisions/{petitionDecisionRecordIdentifier}

    Args:
        petition_decision_record_identifier (str): The petition decision record identifier (UUID format)
        include_documents (bool, optional): Whether to include petition decision documents in the response.
                                           Default: False

    Returns:
        PetitionDecisionIdentifierResponseBag: The petition decision data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get petition decision without documents
        decision = await client.get_petition_decision('6779f1be-0f3b-5775-b9d3-dcfdb83171c3')

        # Get petition decision with documents
        decision = await client.get_petition_decision('6779f1be-0f3b-5775-b9d3-dcfdb83171c3', include_documents=True)
    """
    url = self._build_url(self._petition_decisions_endpoint, petition_decision_record_identifier)
    params = {}
    if include_documents:
        params['includeDocuments'] = 'true'
    else:
        params['includeDocuments'] = 'false'

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, PetitionDecisionIdentifierResponseBag.from_dict)

search_trial_proceedings async

search_trial_proceedings(payload)

Search trial proceedings using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/trials/proceedings/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, pagination, etc.

required

Returns:

Name Type Description
TrialProceedingResponseBag TrialProceedingResponseBag

The search response containing trial proceeding results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_proceedings(self, payload: dict) -> TrialProceedingResponseBag:
    """
    Search trial proceedings using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/trials/proceedings/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, pagination, etc.

    Returns:
        TrialProceedingResponseBag: The search response containing trial proceeding results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_trials_proceedings_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

search_trial_proceedings_get async

search_trial_proceedings_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search trial proceedings using query parameters (GET method).

Endpoint: GET /api/v1/patent/trials/proceedings/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'trialType:IPR'

None
sort str

Field to sort by followed by order. Example: 'filingDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'filingDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
TrialProceedingResponseBag TrialProceedingResponseBag

The search response containing trial proceeding results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for IPR trials

results = await client.search_trial_proceedings_get(q='trialType:IPR')

Search with filters and pagination

results = await client.search_trial_proceedings_get( q='IPR', filters='proceedingStatus Instituted', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_proceedings_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> TrialProceedingResponseBag:
    """
    Search trial proceedings using query parameters (GET method).

    Endpoint: GET /api/v1/patent/trials/proceedings/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'trialType:IPR'
        sort (str, optional): Field to sort by followed by order. Example: 'filingDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'filingDate 2021-01-01:2025-01-01'

    Returns:
        TrialProceedingResponseBag: The search response containing trial proceeding results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for IPR trials
        results = await client.search_trial_proceedings_get(q='trialType:IPR')

        # Search with filters and pagination
        results = await client.search_trial_proceedings_get(
            q='IPR',
            filters='proceedingStatus Instituted',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._ptab_trials_proceedings_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

search_trial_proceedings_download async

search_trial_proceedings_download(payload)

Download trial proceeding search results using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/trials/proceedings/search/download

This endpoint is similar to search_trial_proceedings but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary.

required

Returns:

Name Type Description
TrialProceedingResponseBag TrialProceedingResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_proceedings_download(self, payload: dict) -> TrialProceedingResponseBag:
    """
    Download trial proceeding search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/trials/proceedings/search/download

    This endpoint is similar to search_trial_proceedings but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.

    Returns:
        TrialProceedingResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_trials_proceedings_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

search_trial_proceedings_download_get async

search_trial_proceedings_download_get(q=None, sort=None, offset=None, limit=None, fields=None, filters=None, range_filters=None, format=None)

Download trial proceeding search results using query parameters (GET method).

Endpoint: GET /api/v1/patent/trials/proceedings/search/download

This endpoint is similar to search_trial_proceedings_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string.

None
sort str

Field to sort by followed by order.

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
TrialProceedingResponseBag TrialProceedingResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Download search results in JSON format

results = await client.search_trial_proceedings_download_get(q='IPR', format='json')

Download search results in CSV format

results = await client.search_trial_proceedings_download_get(q='IPR', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_proceedings_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> TrialProceedingResponseBag:
    """
    Download trial proceeding search results using query parameters (GET method).

    Endpoint: GET /api/v1/patent/trials/proceedings/search/download

    This endpoint is similar to search_trial_proceedings_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string.
        sort (str, optional): Field to sort by followed by order.
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        TrialProceedingResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_trial_proceedings_download_get(q='IPR', format='json')

        # Download search results in CSV format
        results = await client.search_trial_proceedings_download_get(q='IPR', format='csv', limit=100)
    """
    url = self._build_url(self._ptab_trials_proceedings_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, TrialProceedingResponseBag.from_dict)

get_trial_proceeding async

get_trial_proceeding(trial_number)

Retrieve a specific trial proceeding by its trial number.

Endpoint: GET /api/v1/patent/trials/proceedings/{trialNumber}

Parameters:

Name Type Description Default
trial_number str

The trial number identifier

required

Returns:

Name Type Description
TrialProceedingIdentifierResponseBag TrialProceedingIdentifierResponseBag

The trial proceeding data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get trial proceeding

proceeding = await client.get_trial_proceeding('IPR2020-00001')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_trial_proceeding(self, trial_number: str) -> TrialProceedingIdentifierResponseBag:
    """
    Retrieve a specific trial proceeding by its trial number.

    Endpoint: GET /api/v1/patent/trials/proceedings/{trialNumber}

    Args:
        trial_number (str): The trial number identifier

    Returns:
        TrialProceedingIdentifierResponseBag: The trial proceeding data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get trial proceeding
        proceeding = await client.get_trial_proceeding('IPR2020-00001')
    """
    url = self._build_url(self._ptab_trials_proceedings_endpoint, trial_number)

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, TrialProceedingIdentifierResponseBag.from_dict)

search_trial_decisions async

search_trial_decisions(payload)

Search trial decisions using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/trials/decisions/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, pagination, etc.

required

Returns:

Name Type Description
TrialDecisionResponseBag TrialDecisionResponseBag

The search response containing trial decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_decisions(self, payload: dict) -> TrialDecisionResponseBag:
    """
    Search trial decisions using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/trials/decisions/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, pagination, etc.

    Returns:
        TrialDecisionResponseBag: The search response containing trial decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_trials_decisions_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

search_trial_decisions_get async

search_trial_decisions_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search trial decisions using query parameters (GET method).

Endpoint: GET /api/v1/patent/trials/decisions/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'trialType:IPR'

None
sort str

Field to sort by followed by order. Example: 'decisionDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'decisionDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
TrialDecisionResponseBag TrialDecisionResponseBag

The search response containing trial decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for IPR trial decisions

results = await client.search_trial_decisions_get(q='IPR')

Search with filters and pagination

results = await client.search_trial_decisions_get( q='IPR', filters='decisionType Final', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_decisions_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> TrialDecisionResponseBag:
    """
    Search trial decisions using query parameters (GET method).

    Endpoint: GET /api/v1/patent/trials/decisions/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'trialType:IPR'
        sort (str, optional): Field to sort by followed by order. Example: 'decisionDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'decisionDate 2021-01-01:2025-01-01'

    Returns:
        TrialDecisionResponseBag: The search response containing trial decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for IPR trial decisions
        results = await client.search_trial_decisions_get(q='IPR')

        # Search with filters and pagination
        results = await client.search_trial_decisions_get(
            q='IPR',
            filters='decisionType Final',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._ptab_trials_decisions_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

search_trial_decisions_download async

search_trial_decisions_download(payload)

Download trial decision search results using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/trials/decisions/search/download

This endpoint is similar to search_trial_decisions but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary.

required

Returns:

Name Type Description
TrialDecisionResponseBag TrialDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_decisions_download(self, payload: dict) -> TrialDecisionResponseBag:
    """
    Download trial decision search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/trials/decisions/search/download

    This endpoint is similar to search_trial_decisions but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.

    Returns:
        TrialDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_trials_decisions_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

search_trial_decisions_download_get async

search_trial_decisions_download_get(q=None, sort=None, offset=None, limit=None, fields=None, filters=None, range_filters=None, format=None)

Download trial decision search results using query parameters (GET method).

Endpoint: GET /api/v1/patent/trials/decisions/search/download

This endpoint is similar to search_trial_decisions_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string.

None
sort str

Field to sort by followed by order.

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
TrialDecisionResponseBag TrialDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Download search results in JSON format

results = await client.search_trial_decisions_download_get(q='IPR', format='json')

Download search results in CSV format

results = await client.search_trial_decisions_download_get(q='IPR', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_decisions_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> TrialDecisionResponseBag:
    """
    Download trial decision search results using query parameters (GET method).

    Endpoint: GET /api/v1/patent/trials/decisions/search/download

    This endpoint is similar to search_trial_decisions_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string.
        sort (str, optional): Field to sort by followed by order.
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        TrialDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_trial_decisions_download_get(q='IPR', format='json')

        # Download search results in CSV format
        results = await client.search_trial_decisions_download_get(q='IPR', format='csv', limit=100)
    """
    url = self._build_url(self._ptab_trials_decisions_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, TrialDecisionResponseBag.from_dict)

get_trial_decision async

get_trial_decision(document_identifier)

Retrieve a specific trial decision by its document identifier.

Endpoint: GET /api/v1/patent/trials/decisions/{documentIdentifier}

Parameters:

Name Type Description Default
document_identifier str

The trial decision document identifier

required

Returns:

Name Type Description
TrialDecisionIdentifierResponseBag TrialDecisionIdentifierResponseBag

The trial decision data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get trial decision by document identifier

decision = await client.get_trial_decision('DOC-12345')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_trial_decision(self, document_identifier: str) -> TrialDecisionIdentifierResponseBag:
    """
    Retrieve a specific trial decision by its document identifier.

    Endpoint: GET /api/v1/patent/trials/decisions/{documentIdentifier}

    Args:
        document_identifier (str): The trial decision document identifier

    Returns:
        TrialDecisionIdentifierResponseBag: The trial decision data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get trial decision by document identifier
        decision = await client.get_trial_decision('DOC-12345')
    """
    url = self._build_url(self._ptab_trials_decisions_endpoint, document_identifier)

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, TrialDecisionIdentifierResponseBag.from_dict)

get_trial_decisions_by_trial async

get_trial_decisions_by_trial(trial_number)

Retrieve all trial decisions for a specific trial number.

Endpoint: GET /api/v1/patent/trials/{trialNumber}/decisions

Parameters:

Name Type Description Default
trial_number str

The trial number identifier (e.g., "IPR2020-00001")

required

Returns:

Name Type Description
TrialDecisionByTrialResponseBag TrialDecisionByTrialResponseBag

The trial decisions data for the specified trial

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get all decisions for a trial

decisions = await client.get_trial_decisions_by_trial('IPR2020-00001')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_trial_decisions_by_trial(self, trial_number: str) -> TrialDecisionByTrialResponseBag:
    """
    Retrieve all trial decisions for a specific trial number.

    Endpoint: GET /api/v1/patent/trials/{trialNumber}/decisions

    Args:
        trial_number (str): The trial number identifier (e.g., "IPR2020-00001")

    Returns:
        TrialDecisionByTrialResponseBag: The trial decisions data for the specified trial

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get all decisions for a trial
        decisions = await client.get_trial_decisions_by_trial('IPR2020-00001')
    """
    # Build URL: /api/v1/patent/trials/{trialNumber}/decisions
    url = self._build_url(
        f"{self.BASE_API_URL}/v1/patent/trials",
        trial_number,
        "decisions"
    )

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, TrialDecisionByTrialResponseBag.from_dict)

search_trial_documents async

search_trial_documents(payload)

Search trial documents using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/trials/documents/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, pagination, etc.

required

Returns:

Name Type Description
TrialDocumentResponseBag TrialDocumentResponseBag

The search response containing trial document results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_documents(self, payload: dict) -> TrialDocumentResponseBag:
    """
    Search trial documents using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/trials/documents/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, pagination, etc.

    Returns:
        TrialDocumentResponseBag: The search response containing trial document results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_trials_documents_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

search_trial_documents_get async

search_trial_documents_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search trial documents using query parameters (GET method).

Endpoint: GET /api/v1/patent/trials/documents/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'trialType:IPR'

None
sort str

Field to sort by followed by order. Example: 'documentDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'documentDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
TrialDocumentResponseBag TrialDocumentResponseBag

The search response containing trial document results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for IPR trial documents

results = await client.search_trial_documents_get(q='IPR')

Search with filters and pagination

results = await client.search_trial_documents_get( q='IPR', filters='documentType Petition', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_documents_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> TrialDocumentResponseBag:
    """
    Search trial documents using query parameters (GET method).

    Endpoint: GET /api/v1/patent/trials/documents/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'trialType:IPR'
        sort (str, optional): Field to sort by followed by order. Example: 'documentDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'documentDate 2021-01-01:2025-01-01'

    Returns:
        TrialDocumentResponseBag: The search response containing trial document results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for IPR trial documents
        results = await client.search_trial_documents_get(q='IPR')

        # Search with filters and pagination
        results = await client.search_trial_documents_get(
            q='IPR',
            filters='documentType Petition',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._ptab_trials_documents_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

search_trial_documents_download async

search_trial_documents_download(payload)

Download trial document search results using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/trials/documents/search/download

This endpoint is similar to search_trial_documents but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary.

required

Returns:

Name Type Description
TrialDocumentResponseBag TrialDocumentResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_documents_download(self, payload: dict) -> TrialDocumentResponseBag:
    """
    Download trial document search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/trials/documents/search/download

    This endpoint is similar to search_trial_documents but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.

    Returns:
        TrialDocumentResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_trials_documents_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

search_trial_documents_download_get async

search_trial_documents_download_get(q=None, sort=None, offset=None, limit=None, fields=None, filters=None, range_filters=None, format=None)

Download trial document search results using query parameters (GET method).

Endpoint: GET /api/v1/patent/trials/documents/search/download

This endpoint is similar to search_trial_documents_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string.

None
sort str

Field to sort by followed by order.

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
TrialDocumentResponseBag TrialDocumentResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Download search results in JSON format

results = await client.search_trial_documents_download_get(q='IPR', format='json')

Download search results in CSV format

results = await client.search_trial_documents_download_get(q='IPR', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_trial_documents_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> TrialDocumentResponseBag:
    """
    Download trial document search results using query parameters (GET method).

    Endpoint: GET /api/v1/patent/trials/documents/search/download

    This endpoint is similar to search_trial_documents_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string.
        sort (str, optional): Field to sort by followed by order.
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        TrialDocumentResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_trial_documents_download_get(q='IPR', format='json')

        # Download search results in CSV format
        results = await client.search_trial_documents_download_get(q='IPR', format='csv', limit=100)
    """
    url = self._build_url(self._ptab_trials_documents_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, TrialDocumentResponseBag.from_dict)

get_trial_document async

get_trial_document(document_identifier)

Retrieve a specific trial document by its document identifier.

Endpoint: GET /api/v1/patent/trials/documents/{documentIdentifier}

Parameters:

Name Type Description Default
document_identifier str

The trial document identifier

required

Returns:

Name Type Description
TrialDocumentIdentifierResponseBag TrialDocumentIdentifierResponseBag

The trial document data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get trial document by document identifier

document = await client.get_trial_document('DOC-12345')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_trial_document(self, document_identifier: str) -> TrialDocumentIdentifierResponseBag:
    """
    Retrieve a specific trial document by its document identifier.

    Endpoint: GET /api/v1/patent/trials/documents/{documentIdentifier}

    Args:
        document_identifier (str): The trial document identifier

    Returns:
        TrialDocumentIdentifierResponseBag: The trial document data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get trial document by document identifier
        document = await client.get_trial_document('DOC-12345')
    """
    url = self._build_url(self._ptab_trials_documents_endpoint, document_identifier)

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, TrialDocumentIdentifierResponseBag.from_dict)

get_trial_documents_by_trial async

get_trial_documents_by_trial(trial_number)

Retrieve all trial documents for a specific trial number.

Endpoint: GET /api/v1/patent/trials/{trialNumber}/documents

Parameters:

Name Type Description Default
trial_number str

The trial number identifier (e.g., "IPR2020-00001")

required

Returns:

Name Type Description
TrialDocumentByTrialResponseBag TrialDocumentByTrialResponseBag

The trial documents data for the specified trial

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get all documents for a trial

documents = await client.get_trial_documents_by_trial('IPR2020-00001')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_trial_documents_by_trial(self, trial_number: str) -> TrialDocumentByTrialResponseBag:
    """
    Retrieve all trial documents for a specific trial number.

    Endpoint: GET /api/v1/patent/trials/{trialNumber}/documents

    Args:
        trial_number (str): The trial number identifier (e.g., "IPR2020-00001")

    Returns:
        TrialDocumentByTrialResponseBag: The trial documents data for the specified trial

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get all documents for a trial
        documents = await client.get_trial_documents_by_trial('IPR2020-00001')
    """
    # Build URL: /api/v1/patent/trials/{trialNumber}/documents
    url = self._build_url(
        f"{self.BASE_API_URL}/v1/patent/trials",
        trial_number,
        "documents"
    )

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, TrialDocumentByTrialResponseBag.from_dict)

search_appeal_decisions async

search_appeal_decisions(payload)

Search appeal decisions using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/appeals/decisions/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, pagination, etc.

required

Returns:

Name Type Description
AppealDecisionResponseBag AppealDecisionResponseBag

The search response containing appeal decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_appeal_decisions(self, payload: dict) -> AppealDecisionResponseBag:
    """
    Search appeal decisions using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/appeals/decisions/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, pagination, etc.

    Returns:
        AppealDecisionResponseBag: The search response containing appeal decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_appeals_decisions_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

search_appeal_decisions_get async

search_appeal_decisions_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search appeal decisions using query parameters (GET method).

Endpoint: GET /api/v1/patent/appeals/decisions/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'decisionType:Final'

None
sort str

Field to sort by followed by order. Example: 'decisionDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'decisionDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
AppealDecisionResponseBag AppealDecisionResponseBag

The search response containing appeal decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for appeal decisions

results = await client.search_appeal_decisions_get(q='Final')

Search with filters and pagination

results = await client.search_appeal_decisions_get( q='Final', filters='decisionType Final', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_appeal_decisions_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> AppealDecisionResponseBag:
    """
    Search appeal decisions using query parameters (GET method).

    Endpoint: GET /api/v1/patent/appeals/decisions/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'decisionType:Final'
        sort (str, optional): Field to sort by followed by order. Example: 'decisionDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'decisionDate 2021-01-01:2025-01-01'

    Returns:
        AppealDecisionResponseBag: The search response containing appeal decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for appeal decisions
        results = await client.search_appeal_decisions_get(q='Final')

        # Search with filters and pagination
        results = await client.search_appeal_decisions_get(
            q='Final',
            filters='decisionType Final',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._ptab_appeals_decisions_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

search_appeal_decisions_download async

search_appeal_decisions_download(payload)

Download appeal decision search results using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/appeals/decisions/search/download

This endpoint is similar to search_appeal_decisions but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary.

required

Returns:

Name Type Description
AppealDecisionResponseBag AppealDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_appeal_decisions_download(self, payload: dict) -> AppealDecisionResponseBag:
    """
    Download appeal decision search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/appeals/decisions/search/download

    This endpoint is similar to search_appeal_decisions but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.

    Returns:
        AppealDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_appeals_decisions_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

search_appeal_decisions_download_get async

search_appeal_decisions_download_get(q=None, sort=None, offset=None, limit=None, fields=None, filters=None, range_filters=None, format=None)

Download appeal decision search results using query parameters (GET method).

Endpoint: GET /api/v1/patent/appeals/decisions/search/download

This endpoint is similar to search_appeal_decisions_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string.

None
sort str

Field to sort by followed by order.

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
AppealDecisionResponseBag AppealDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Download search results in JSON format

results = await client.search_appeal_decisions_download_get(q='Final', format='json')

Download search results in CSV format

results = await client.search_appeal_decisions_download_get(q='Final', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_appeal_decisions_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> AppealDecisionResponseBag:
    """
    Download appeal decision search results using query parameters (GET method).

    Endpoint: GET /api/v1/patent/appeals/decisions/search/download

    This endpoint is similar to search_appeal_decisions_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string.
        sort (str, optional): Field to sort by followed by order.
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        AppealDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_appeal_decisions_download_get(q='Final', format='json')

        # Download search results in CSV format
        results = await client.search_appeal_decisions_download_get(q='Final', format='csv', limit=100)
    """
    url = self._build_url(self._ptab_appeals_decisions_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, AppealDecisionResponseBag.from_dict)

get_appeal_decision async

get_appeal_decision(document_identifier)

Retrieve a specific appeal decision by its document identifier.

Endpoint: GET /api/v1/patent/appeals/decisions/{documentIdentifier}

Parameters:

Name Type Description Default
document_identifier str

The appeal decision document identifier

required

Returns:

Name Type Description
AppealDecisionIdentifierResponseBag AppealDecisionIdentifierResponseBag

The appeal decision data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get appeal decision by document identifier

decision = await client.get_appeal_decision('DOC-12345')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_appeal_decision(self, document_identifier: str) -> AppealDecisionIdentifierResponseBag:
    """
    Retrieve a specific appeal decision by its document identifier.

    Endpoint: GET /api/v1/patent/appeals/decisions/{documentIdentifier}

    Args:
        document_identifier (str): The appeal decision document identifier

    Returns:
        AppealDecisionIdentifierResponseBag: The appeal decision data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get appeal decision by document identifier
        decision = await client.get_appeal_decision('DOC-12345')
    """
    url = self._build_url(self._ptab_appeals_decisions_endpoint, document_identifier)

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, AppealDecisionIdentifierResponseBag.from_dict)

get_appeal_decisions_by_appeal async

get_appeal_decisions_by_appeal(appeal_number)

Retrieve all appeal decisions for a specific appeal number.

Endpoint: GET /api/v1/patent/appeals/{appealNumber}/decisions

Parameters:

Name Type Description Default
appeal_number str

The appeal number identifier (e.g., "2020-001234")

required

Returns:

Name Type Description
AppealDecisionByAppealResponseBag AppealDecisionByAppealResponseBag

The appeal decisions data for the specified appeal

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get all decisions for an appeal

decisions = await client.get_appeal_decisions_by_appeal('2020-001234')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_appeal_decisions_by_appeal(self, appeal_number: str) -> AppealDecisionByAppealResponseBag:
    """
    Retrieve all appeal decisions for a specific appeal number.

    Endpoint: GET /api/v1/patent/appeals/{appealNumber}/decisions

    Args:
        appeal_number (str): The appeal number identifier (e.g., "2020-001234")

    Returns:
        AppealDecisionByAppealResponseBag: The appeal decisions data for the specified appeal

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get all decisions for an appeal
        decisions = await client.get_appeal_decisions_by_appeal('2020-001234')
    """
    # Build URL: /api/v1/patent/appeals/{appealNumber}/decisions
    url = self._build_url(
        f"{self.BASE_API_URL}/v1/patent/appeals",
        appeal_number,
        "decisions"
    )

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, AppealDecisionByAppealResponseBag.from_dict)

search_interference_decisions async

search_interference_decisions(payload)

Search interference decisions using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/interferences/decisions/search

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, sort options, filters, pagination, etc.

required

Returns:

Name Type Description
InterferenceDecisionResponseBag InterferenceDecisionResponseBag

The search response containing interference decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_interference_decisions(self, payload: dict) -> InterferenceDecisionResponseBag:
    """
    Search interference decisions using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/interferences/decisions/search

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, sort options, filters, pagination, etc.

    Returns:
        InterferenceDecisionResponseBag: The search response containing interference decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_interferences_decisions_endpoint, "search")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

search_interference_decisions_get async

search_interference_decisions_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search interference decisions using query parameters (GET method).

Endpoint: GET /api/v1/patent/interferences/decisions/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'decisionType:Final'

None
sort str

Field to sort by followed by order. Example: 'decisionDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'decisionDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
InterferenceDecisionResponseBag InterferenceDecisionResponseBag

The search response containing interference decision results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for interference decisions

results = await client.search_interference_decisions_get(q='Final')

Search with filters and pagination

results = await client.search_interference_decisions_get( q='Final', filters='decisionType Final', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_interference_decisions_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> InterferenceDecisionResponseBag:
    """
    Search interference decisions using query parameters (GET method).

    Endpoint: GET /api/v1/patent/interferences/decisions/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'decisionType:Final'
        sort (str, optional): Field to sort by followed by order. Example: 'decisionDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'decisionDate 2021-01-01:2025-01-01'

    Returns:
        InterferenceDecisionResponseBag: The search response containing interference decision results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for interference decisions
        results = await client.search_interference_decisions_get(q='Final')

        # Search with filters and pagination
        results = await client.search_interference_decisions_get(
            q='Final',
            filters='decisionType Final',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._ptab_interferences_decisions_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

search_interference_decisions_download async

search_interference_decisions_download(payload)

Download interference decision search results using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/interferences/decisions/search/download

This endpoint is similar to search_interference_decisions but optimized for downloads.

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary.

required

Returns:

Name Type Description
InterferenceDecisionResponseBag InterferenceDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_interference_decisions_download(self, payload: dict) -> InterferenceDecisionResponseBag:
    """
    Download interference decision search results using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/interferences/decisions/search/download

    This endpoint is similar to search_interference_decisions but optimized for downloads.

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.

    Returns:
        InterferenceDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)
    """
    url = self._build_url(self._ptab_interferences_decisions_endpoint, "search", "download")
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

search_interference_decisions_download_get async

search_interference_decisions_download_get(q=None, sort=None, offset=None, limit=None, fields=None, filters=None, range_filters=None, format=None)

Download interference decision search results using query parameters (GET method).

Endpoint: GET /api/v1/patent/interferences/decisions/search/download

This endpoint is similar to search_interference_decisions_get but optimized for downloads. Supports a format parameter for download format (json or csv).

Parameters:

Name Type Description Default
q str

Search query string.

None
sort str

Field to sort by followed by order.

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max'

None
format str

Download format. Options: 'json' or 'csv'. Default: 'json'

None

Returns:

Name Type Description
InterferenceDecisionResponseBag InterferenceDecisionResponseBag

The download response containing search results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Download search results in JSON format

results = await client.search_interference_decisions_download_get(q='Final', format='json')

Download search results in CSV format

results = await client.search_interference_decisions_download_get(q='Final', format='csv', limit=100)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_interference_decisions_download_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None,
    format: Optional[str] = None
) -> InterferenceDecisionResponseBag:
    """
    Download interference decision search results using query parameters (GET method).

    Endpoint: GET /api/v1/patent/interferences/decisions/search/download

    This endpoint is similar to search_interference_decisions_get but optimized for downloads.
    Supports a format parameter for download format (json or csv).

    Args:
        q (str, optional): Search query string.
        sort (str, optional): Field to sort by followed by order.
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
        format (str, optional): Download format. Options: 'json' or 'csv'. Default: 'json'

    Returns:
        InterferenceDecisionResponseBag: The download response containing search results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Download search results in JSON format
        results = await client.search_interference_decisions_download_get(q='Final', format='json')

        # Download search results in CSV format
        results = await client.search_interference_decisions_download_get(q='Final', format='csv', limit=100)
    """
    url = self._build_url(self._ptab_interferences_decisions_endpoint, "search", "download")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters
    if format is not None:
        params['format'] = format

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, InterferenceDecisionResponseBag.from_dict)

get_interference_decision async

get_interference_decision(document_identifier)

Retrieve a specific interference decision by its document identifier.

Endpoint: GET /api/v1/patent/interferences/decisions/{documentIdentifier}

Parameters:

Name Type Description Default
document_identifier str

The interference decision document identifier

required

Returns:

Name Type Description
InterferenceDecisionIdentifierResponseBag InterferenceDecisionIdentifierResponseBag

The interference decision data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get interference decision by document identifier

decision = await client.get_interference_decision('DOC-12345')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_interference_decision(self, document_identifier: str) -> InterferenceDecisionIdentifierResponseBag:
    """
    Retrieve a specific interference decision by its document identifier.

    Endpoint: GET /api/v1/patent/interferences/decisions/{documentIdentifier}

    Args:
        document_identifier (str): The interference decision document identifier

    Returns:
        InterferenceDecisionIdentifierResponseBag: The interference decision data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get interference decision by document identifier
        decision = await client.get_interference_decision('DOC-12345')
    """
    url = self._build_url(self._ptab_interferences_decisions_endpoint, document_identifier)

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, InterferenceDecisionIdentifierResponseBag.from_dict)

get_interference_decisions_by_interference async

get_interference_decisions_by_interference(interference_number)

Retrieve all interference decisions for a specific interference number.

Endpoint: GET /api/v1/patent/interferences/{interferenceNumber}/decisions

Parameters:

Name Type Description Default
interference_number str

The interference number identifier (e.g., "106,001")

required

Returns:

Name Type Description
InterferenceDecisionByInterferenceResponseBag InterferenceDecisionByInterferenceResponseBag

The interference decisions data for the specified interference

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get all decisions for an interference

decisions = await client.get_interference_decisions_by_interference('106,001')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_interference_decisions_by_interference(self, interference_number: str) -> InterferenceDecisionByInterferenceResponseBag:
    """
    Retrieve all interference decisions for a specific interference number.

    Endpoint: GET /api/v1/patent/interferences/{interferenceNumber}/decisions

    Args:
        interference_number (str): The interference number identifier (e.g., "106,001")

    Returns:
        InterferenceDecisionByInterferenceResponseBag: The interference decisions data for the specified interference

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get all decisions for an interference
        decisions = await client.get_interference_decisions_by_interference('106,001')
    """
    # Build URL: /api/v1/patent/interferences/{interferenceNumber}/decisions
    url = self._build_url(
        f"{self.BASE_API_URL}/v1/patent/interferences",
        interference_number,
        "decisions"
    )

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, InterferenceDecisionByInterferenceResponseBag.from_dict)

search_dataset_products_get async

search_dataset_products_get(q=None, sort=None, offset=None, limit=None, facets=None, fields=None, filters=None, range_filters=None)

Search dataset products using query parameters (GET method).

Endpoint: GET /api/v1/datasets/products/search

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'productType:Patent'

None
sort str

Field to sort by followed by order. Example: 'releaseDate desc'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None
facets str

Comma-separated list of fields to facet.

None
fields str

Comma-separated list of fields to include in response.

None
filters str

Filter by field value. Format: 'fieldName value1,value2'

None
range_filters str

Filter by range. Format: 'fieldName min:max' Example: 'releaseDate 2021-01-01:2025-01-01'

None

Returns:

Name Type Description
DatasetProductSearchResponseBag DatasetProductSearchResponseBag

The search response containing dataset product results

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search for dataset products

results = await client.search_dataset_products_get(q='Patent')

Search with filters and pagination

results = await client.search_dataset_products_get( q='Patent', filters='productType Patent', limit=50, offset=0 )

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_dataset_products_get(
    self,
    q: Optional[str] = None,
    sort: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    facets: Optional[str] = None,
    fields: Optional[str] = None,
    filters: Optional[str] = None,
    range_filters: Optional[str] = None
) -> DatasetProductSearchResponseBag:
    """
    Search dataset products using query parameters (GET method).

    Endpoint: GET /api/v1/datasets/products/search

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). Example: 'productType:Patent'
        sort (str, optional): Field to sort by followed by order. Example: 'releaseDate desc'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25
        facets (str, optional): Comma-separated list of fields to facet.
        fields (str, optional): Comma-separated list of fields to include in response.
        filters (str, optional): Filter by field value. Format: 'fieldName value1,value2'
        range_filters (str, optional): Filter by range. Format: 'fieldName min:max'
                                      Example: 'releaseDate 2021-01-01:2025-01-01'

    Returns:
        DatasetProductSearchResponseBag: The search response containing dataset product results

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search for dataset products
        results = await client.search_dataset_products_get(q='Patent')

        # Search with filters and pagination
        results = await client.search_dataset_products_get(
            q='Patent',
            filters='productType Patent',
            limit=50,
            offset=0
        )
    """
    url = self._build_url(self._bulk_datasets_endpoint, "search")
    params = {}
    if q is not None:
        params['q'] = q
    if sort is not None:
        params['sort'] = sort
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if facets is not None:
        params['facets'] = facets
    if fields is not None:
        params['fields'] = fields
    if filters is not None:
        params['filters'] = filters
    if range_filters is not None:
        params['rangeFilters'] = range_filters

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, DatasetProductSearchResponseBag.from_dict)

get_dataset_product async

get_dataset_product(product_identifier, file_data_from_date=None, file_data_to_date=None, offset=None, limit=None, include_files=None, latest=None)

Retrieve a specific dataset product by its product identifier.

Endpoint: GET /api/v1/datasets/products/{productIdentifier}

Parameters:

Name Type Description Default
product_identifier str

The dataset product identifier

required
file_data_from_date str

Filter product files by date from. Format: 'yyyy-MM-dd' (e.g., '2023-01-01')

None
file_data_to_date str

Filter product files by date to. Format: 'yyyy-MM-dd' (e.g., '2023-12-31')

None
offset int

Number of product file records to skip. Default: 0

None
limit int

Number of product file records to collect

None
include_files str

Set to 'true' to include product files in response, 'false' to omit them. Default: None (API default behavior)

None
latest str

Set to 'true' to return only the latest product file, 'false' otherwise. Default: None (API default behavior)

None

Returns:

Name Type Description
DatasetProductResponseBag DatasetProductResponseBag

The dataset product data

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get dataset product by product identifier

product = await client.get_dataset_product('product-12345')

Get product with date range filter

product = await client.get_dataset_product( 'product-12345', file_data_from_date='2023-01-01', file_data_to_date='2023-12-31' )

Get product with latest file only

product = await client.get_dataset_product('product-12345', latest='true')

Get product without files included

product = await client.get_dataset_product('product-12345', include_files='false')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_dataset_product(
    self,
    product_identifier: str,
    file_data_from_date: Optional[str] = None,
    file_data_to_date: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None,
    include_files: Optional[str] = None,
    latest: Optional[str] = None
) -> DatasetProductResponseBag:
    """
    Retrieve a specific dataset product by its product identifier.

    Endpoint: GET /api/v1/datasets/products/{productIdentifier}

    Args:
        product_identifier (str): The dataset product identifier
        file_data_from_date (str, optional): Filter product files by date from.
                                            Format: 'yyyy-MM-dd' (e.g., '2023-01-01')
        file_data_to_date (str, optional): Filter product files by date to.
                                          Format: 'yyyy-MM-dd' (e.g., '2023-12-31')
        offset (int, optional): Number of product file records to skip. Default: 0
        limit (int, optional): Number of product file records to collect
        include_files (str, optional): Set to 'true' to include product files in response,
                                      'false' to omit them. Default: None (API default behavior)
        latest (str, optional): Set to 'true' to return only the latest product file,
                               'false' otherwise. Default: None (API default behavior)

    Returns:
        DatasetProductResponseBag: The dataset product data

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get dataset product by product identifier
        product = await client.get_dataset_product('product-12345')

        # Get product with date range filter
        product = await client.get_dataset_product(
            'product-12345',
            file_data_from_date='2023-01-01',
            file_data_to_date='2023-12-31'
        )

        # Get product with latest file only
        product = await client.get_dataset_product('product-12345', latest='true')

        # Get product without files included
        product = await client.get_dataset_product('product-12345', include_files='false')
    """
    url = self._build_url(self._bulk_datasets_endpoint, product_identifier)
    params = {}

    if file_data_from_date is not None:
        params['fileDataFromDate'] = file_data_from_date
    if file_data_to_date is not None:
        params['fileDataToDate'] = file_data_to_date
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit
    if include_files is not None:
        params['includeFiles'] = include_files
    if latest is not None:
        params['latest'] = latest

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, DatasetProductResponseBag.from_dict)

get_dataset_file async

get_dataset_file(product_identifier, file_name)

Retrieve a specific dataset file by product identifier and file name.

Endpoint: GET /api/v1/datasets/products/files/{productIdentifier}/{fileName}

Parameters:

Name Type Description Default
product_identifier str

The dataset product identifier

required
file_name str

The file name within the product

required

Returns:

Name Type Description
DatasetFileResponseBag DatasetFileResponseBag

The dataset file data (may contain download URL or metadata)

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Get dataset file by product identifier and file name

file_info = await client.get_dataset_file('product-12345', 'data.csv')

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_dataset_file(self, product_identifier: str, file_name: str) -> DatasetFileResponseBag:
    """
    Retrieve a specific dataset file by product identifier and file name.

    Endpoint: GET /api/v1/datasets/products/files/{productIdentifier}/{fileName}

    Args:
        product_identifier (str): The dataset product identifier
        file_name (str): The file name within the product

    Returns:
        DatasetFileResponseBag: The dataset file data (may contain download URL or metadata)

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Get dataset file by product identifier and file name
        file_info = await client.get_dataset_file('product-12345', 'data.csv')
    """
    url = self._build_url(self._bulk_datasets_endpoint, "files", product_identifier, file_name)

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, DatasetFileResponseBag.from_dict)

get_app_metadata async

get_app_metadata(application_number)

Get application metadata directly from the /meta-data endpoint using an application number.

This is the direct implementation of the /api/v1/patent/applications/{applicationNumberText}/meta-data endpoint.

Parameters:

Name Type Description Default
application_number str

The application number (e.g., "14412875" or "14/412,875")

required

Returns:

Name Type Description
ApplicationMetadataResponse ApplicationMetadataResponse

The application metadata response containing application number and metadata

Raises:

Type Description
USPTOError

If the API request fails (e.g., 404 if application not found)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_app_metadata(self, application_number: str) -> ApplicationMetadataResponse:
    """
    Get application metadata directly from the /meta-data endpoint using an application number.

    This is the direct implementation of the /api/v1/patent/applications/{applicationNumberText}/meta-data endpoint.

    Args:
        application_number (str): The application number (e.g., "14412875" or "14/412,875")

    Returns:
        ApplicationMetadataResponse: The application metadata response containing application number and metadata

    Raises:
        USPTOError: If the API request fails (e.g., 404 if application not found)
    """
    # Build URL for the meta-data endpoint: /api/v1/patent/applications/{applicationNumberText}/meta-data
    url = self._build_url(self._patent_applications_endpoint, application_number, "meta-data")

    async with self.session.get(url, headers=self.headers) as response:
        return await self._handle_response(response, ApplicationMetadataResponse.from_dict)

get_app_metadata_from_patent_number async

get_app_metadata_from_patent_number(patent_number)

Get the application metadata associated with a patent number.

This method searches for the application number using the patent number, then calls the direct meta-data endpoint. This is a convenience method for users who have a patent number but need the application metadata.

Parameters:

Name Type Description Default
patent_number str

The patent number to search for (e.g., "US9,022,434" or "9022434")

required

Returns:

Type Description
Optional[ApplicationMetadataResponse]

Optional[ApplicationMetadataResponse]: The application metadata if found, None otherwise

Raises:

Type Description
USPTOError

If the API request fails

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def get_app_metadata_from_patent_number(self, patent_number: str) -> Optional[ApplicationMetadataResponse]:
    """
    Get the application metadata associated with a patent number.

    This method searches for the application number using the patent number, then calls
    the direct meta-data endpoint. This is a convenience method for users who have a patent
    number but need the application metadata.

    Args:
        patent_number (str): The patent number to search for (e.g., "US9,022,434" or "9022434")

    Returns:
        Optional[ApplicationMetadataResponse]: The application metadata if found, None otherwise

    Raises:
        USPTOError: If the API request fails
    """
    # Sanitize the patent number by removing "US" prefix and any non-digit characters
    sanitized_patent = ''.join(c for c in patent_number if c.isdigit())

    # Create the search payload to find the application number from the patent number
    payload = {
        "q" : "applicationMetaData.patentNumber:" + sanitized_patent,
        "filters": [
            {
                "name": "applicationMetaData.applicationTypeLabelName",
                "value": ["Utility"]
            },
            {
                "name": "applicationMetaData.publicationCategoryBag",
                "value": ["Granted/Issued"]
            }
        ],
        "sort": [
            {
                "field": "applicationMetaData.filingDate",
                "order": "desc"
            }
        ],
        "pagination": {
            "offset": 0,
            "limit": 25
        },
        "fields": ["applicationNumberText", "applicationMetaData"],
        "facets": [
            "applicationMetaData.applicationTypeLabelName"
        ]        
    }

    # Make the search request to find the application number
    response = await self.search_patent_applications(payload)

    # Check if we got results
    if response.get('count', 0) > 0 and 'patentFileWrapperDataBag' in response:
        # Extract the application number from the first result
        application_number = response['patentFileWrapperDataBag'][0].get('applicationNumberText')

        if application_number:
            # Use the direct meta-data endpoint with the found application number
            return await self.get_app_metadata(application_number)

    return None

search_status_codes_get async

search_status_codes_get(q=None, offset=None, limit=None)

Search for patent application status codes using query parameters (GET method).

Endpoint: GET /api/v1/patent/status-codes

Parameters:

Name Type Description Default
q str

Search query string. Accepts boolean operators (AND, OR, NOT), wildcards (*), and exact phrases (""). Example: 'applicationStatusDescriptionText:Preexam'

None
offset int

Position in dataset to start from. Default: 0

None
limit int

Number of results to return. Default: 25

None

Returns:

Name Type Description
StatusCodeCollection StatusCodeCollection

Collection of status codes matching the search criteria

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Examples:

Search by status description

result = await client.search_status_codes_get(q='applicationStatusDescriptionText:Preexam')

Search with comparison operator

result = await client.search_status_codes_get(q='applicationStatusCode:>100', limit=50)

Search with pagination

result = await client.search_status_codes_get(q='Application AND Preexam', limit=10, offset=0)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_status_codes_get(
    self,
    q: Optional[str] = None,
    offset: Optional[int] = None,
    limit: Optional[int] = None
) -> StatusCodeCollection:
    """
    Search for patent application status codes using query parameters (GET method).

    Endpoint: GET /api/v1/patent/status-codes

    Args:
        q (str, optional): Search query string. Accepts boolean operators (AND, OR, NOT),
                          wildcards (*), and exact phrases (""). 
                          Example: 'applicationStatusDescriptionText:Preexam'
        offset (int, optional): Position in dataset to start from. Default: 0
        limit (int, optional): Number of results to return. Default: 25

    Returns:
        StatusCodeCollection: Collection of status codes matching the search criteria

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Examples:
        # Search by status description
        result = await client.search_status_codes_get(q='applicationStatusDescriptionText:Preexam')

        # Search with comparison operator
        result = await client.search_status_codes_get(q='applicationStatusCode:>100', limit=50)

        # Search with pagination
        result = await client.search_status_codes_get(q='Application AND Preexam', limit=10, offset=0)
    """
    url = self._build_url(self._status_codes_endpoint)

    # Build query parameters, only including non-None values
    params = {}
    if q is not None:
        params['q'] = q
    if offset is not None:
        params['offset'] = offset
    if limit is not None:
        params['limit'] = limit

    async with self.session.get(url, params=params, headers=self.headers) as response:
        return await self._handle_response(response, StatusCodeCollection.from_dict)

search_status_codes async

search_status_codes(payload)

Search for patent application status codes using a JSON payload (POST method).

Endpoint: POST /api/v1/patent/status-codes

Parameters:

Name Type Description Default
payload dict

The search criteria as a JSON-compatible dictionary. Can include fields like query text, pagination, etc. All fields in the request are optional.

required

Returns:

Name Type Description
StatusCodeCollection StatusCodeCollection

Collection of status codes matching the search criteria

Raises:

Type Description
USPTOError

If the API request fails (400, 403, 404, 500)

Example

payload = { "q": "applicationStatusCode:>100", "pagination": { "offset": 0, "limit": 25 } } result = await client.search_status_codes(payload)

Source code in src/uspto_odp/controller/uspto_odp_client.py
async def search_status_codes(self, payload: dict) -> StatusCodeCollection:
    """
    Search for patent application status codes using a JSON payload (POST method).

    Endpoint: POST /api/v1/patent/status-codes

    Args:
        payload (dict): The search criteria as a JSON-compatible dictionary.
                       Can include fields like query text, pagination, etc.
                       All fields in the request are optional.

    Returns:
        StatusCodeCollection: Collection of status codes matching the search criteria

    Raises:
        USPTOError: If the API request fails (400, 403, 404, 500)

    Example:
        payload = {
            "q": "applicationStatusCode:>100",
            "pagination": {
                "offset": 0,
                "limit": 25
            }
        }
        result = await client.search_status_codes(payload)
    """
    url = self._build_url(self._status_codes_endpoint)
    async with self.session.post(url, json=payload, headers=self.headers) as response:
        return await self._handle_response(response, StatusCodeCollection.from_dict)

USPTOError

Custom exception class for USPTO API errors.

uspto_odp.controller.uspto_odp_client.USPTOError

Bases: Exception

Exception for USPTO API errors.

Source code in src/uspto_odp/controller/uspto_odp_client.py
class USPTOError(Exception):
    """Exception for USPTO API errors."""
    def __init__(self, code: int, error: str, error_details: Optional[str] = None, request_identifier: Optional[str] = None):
        self.code = code
        self.error = error
        self.error_details = error_details
        self.request_identifier = request_identifier
        super().__init__(f"{code}: {error} - {error_details or 'No details provided'}")

    @classmethod
    def from_dict(cls, data: dict, status_code: int) -> 'USPTOError':
        default_messages = {
            400: "Bad Request",
            403: "Forbidden",
            404: "Not Found",
            500: "Internal Server Error"
        }
        return cls(
            code=data.get('code', status_code),
            error=data.get('error', default_messages.get(status_code, "Unknown Error")),
            error_details=data.get('errorDetails') or data.get('errorDetailed'),
            request_identifier=data.get('requestIdentifier')
        )