openapi-to-rust 0.1.13

Generate strongly-typed Rust structs, HTTP clients, and SSE streaming clients from OpenAPI 3.1 specifications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
openapi: 3.0.3
info:
  title: API
  version: '1.0'
servers:
  - url: https://api.writer.com
security:
  - bearerAuth: []
x-mint:
  mcp:
    enabled: true
paths:
  /v1/chat:
    post:
      security:
        - bearerAuth: []
      tags:
        - Generation API
      summary: Chat completion
      description: >-
        Generate a chat completion based on the provided messages. The response shown below is for
        non-streaming. To learn about streaming responses, see the [chat completion
        guide](https://dev.writer.com/home/chat-completion).
      operationId: chat
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/chat_request'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/chat_response'
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/chat_completion_chunk'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/chat \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"model":"palmyra-x5","messages":[{"content":"Write a memo summarizing this earnings
            report.","role":"user"}]}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const chat = await client.chat.chat({
                messages: [{ content: 'Write a memo summarizing this earnings report.', role: 'user' }],
                model: 'palmyra-x5',
              });

              console.log(chat.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            chat = client.chat.chat(
                messages=[{
                    "content": "Write a memo summarizing this earnings report.",
                    "role": "user",
                }],
                model="palmyra-x5",
            )
            print(chat.id)
  /v1/completions:
    post:
      security:
        - bearerAuth: []
      tags:
        - Generation API
      summary: Text generation
      description: >-
        Generate text completions using the specified model and prompt. This endpoint is useful for text
        generation tasks that don't require conversational context.
      operationId: completions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/completions_request'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/completions_response'
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/streaming_data'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/completions \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"model":"palmyra-x-003-instruct","prompt":"Write me a short SEO article about camping
            gear","max_tokens":150,"temperature":0.7,"top_p":0.9,"stop":["."],"best_of":1,"random_seed":42,"stream":false}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const completion = await client.completions.create({
                model: 'palmyra-x-003-instruct',
                prompt: 'Write me a short SEO article about camping gear',
              });

              console.log(completion.choices);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            completion = client.completions.create(
                model="palmyra-x-003-instruct",
                prompt="Write me a short SEO article about camping gear",
            )
            print(completion.choices)
  /v1/models:
    get:
      security:
        - bearerAuth: []
      tags:
        - Generation API
      summary: List models
      description: >-
        Retrieve a list of available models that can be used for text generation, chat completions, and other
        AI tasks.
      operationId: models
      x-mint:
        mcp:
          enabled: true
          name: list-models
          description: Get a list of available Writer AI models
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/models \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const model = await client.models.list();

              console.log(model.models);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            model = client.models.list()
            print(model.models)
  /v1/graphs:
    get:
      security:
        - bearerAuth: []
      summary: List graphs
      description: Retrieve a list of Knowledge Graphs.
      tags:
        - KG API
      operationId: findGraphsWithFileStatus
      parameters:
        - name: order
          in: query
          required: false
          schema:
            type: string
            default: desc
            enum:
              - asc
              - desc
          description: Specifies the order of the results. Valid values are asc for ascending and desc for descending.
        - name: before
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            The ID of the first object in the previous page. This parameter instructs the API to return the
            previous page of results.
        - name: after
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            The ID of the last object in the previous page. This parameter instructs the API to return the
            next page of results.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            format: int32
            default: 50
          description: >-
            Specifies the maximum number of objects returned in a page. The default value is 50. The minimum
            value is 1, and the maximum value is 100.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/graphs_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/graphs \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              // Automatically fetches more pages as needed.
              for await (const graph of client.graphs.list()) {
                console.log(graph.id);
              }
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            page = client.graphs.list()
            page = page.data[0]
            print(page.id)
    post:
      security:
        - bearerAuth: []
      summary: Create graph
      description: Create a new Knowledge Graph.
      tags:
        - KG API
      operationId: createGraph
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/graph_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/graph_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/graphs \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"name":"string"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const graph = await client.graphs.create({ name: 'name' });

              console.log(graph.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            graph = client.graphs.create(
                name="name",
            )
            print(graph.id)
  /v1/graphs/question:
    post:
      security:
        - bearerAuth: []
      summary: Question
      description: Ask a question to specified Knowledge Graphs.
      tags:
        - KG API
      operationId: question
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/question_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/question_response'
              example:
                question: What is the generic name for the drug Bavencio?
                answer: avelumab
                sources:
                  - file_id: '1234'
                    snippet: Bavencio is the brand name for avelumab.
            text/event-stream:
              schema:
                $ref: '#/components/schemas/question_response_chunk'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/graphs/question \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"graph_ids":["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],"question":"What is the generic
            name for the drug Bavencio?"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const question = await client.graphs.question({
                graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
                question: 'What is the generic name for the drug Bavencio?'
            });

              console.log(question.answer);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            question = client.graphs.question(
                graph_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
                question="What is the generic name for the drug Bavencio?"
            )
            print(question.answer)
  /v1/graphs/{graph_id}:
    get:
      security:
        - bearerAuth: []
      summary: Retrieve graph
      description: Retrieve a Knowledge Graph.
      tags:
        - KG API
      operationId: findGraphWithFileStatus
      parameters:
        - name: graph_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of the Knowledge Graph.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/graph'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/graphs/{graph_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const graph = await client.graphs.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

              console.log(graph.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            graph = client.graphs.retrieve(
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(graph.id)
    put:
      security:
        - bearerAuth: []
      summary: Update graph
      description: Update the name and description of a Knowledge Graph.
      tags:
        - KG API
      operationId: updateGraph
      parameters:
        - name: graph_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of the Knowledge Graph.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_graph_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/graph_response'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request PUT https://api.writer.com/v1/graphs/{graph_id} \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"name":"string", "description":"string", "urls":[{"url":"https://example.com/docs",
            "type":"sub_pages", "exclude_urls":["https://example.com/docs/private"]}]}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const graph = await client.graphs.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 
                { name: 'name', description: 'description' }
              );

              console.log(graph.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            graph = client.graphs.update(
                graph_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                name="name",
                description="description",
            )
            print(graph.id)
    delete:
      security:
        - bearerAuth: []
      summary: Delete graph
      description: Delete a Knowledge Graph.
      tags:
        - KG API
      operationId: deleteGraph
      parameters:
        - name: graph_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of the Knowledge Graph.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delete_graph_response'
              example:
                id: e7392337-1c4e-4bc9-aaf5-b719bf1e938a
                deleted: true
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request DELETE https://api.writer.com/v1/graphs/{graph_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const graph = await client.graphs.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

              console.log(graph.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            graph = client.graphs.delete(
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(graph.id)
  /v1/graphs/{graph_id}/file:
    post:
      security:
        - bearerAuth: []
      summary: Add file to graph
      description: Add a file to a Knowledge Graph.
      tags:
        - KG API
      operationId: addFileToGraph
      parameters:
        - name: graph_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of the Knowledge Graph.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/graph_file_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/graphs/{graph_id}/file \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"file_id":"string"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const file = await client.graphs.addFileToGraph('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
                file_id: 'file_id',
              });

              console.log(file.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            file = client.graphs.add_file_to_graph(
                graph_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                file_id="file_id",
            )
            print(file.id)
  /v1/graphs/{graph_id}/file/{file_id}:
    delete:
      security:
        - bearerAuth: []
      summary: Remove file from graph
      description: Remove a file from a Knowledge Graph.
      tags:
        - KG API
      operationId: removeFileFromGraph
      parameters:
        - name: graph_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of the Knowledge Graph to which the files belong.
        - name: file_id
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the file.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delete_file_response'
              example:
                id: 7c36a365-392f-43ba-840d-8f3103b42572
                deleted: true
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request DELETE https://api.writer.com/v1/graphs/{graph_id}/file/{file_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.graphs.removeFileFromGraph('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'file_id');

              console.log(response.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.graphs.remove_file_from_graph(
                file_id="file_id",
                graph_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(response.id)
  /v1/files/{file_id}:
    get:
      security:
        - bearerAuth: []
      summary: Retrieve file
      description: >-
        Retrieve detailed information about a specific file, including its metadata, status, and associated
        graphs.
      tags:
        - File API
      operationId: gatewayGetFile
      parameters:
        - name: file_id
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the file.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file_response'
              example:
                id: 7c36a365-392f-43ba-840d-8f3103b42572
                created_at: '2024-07-10T13:34:28.301201Z'
                name: example.pdf
                graph_ids:
                  - 704ffd94-de04-4de2-9f8b-f9fc04831edd
                status: completed
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/files/{file_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const file = await client.files.retrieve('file_id');

              console.log(file.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            file = client.files.retrieve(
                "file_id",
            )
            print(file.id)
    delete:
      security:
        - bearerAuth: []
      summary: Delete file
      description: Permanently delete a file from the system. This action cannot be undone.
      tags:
        - File API
      operationId: gatewayDeleteFile
      parameters:
        - name: file_id
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the file.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delete_file_response'
              example:
                id: 7c36a365-392f-43ba-840d-8f3103b42572
                deleted: true
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request DELETE https://api.writer.com/v1/files/{file_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const file = await client.files.delete('file_id');

              console.log(file.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            file = client.files.delete(
                "file_id",
            )
            print(file.id)
  /v1/files:
    get:
      security:
        - bearerAuth: []
      summary: List files
      description: >-
        Retrieve a paginated list of files with optional filtering by status, graph association, and file
        type.
      tags:
        - File API
      operationId: gatewayGetFiles
      parameters:
        - name: before
          in: query
          required: false
          schema:
            type: string
          description: >-
            The ID of the first object in the previous page. This parameter instructs the API to return the
            previous page of results.
        - name: after
          in: query
          required: false
          schema:
            type: string
          description: >-
            The ID of the last object in the previous page. This parameter instructs the API to return the
            next page of results.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            format: int32
            default: 50
          description: >-
            Specifies the maximum number of objects returned in a page. The default value is 50. The minimum
            value is 1, and the maximum value is 100.
        - name: order
          in: query
          required: false
          schema:
            type: string
            default: desc
            enum:
              - asc
              - desc
          description: Specifies the order of the results. Valid values are asc for ascending and desc for descending.
        - name: graph_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: The unique identifier of the graph to which the files belong.
        - name: status
          in: query
          required: false
          schema:
            enum:
              - in_progress
              - completed
              - failed
          description: Specifies the status of the files to retrieve. Valid values are in_progress, completed or failed.
        - name: file_types
          in: query
          required: false
          schema:
            type: string
          description: >-
            The extensions of the files to retrieve. Separate multiple extensions with a comma. For example:
            `pdf,jpg,docx`.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/files_response'
              example:
                data:
                  - id: 7c36a365-392f-43ba-840d-8f3103b42572
                    name: example.pdf
                    created_at: '2024-07-10T12:00:00Z'
                    graph_ids:
                      - 31a8b75a-9a90-432f-8861-942229125333
                    status: in_progress
                  - id: 4bbe6207-737e-486f-a287-c5e95536984a
                    name: image.jpg
                    created_at: '2024-07-09T15:30:00Z'
                    graph_ids:
                      - 31a8b75a-9a90-432f-8861-942229125333
                    status: completed
                  - id: efc86bb4-30a4-40c9-a52a-ecee0d7e071f
                    name: document.txt
                    created_at: '2024-07-08T16:00:00Z'
                    graph_ids:
                      - 31a8b75a-9a90-432f-8861-942229125333
                    status: failed
                has_more: false
                first_id: 7c36a365-392f-43ba-840d-8f3103b42572
                last_id: efc86bb4-30a4-40c9-a52a-ecee0d7e071f
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/files \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              // Automatically fetches more pages as needed.
              for await (const file of client.files.list()) {
                console.log(file.id);
              }
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            page = client.files.list()
            page = page.data[0]
            print(page.id)
    post:
      security:
        - bearerAuth: []
      summary: Upload file
      description: >-
        Upload a new file to the system. Supports various file formats including PDF, DOC, DOCX, PPT, PPTX,
        JPG, PNG, EML, HTML, SRT, CSV, XLS, and XLSX.
      tags:
        - File API
      operationId: gatewayUploadFile
      parameters:
        - name: Content-Disposition
          in: header
          required: true
          schema:
            type: string
          description: >-
            The disposition type of the file, typically used to indicate the form-data name. Use `attachment`
            with the filename parameter to specify the name of the file, for example: `attachment;
            filename=example.pdf`.
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
          description: >-
            The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types) of the
            file being uploaded. Supports `txt`, `doc`, `docx`, `ppt`, `pptx`, `jpg`, `png`, `eml`, `html`,
            `pdf`, `srt`, `csv`, `xls`, `xlsx`, `mp3`, and `mp4` file extensions.
        - name: Content-Length
          in: header
          required: true
          schema:
            type: integer
            format: int64
          description: The size of the file in bytes.
        - name: graphId
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            The unique identifier of the Knowledge Graph to associate the uploaded file with.


            Note: The response from the upload endpoint does not include the `graphId` field, but the
            association will be visible when you retrieve the file using the file retrieval endpoint.
      requestBody:
        content:
          text/plain:
            schema:
              type: string
              format: binary
          application/msword:
            schema:
              type: string
              format: binary
          application/vnd.openxmlformats-officedocument.wordprocessingml.document:
            schema:
              type: string
              format: binary
          application/vnd.ms-powerpoint:
            schema:
              type: string
              format: binary
          application/vnd.openxmlformats-officedocument.presentationml.presentation:
            schema:
              type: string
              format: binary
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          message/rfc822:
            schema:
              type: string
              format: binary
          text/html:
            schema:
              type: string
              format: binary
          application/pdf:
            schema:
              type: string
              format: binary
          application/x-subrip:
            schema:
              type: string
              format: binary
          text/csv:
            schema:
              type: string
              format: binary
          application/vnd.ms-excel:
            schema:
              type: string
              format: binary
          application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
            schema:
              type: string
              format: binary
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/files \
             --header "Authorization: Bearer <token>"
             --header "Accept: */*" \
             --header "Content-Disposition: attachment; filename=descriptions.pdf" \
             --header "Content-Length: size_in_bytes" \
             --header "Content-Type: application/pdf" \
             --data-binary "@descriptions.pdf"
        - lang: JavaScript
          source: |-
            import fs from 'fs';
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const file = await client.files.upload({
                content: fs.createReadStream('path/to/file/descriptions.pdf'),
                'Content-Disposition': 'attachment; filename=descriptions.pdf',
                'Content-Type': 'application/pdf',
              });

              console.log(file.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from pathlib import Path
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            file = client.files.upload(
                content=Path('/path/to/file/descriptions.pdf'),
                content_disposition="attachment; filename=descriptions.pdf",
                content_type="application/pdf"
            )
            print(file.id)
  /v1/files/{file_id}/download:
    get:
      security:
        - bearerAuth: []
      tags:
        - File API
      summary: Download file
      description: >-
        Download the binary content of a file. The response will contain the file data in the appropriate MIME
        type.
      operationId: gatewayDownloadFile
      parameters:
        - name: file_id
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the file.
      responses:
        '200':
          description: File download successful
          headers:
            Content-Type:
              description: The MIME type of the file being downloaded
              required: true
              schema:
                type: object
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
              examples:
                fileDownloadExample:
                  summary: Example binary file download
                  value: File contents
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/files/{file_id}/download \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.files.download('file_id');

              console.log(response);

              const content = await response.blob();
              console.log(content);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.files.download(
                "file_id",
            )
            print(response)
            content = response.read()
            print(content)
  /v1/files/retry:
    post:
      security:
        - bearerAuth: []
      tags:
        - File API
      summary: Retry failed files
      description: >-
        Retry processing of files that previously failed to process. This will re-attempt the processing of
        the specified files.
      operationId: gatewayRetryFailedFiles
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/retry_files_request'
        required: true
      responses:
        '200':
          description: The retry request is being processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/retry_files_response'
              example:
                success: true
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/files/retry \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
             --data-raw '{"file_ids":["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.files.retry({
                file_ids: [
                  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
                  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
                  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
                ],
              });

              console.log(response.success);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.files.retry(
                file_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
            )
            print(response.success)
  /v1/applications:
    get:
      security:
        - bearerAuth: []
      tags:
        - Generation API
      summary: List applications
      description: >-
        Retrieves a paginated list of no-code agents (formerly called no-code applications) with optional
        filtering and sorting capabilities.
      parameters:
        - name: order
          in: query
          required: false
          description: Sort order for the results based on creation time.
          schema:
            type: string
            default: desc
            enum:
              - asc
              - desc
        - name: before
          in: query
          required: false
          description: Return results before this application ID for pagination.
          schema:
            type: string
            format: uuid
        - name: after
          in: query
          required: false
          description: Return results after this application ID for pagination.
          schema:
            type: string
            format: uuid
        - name: limit
          in: query
          required: false
          description: Maximum number of applications to return in the response.
          schema:
            type: integer
            format: int32
            default: 50
        - name: type
          in: query
          required: false
          description: Filter applications by their type.
          schema:
            $ref: '#/components/schemas/application_type'
            default: generation
      responses:
        '200':
          description: Successfully retrieved list of applications.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_applications_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/applications \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              // Automatically fetches more pages as needed.
              for await (const applicationListResponse of client.applications.list()) {
                console.log(applicationListResponse.id);
              }
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            page = client.applications.list()
            page = page.data[0]
            print(page.id)
  /v1/applications/{application_id}:
    get:
      security:
        - bearerAuth: []
      tags:
        - Generation API
      summary: Application details
      description: >-
        Retrieves detailed information for a specific no-code agent (formerly called no-code applications),
        including its configuration and current status.
      parameters:
        - name: application_id
          in: path
          required: true
          description: Unique identifier of the application to retrieve.
          schema:
            type: string
      responses:
        '200':
          description: Successfully retrieved application details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/application_with_inputs'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/applications/{application_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const application = await client.applications.retrieve('application_id');

              console.log(application.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            application = client.applications.retrieve(
                "application_id",
            )
            print(application.id)
    post:
      security:
        - bearerAuth: []
      tags:
        - Generation API
      summary: Generate from application
      description: Generate content from an existing no-code agent (formerly called no-code applications) with inputs.
      operationId: generateContent
      parameters:
        - name: application_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The unique identifier of a [no-code agent](/no-code/introduction) in AI Studio.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/generate_application_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generate_application_response'
              example:
                title: Alt text
                suggestion: A modern dining room with a minimalist design.
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/generate_application_response_chunk'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/applications/{application_id} \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"inputs":[{"id": "Image ID", "value": ["12345"]}]}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.applications.generateContent('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
                inputs: [
                  { id: 'id', value: ['string', 'string', 'string'] },
                  { id: 'id', value: ['string', 'string', 'string'] },
                  { id: 'id', value: ['string', 'string', 'string'] },
                ],
              });

              console.log(response.suggestion);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.applications.generate_content(
                application_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                inputs=[{
                    "id": "id",
                    "value": ["string", "string", "string"],
                }, {
                    "id": "id",
                    "value": ["string", "string", "string"],
                }, {
                    "id": "id",
                    "value": ["string", "string", "string"],
                }],
            )
            print(response.suggestion)
  /v1/applications/{application_id}/jobs:
    get:
      tags:
        - template
      summary: Retrieve all jobs
      description: Retrieve all jobs created via the async API, linked to the provided application ID (or alias).
      security:
        - bearerAuth: []
      parameters:
        - name: application_id
          in: path
          description: The ID of the no-code app for which to retrieve jobs.
          required: true
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/api_job_status'
        - name: offset
          in: query
          description: The pagination offset for retrieving the jobs.
          required: false
          schema:
            type: integer
            format: int64
        - name: limit
          in: query
          description: The pagination limit for retrieving the jobs.
          required: false
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_async_application_jobs_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/applications/{application_id}/jobs \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              // Automatically fetches more pages as needed.
              for await (const applicationGenerateAsyncResponse of client.applications.jobs.list('application_id')) {
                console.log(applicationGenerateAsyncResponse.id);
              }
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            page = client.applications.jobs.list(
                application_id="application_id",
            )
            page = page.result[0]
            print(page.id)
    post:
      tags:
        - template
      summary: Generate from application (async)
      description: >-
        Generate content asynchronously from an existing no-code agent (formerly called no-code applications)
        with inputs.
      security:
        - bearerAuth: []
      parameters:
        - name: application_id
          description: The ID of the no-code app for which to create a job.
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/generate_application_async_request'
        required: true
      responses:
        '202':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generate_application_async_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/applications/{application_id}/jobs \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"inputs":[{"id": "Image ID", "value": ["12345"]}]}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const job = await client.applications.jobs.create('application_id', {
                inputs: [{ id: 'id', value: ['string'] }],
              });

              console.log(job.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            job = client.applications.jobs.create(
                application_id="application_id",
                inputs=[{
                    "id": "id",
                    "value": ["string"],
                }],
            )
            print(job.id)
  /v1/applications/jobs/{job_id}/retry:
    post:
      tags:
        - template
      summary: Retry job execution
      description: >-
        Re-triggers the async execution of a single job previously created via the Async api and terminated in
        error.
      security:
        - bearerAuth: []
      parameters:
        - name: job_id
          description: The ID of the job to retry.
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generate_application_async_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/applications/jobs/{job_id}/retry \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.applications.jobs.retry('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

              console.log(response.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            response = client.applications.jobs.retry(
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(response.id)
  /v1/applications/jobs/{job_id}:
    get:
      tags:
        - template
      summary: Retrieve a single job
      description: Retrieves a single job created via the Async API.
      security:
        - bearerAuth: []
      parameters:
        - name: job_id
          description: The ID of the job to retrieve.
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_async_application_job_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/applications/jobs/{job_id} \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const applicationGenerateAsyncResponse = await client.applications.jobs.retrieve(
                '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
              );

              console.log(applicationGenerateAsyncResponse.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            application_generate_async_response = client.applications.jobs.retrieve(
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(application_generate_async_response.id)
  /v1/applications/{application_id}/graphs:
    get:
      tags:
        - template
      summary: Retrieve graphs
      description: Retrieve Knowledge Graphs associated with a no-code agent that has chat capabilities.
      parameters:
        - name: application_id
          in: path
          description: The ID of the no-code agent for which to retrieve Knowledge Graphs.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/application_graphs_response'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request GET https://api.writer.com/v1/applications/{application_id}/graphs \
             --header "Authorization: Bearer <token>"
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const applicationGraphsResponse = await client.applications.graphs.list('application_id');

              console.log(applicationGraphsResponse.graph_ids);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            application_graphs_response = client.applications.graphs.list(
                "application_id",
            )
            print(application_graphs_response.graph_ids)
    put:
      tags:
        - template
      summary: Associate graphs
      description: Updates the list of Knowledge Graphs associated with a no-code chat agent.
      parameters:
        - name: application_id
          in: path
          description: >-
            The ID of the no-code agent to update.


            Only no-code agents with chat capabilities can have associated Knowledge Graphs. No-code agents
            with text generation and research capabilities do not support Knowledge Graphs.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/application_graph_ids_request'
        required: true
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/application_graphs_response'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request PUT https://api.writer.com/v1/applications/{application_id}/graphs \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw
            '{"graph_ids":["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e","182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e","182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const applicationGraphsResponse = await client.applications.graphs.update('application_id', {
                graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
              });

              console.log(applicationGraphsResponse.graph_ids);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            application_graphs_response = client.applications.graphs.update(
                application_id="application_id",
                graph_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
            )
            print(application_graphs_response.graph_ids)
  /v1/tools/ai-detect:
    post:
      security:
        - bearerAuth: []
      tags:
        - Tools API
      summary: AI detection
      description: >-
        Detects if content is AI- or human-generated, with a confidence score. Content must have at least 350
        characters
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ai_detection_request'
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ai_detection_response'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/tools/ai-detect \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"input":"AI and ML continue to be at the forefront of technological advancements. In
            2025, we can expect more sophisticated AI systems that can handle complex tasks with greater
            efficiency. AI will play a crucial role in various sectors, including healthcare, finance, and
            manufacturing. For instance, AI-powered diagnostic tools will become more accurate, helping
            doctors detect diseases at an early stage. In finance, AI algorithms will enhance fraud detection
            and risk management."}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.tools.aiDetect({
                input:
                  'AI and ML continue to be at the forefront of technological advancements. In 2025, we can expect more sophisticated AI systems that can handle complex tasks with greater efficiency. AI will play a crucial role in various sectors, including healthcare, finance, and manufacturing. For instance, AI-powered diagnostic tools will become more accurate, helping doctors detect diseases at an early stage. In finance, AI algorithms will enhance fraud detection and risk management.',
              });

              console.log(response.label);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            response = client.tools.ai_detect(
                input="AI and ML continue to be at the forefront of technological advancements. In 2025, we can expect more sophisticated AI systems that can handle complex tasks with greater efficiency. AI will play a crucial role in various sectors, including healthcare, finance, and manufacturing. For instance, AI-powered diagnostic tools will become more accurate, helping doctors detect diseases at an early stage. In finance, AI algorithms will enhance fraud detection and risk management.",
            )
            print(response.label)
  /v1/tools/comprehend/medical:
    post:
      security:
        - bearerAuth: []
      tags:
        - Tools API
      summary: Medical comprehend
      description: >-
        Analyze unstructured medical text to extract entities labeled with standardized medical codes and
        confidence scores.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/comprehend_medical_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/medical_comprehend_response'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/tools/comprehend/medical \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"content":"the symptoms are soreness, a temperature and
            cough","response_type":"Entities"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const medical = await client.tools.comprehend.medical({ content: 'the symptoms are soreness, a temperature and cough', response_type: 'Entities' });

              console.log(medical.entities);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            medical = client.tools.comprehend.medical(
                content="the symptoms are soreness, a temperature and cough",
                response_type="Entities",
            )
            print(medical.entities)
  /v1/tools/context-aware-splitting:
    post:
      security:
        - bearerAuth: []
      tags:
        - Tools API
      summary: Context-aware text splitting
      description: >-
        Splits a long block of text (maximum 4000 words) into smaller chunks while preserving the semantic
        meaning of the text and context between the chunks.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/context_aware_text_splitting_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/context_aware_splitting_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/tools/context-aware-splitting \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"text":"text to split","strategy":"llm_split"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.tools.contextAwareSplitting({ strategy: 'llm_split', text: 'text to split' });

              console.log(response.chunks);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.tools.context_aware_splitting(
                strategy="llm_split",
                text="text to split",
            )
            print(response.chunks)
  /v1/tools/pdf-parser/{file_id}:
    post:
      security:
        - bearerAuth: []
      tags:
        - Tools API
      summary: Parse PDF
      description: Parse PDF to other formats.
      parameters:
        - name: file_id
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the file.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/parse_pdf_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/parse_pdf_response'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --location --request POST https://api.writer.com/v1/tools/pdf-parser/{file_id} \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"format":"text"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.tools.parsePdf('file_id', { format: 'text' });

              console.log(response.content);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.tools.parse_pdf(
                file_id="file_id",
                format="text",
            )
            print(response.content)
  /v1/tools/text-to-graph:
    post:
      security:
        - bearerAuth: []
      tags:
        - Tools API
      summary: Text-to-graph
      description: Performs name entity recognition on the supplied text accepting a maximum of 35000 words.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/text_to_graph_request'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/text_to_graph_response'
              example:
                graph:
                  - - racecar [RACECAR]
                    - has_component
                    - brakes [COMPONENT]
                  - - racecar [RACECAR]
                    - can_perform
                    - decelerate [ACTION]
                  - - racecar [RACECAR]
                    - has_property
                    - powerful [PROPERTY]
                  - - 200 km/h [VELOCITY]
                    - decreased_to
                    - 0 km/h [VELOCITY]
                  - - decelerate [ACTION]
                    - performed_by
                    - racecar [RACECAR]
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/tools/text-to-graph \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"text":"A racecar has very powerful brakes that can decelerate from 200 km/h to 0
            km/h in a few seconds"}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const response = await client.tools.textToGraph({ text: 'A racecar has very powerful brakes that can decelerate from 200 km/h to 0 km/h in a few seconds' });

              console.log(response.graph);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                # This is the default and can be omitted
                api_key=os.environ.get("WRITER_API_KEY"),
            )
            response = client.tools.text_to_graph(
                text="A racecar has very powerful brakes that can decelerate from 200 km/h to 0 km/h in a few seconds",
            )
            print(response.graph)
  /v1/tools/web-search:
    post:
      security:
        - bearerAuth: []
      tags:
        - Tools API
      summary: Web search
      description: Search the web for information about a given query and return relevant results with source URLs.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/web_search_request'
            example:
              query: How do I get an API key for the Writer API?
              include_domains:
                - dev.writer.com
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/web_search_response'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/tools/web-search \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw '{"query":"How do I get an API key for the Writer
            API?","include_domains":["dev.writer.com"]}'
  /v1/vision:
    post:
      tags:
        - Vision
      summary: Analyze images
      description: >-
        Submit images and documents with a prompt to generate an analysis. Supports JPG, PNG, PDF, and TXT
        files up to 7MB each.
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/vision_request'
            example:
              model: palmyra-vision
              variables:
                - name: image_1
                  file_id: f1234
                - name: image_2
                  file_id: f9876
              prompt: Describe the difference between the image {{image_1}} and the image {{image_2}}.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                data: >-
                  Image f1234 shows a densely crowded urban beach with many umbrellas, while image f9876
                  depicts a sparsely populated tropical beach with clear turquoise water and lush greenery
              schema:
                $ref: '#/components/schemas/vision_response'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/vision \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw
            '{"model":"palmyra-vision","variables":[{"name":"image_1","file_id":"f1234"},{"name":"image_2","file_id":"f9876"}],"prompt":"Describe
            the difference between the image {{image_1}} and the image {{image_2}}."}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const visionResponse = await client.vision.analyze({
                model: 'palmyra-vision',
                prompt: 'Describe the difference between the image {{image_1}} and the image {{image_2}}.',
                variables: [
                  { name: 'image_1', file_id: 'f1234' },
                  { name: 'image_2', file_id: 'f9876' },
                ],
              });

              console.log(visionResponse.data);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            vision_response = client.vision.analyze(
                model="palmyra-vision",
                prompt="Describe the difference between the image {{image_1}} and the image {{image_2}}.",
                variables=[{
                    "name": "image_1",
                    "file_id": "f1234",
                }, {
                    "name": "image_2",
                    "file_id": "f9876",
                }],
            )
            print(vision_response.data)
  /v1/translation:
    post:
      tags:
        - Translation
      summary: Translate text
      description: Translate text from one language to another.
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/translation_request'
            example:
              model: palmyra-translate
              source_language_code: en
              target_language_code: es
              text: Hello, world!
              formality: true
              length_control: true
              mask_profanity: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                data: ¡Hola, mundo!
              schema:
                $ref: '#/components/schemas/translation_response'
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --location --request POST https://api.writer.com/v1/translation \
             --header "Authorization: Bearer <token>" \
             --header "Content-Type: application/json" \
            --data-raw
            '{"model":"string","source_language_code":"string","target_language_code":"string","text":"string","formality":false,"length_control":false,"mask_profanity":false}'
        - lang: JavaScript
          source: |-
            import Writer from 'writer-sdk';

            const client = new Writer({
              apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const translationResponse = await client.translation.translate({
                formality: true,
                length_control: true,
                mask_profanity: true,
                model: 'palmyra-translate',
                source_language_code: 'en',
                target_language_code: 'es',
                text: 'Hello, world!',
              });

              console.log(translationResponse.data);
            }

            main();
        - lang: Python
          source: |-
            import os
            from writerai import Writer

            client = Writer(
                api_key=os.environ.get("WRITER_API_KEY"),  # This is the default and can be omitted
            )
            translation_response = client.translation.translate(
                formality=True,
                length_control=True,
                mask_profanity=True,
                model="palmyra-translate",
                source_language_code="en",
                target_language_code="es",
                text="Hello, world!",
            )
            print(translation_response.data)
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where `<token>` is your [Writer API
        key](https://dev.writer.com/api-reference/api-keys).
  schemas:
    model_info:
      required:
        - name
        - id
      type: object
      properties:
        name:
          type: string
          description: The name of the particular LLM that you want to use.
        id:
          type: string
          description: The ID of the particular LLM that you want to use
    models_response:
      required:
        - models
      type: object
      properties:
        models:
          type: array
          description: The [ID of the model](https://dev.writer.com/home/models) to use for processing the request.
          items:
            $ref: '#/components/schemas/model_info'
      example:
        models:
          - name: Palmyra X 003 Instruct
            id: palmyra-x-003-instruct
          - name: Palmyra Med
            id: palmyra-med
          - name: Palmyra Financial
            id: palmyra-fin
          - name: Palmyra X4
            id: palmyra-x4
          - name: Palmyra X5
            id: palmyra-x5
          - name: Palmyra Creative
            id: palmyra-creative
    logprobs:
      type: object
      required:
        - content
        - refusal
      nullable: true
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/logprobs_token'
          nullable: true
        refusal:
          type: array
          items:
            $ref: '#/components/schemas/logprobs_token'
          nullable: true
    logprobs_token:
      title: logprobs_token
      required:
        - token
        - logprob
        - top_logprobs
      type: object
      properties:
        token:
          type: string
        logprob:
          type: number
          format: double
        bytes:
          type: array
          items:
            type: integer
            format: int32
        top_logprobs:
          type: array
          items:
            $ref: '#/components/schemas/top_log_prob'
    top_log_prob:
      title: top_log_prob
      description: >-
        An array of mappings for each token to its top log probabilities, showing detailed prediction
        probabilities.
      required:
        - token
        - logprob
      type: object
      properties:
        token:
          type: string
        logprob:
          type: number
          format: double
        bytes:
          type: array
          items:
            type: integer
            format: int32
    completions_choice:
      required:
        - text
      type: object
      properties:
        text:
          type: string
          description: The generated text output from the model, which forms the main content of the response.
        log_probs:
          $ref: '#/components/schemas/logprobs'
    completions_response:
      required:
        - choices
      type: object
      properties:
        choices:
          type: array
          items:
            $ref: '#/components/schemas/completions_choice'
          minItems: 1
          description: >-
            A list of choices generated by the model, each containing the text of the completion and
            associated metadata such as log probabilities.
        model:
          type: string
          description: The identifier of the model that was used to generate the responses in the 'choices' array.
      example:
        choices:
          - text: Sure! Here's a search engine optimized article about...
            log_probs: null
        model: palmyra-x-003-instruct
    streaming_data:
      required:
        - value
      type: object
      properties:
        value:
          type: string
    map:
      type: object
      properties:
        additional_properties:
          type: number
          format: double
          description: For any additional_properties properties in the top_logprobs object
    completions_request:
      required:
        - model
        - prompt
      type: object
      properties:
        model:
          type: string
          description: >-
            The [ID of the model](https://dev.writer.com/home/models) to use for generating text. Supports
            `palmyra-x5`, `palmyra-x4`, `palmyra-fin`, `palmyra-med`, `palmyra-creative`, and
            `palmyra-x-003-instruct`.
        prompt:
          type: string
          description: The input text that the model will process to generate a response.
        max_tokens:
          type: integer
          format: int64
          description: The maximum number of tokens that the model can generate in the response.
        temperature:
          type: number
          format: double
          description: >-
            Controls the randomness of the model's outputs. Higher values lead to more random outputs, while
            lower values make the model more deterministic.
        top_p:
          type: number
          format: double
          description: >-
            Used to control the nucleus sampling, where only the most probable tokens with a cumulative
            probability of top_p are considered for sampling, providing a way to fine-tune the randomness of
            predictions.
        stop:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
          description: >-
            Specifies stopping conditions for the model's output generation. This can be an array of strings
            or a single string that the model will look for as a signal to stop generating further tokens.
        best_of:
          type: integer
          format: int32
          description: >-
            Specifies the number of completions to generate and return the best one. Useful for generating
            multiple outputs and choosing the best based on some criteria.
        random_seed:
          type: integer
          format: int32
          description: >-
            A seed used to initialize the random number generator for the model, ensuring reproducibility of
            the output when the same inputs are provided.
        stream:
          type: boolean
          description: >-
            Determines whether the model's output should be streamed. If true, the output is generated and
            sent incrementally, which can be useful for real-time applications.
      example:
        model: palmyra-x-003-instruct
        prompt: Write me an SEO article about...
        max_tokens: 150
        temperature: 0.7
        top_p: 0.9
        stop:
          - .
        best_of: 1
        random_seed: 42
        stream: false
    fail_message:
      required:
        - description
        - key
        - extras
      type: object
      properties:
        description:
          type: string
        key:
          type: string
        extras:
          type: object
          additionalProperties: true
    fail_response:
      required:
        - tpe
        - errors
        - extras
      type: object
      properties:
        tpe:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/fail_message'
        extras:
          type: object
          additionalProperties: true
    chat_completion_choice:
      required:
        - index
        - finish_reason
        - message
      type: object
      properties:
        index:
          type: integer
          format: int32
          description: The index of the choice in the list of completions generated by the model.
        finish_reason:
          $ref: '#/components/schemas/chat_completion_finish_reason'
          description: >-
            Describes the condition under which the model ceased generating content. Common reasons include
            'length' (reached the maximum output size), 'stop' (encountered a stop sequence), 'content_filter'
            (harmful content filtered out), or 'tool_calls' (encountered tool calls).
        message:
          $ref: '#/components/schemas/chat_completion_response_message'
        logprobs:
          description: Log probability information for the choice.
          $ref: '#/components/schemas/logprobs'
    chat_completion_streaming_choice:
      required:
        - index
        - finish_reason
        - delta
      type: object
      properties:
        index:
          type: integer
          format: int32
          description: The index of the choice in the list of completions generated by the model.
        finish_reason:
          $ref: '#/components/schemas/chat_completion_finish_reason'
          description: >-
            Describes the condition under which the model ceased generating content. Common reasons include
            'length' (reached the maximum output size), 'stop' (encountered a stop sequence), 'content_filter'
            (harmful content filtered out), or 'tool_calls' (encountered tool calls).
          nullable: true
        message:
          $ref: '#/components/schemas/chat_completion_response_message'
        delta:
          description: A chat completion delta generated by streamed model responses.
          $ref: '#/components/schemas/chat_completion_streaming_delta'
        logprobs:
          description: Log probability information for the choice.
          $ref: '#/components/schemas/logprobs'
    chat_completion_finish_reason:
      type: string
      enum:
        - stop
        - length
        - content_filter
        - tool_calls
    chat_request:
      required:
        - model
        - messages
      type: object
      properties:
        model:
          type: string
          description: >-
            The [ID of the model](https://dev.writer.com/home/models) to use for creating the chat completion.
            Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`, `palmyra-med`, `palmyra-creative`, and
            `palmyra-x-003-instruct`.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/chat_message'
          minItems: 1
          description: >-
            An array of message objects that form the conversation history or context for the model to respond
            to. The array must contain at least one message.
        max_tokens:
          type: integer
          format: int32
          description: >-
            Defines the maximum number of tokens (words and characters) that the model can generate in the
            response. This can be adjusted to allow for longer or shorter responses as needed. The maximum
            value varies by model. See the [models overview](/home/models) for more information about the
            maximum number of tokens for each model.
        temperature:
          type: number
          format: double
          default: 1
          description: >-
            Controls the randomness or creativity of the model's responses. A higher temperature results in
            more varied and less predictable text, while a lower temperature produces more deterministic and
            conservative outputs.
        top_p:
          type: number
          format: double
          description: >-
            Sets the threshold for "nucleus sampling," a technique to focus the model's token generation on
            the most likely subset of tokens. Only tokens with cumulative probability above this threshold are
            considered, controlling the trade-off between creativity and coherence.
        'n':
          type: integer
          format: int32
          description: >-
            Specifies the number of completions (responses) to generate from the model in a single request.
            This parameter allows for generating multiple responses, offering a variety of potential replies
            from which to choose.
        stop:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
          description: >-
            A token or sequence of tokens that, when generated, will cause the model to stop producing further
            content. This can be a single token or an array of tokens, acting as a signal to end the output.
        logprobs:
          type: boolean
          description: Specifies whether to return log probabilities of the output tokens.
        stream:
          type: boolean
          description: >-
            Indicates whether the response should be streamed incrementally as it is generated or only
            returned once fully complete. Streaming can be useful for providing real-time feedback in
            interactive applications.
          default: false
        tools:
          type: array
          description: >-
            An array containing tool definitions for tools that the model can use to generate responses. The
            tool definitions use JSON schema. You can define your own functions or use one of the built-in
            `graph`, `llm`, `translation`, or `vision` tools. Note that you can only use one built-in tool
            type in the array (only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
            [custom tools](https://dev.writer.com/home/tool-calling) of type `function` in the same request.
          items:
            $ref: '#/components/schemas/tool'
            minItems: 1
        tool_choice:
          $ref: '#/components/schemas/tool_choice'
        stream_options:
          $ref: '#/components/schemas/stream_options'
        response_format:
          $ref: '#/components/schemas/response_format'
    stream_options:
      title: stream_options
      description: Additional options for streaming.
      required:
        - include_usage
      type: object
      properties:
        include_usage:
          type: boolean
          description: Indicate whether to include usage information.
    response_format:
      title: response_format
      description: >-
        The response format to use for the chat completion, available with `palmyra-x4` and `palmyra-x5`.


        `text` is the default response format. [JSON Schema](https://json-schema.org/) is supported for
        structured responses. If you specify `json_schema`, you must also provide a `json_schema` object.
      required:
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of response format to use.
          enum:
            - text
            - json_schema
        json_schema:
          type: object
          description: The JSON schema to use for the response format.
    chat_response:
      required:
        - id
        - object
        - choices
        - created
        - model
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: >-
            A globally unique identifier (UUID) for the response generated by the API. This ID can be used to
            reference the specific operation or transaction within the system for tracking or debugging
            purposes.
        object:
          type: string
          description: The type of object returned, which is always `chat.completion` for chat responses.
          enum:
            - chat.completion
        choices:
          type: array
          items:
            $ref: '#/components/schemas/chat_completion_choice'
          minItems: 1
          description: >-
            An array of objects representing the different outcomes or results produced by the model based on
            the input provided.
        created:
          type: integer
          format: int64
          description: >-
            The Unix timestamp (in seconds) when the response was created. This timestamp can be used to
            verify the timing of the response relative to other events or operations.
        model:
          type: string
          description: Identifies the specific model used to generate the response.
        usage:
          $ref: '#/components/schemas/chat_completion_usage'
        system_fingerprint:
          type: string
          description: A string representing the backend configuration that the model runs with.
        service_tier:
          type: string
          description: The service tier used for processing the request.
    chat_completion_chunk:
      required:
        - id
        - object
        - created
        - choices
        - model
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: >-
            A globally unique identifier (UUID) for the response generated by the API. This ID can be used to
            reference the specific operation or transaction within the system for tracking or debugging
            purposes.
        object:
          type: string
          description: The type of object returned, which is always `chat.completion.chunk` for streaming chat responses.
          enum:
            - chat.completion.chunk
        choices:
          type: array
          items:
            $ref: '#/components/schemas/chat_completion_streaming_choice'
          minItems: 1
          description: >-
            An array of objects representing the different outcomes or results produced by the model based on
            the input provided.
        created:
          type: integer
          format: int64
          description: >-
            The Unix timestamp (in seconds) when the response was created. This timestamp can be used to
            verify the timing of the response relative to other events or operations.
        model:
          type: string
          description: Identifies the specific model used to generate the response.
        usage:
          $ref: '#/components/schemas/chat_completion_usage'
        system_fingerprint:
          type: string
        service_tier:
          type: string
    chat_completion_response_message:
      required:
        - content
        - role
        - refusal
      type: object
      description: >-
        The chat completion message from the model. Note: this field is deprecated for streaming. Use `delta`
        instead.
      properties:
        content:
          type: string
          description: >-
            The text content produced by the model. This field contains the actual output generated,
            reflecting the model's response to the input query or command.
        role:
          type: string
          enum:
            - assistant
          description: Specifies the role associated with the content.
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/tool_call'
          minItems: 1
          nullable: true
        graph_data:
          $ref: '#/components/schemas/graph_data'
        llm_data:
          $ref: '#/components/schemas/llm_data'
        translation_data:
          $ref: '#/components/schemas/translation_data'
        web_search_data:
          $ref: '#/components/schemas/web_search_data'
        refusal:
          type: string
          nullable: true
    chat_completion_streaming_delta:
      type: object
      description: >-
        The chat completion message from the model. Note: this field is deprecated for streaming. Use `delta`
        instead.
      properties:
        content:
          type: string
          description: >-
            The text content produced by the model. This field contains the actual output generated,
            reflecting the model's response to the input query or command.
        role:
          $ref: '#/components/schemas/chat_message_role'
          description: >-
            Specifies the role associated with the content, indicating whether the message is from the
            'assistant' or another defined role, helping to contextualize the output within the interaction
            flow.
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/tool_call_streaming'
          minItems: 1
          nullable: true
        graph_data:
          $ref: '#/components/schemas/graph_data'
        llm_data:
          $ref: '#/components/schemas/llm_data'
        translation_data:
          $ref: '#/components/schemas/translation_data'
        refusal:
          type: string
          nullable: true
    chat_completion_usage:
      title: chat_completion_usage
      description: >-
        Usage information for the chat completion response. Please note that at this time Knowledge Graph tool
        usage is not included in this object.
      required:
        - prompt_tokens
        - total_tokens
        - completion_tokens
      type: object
      properties:
        prompt_tokens:
          type: integer
          format: int32
        total_tokens:
          type: integer
          format: int32
        completion_tokens:
          type: integer
          format: int32
        prompt_token_details:
          $ref: '#/components/schemas/prompt_token_details'
        completion_tokens_details:
          $ref: '#/components/schemas/completion_token_details'
    prompt_token_details:
      title: prompt_token_details
      required:
        - cached_tokens
      type: object
      properties:
        cached_tokens:
          type: integer
          format: int32
    completion_token_details:
      title: completion_token_details
      required:
        - reasoning_tokens
      type: object
      properties:
        reasoning_tokens:
          type: integer
          format: int32
    chat_message:
      title: chat_message
      required:
        - role
      type: object
      properties:
        content:
          description: >-
            The content of the message. Can be either a string (for text-only messages) or an array of content
            fragments (for mixed text and image messages).
          nullable: true
          oneOf:
            - type: string
              title: TextContent
            - type: array
              title: MixedContent
              items:
                $ref: '#/components/schemas/composite_content'
              minItems: 1
        role:
          $ref: '#/components/schemas/chat_message_request_role'
        name:
          type: string
          description: >-
            An optional name for the message sender. Useful for identifying different users, personas, or
            tools in multi-participant conversations.
          nullable: true
        tool_call_id:
          type: string
          nullable: true
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/tool_call'
          nullable: true
          minItems: 1
        graph_data:
          $ref: '#/components/schemas/graph_data'
          nullable: true
        refusal:
          type: string
          nullable: true
    chat_message_role:
      type: string
      enum:
        - user
        - assistant
        - system
    chat_message_request_role:
      type: string
      description: >-
        The role of the chat message. You can provide a system prompt by setting the role to `system`, or
        specify that a message is the result of a [tool call](https://dev.writer.com/home/tool-calling) by
        setting the role to `tool`.
      enum:
        - user
        - assistant
        - system
        - tool
    delete_file_response:
      title: delete_file_response
      required:
        - id
        - deleted
      type: object
      properties:
        id:
          type: string
          description: A unique identifier of the deleted file.
        deleted:
          type: boolean
          description: Indicates whether the file was successfully deleted.
    retry_files_response:
      title: retry_files_response
      type: object
      properties:
        success:
          type: boolean
          description: Indicates whether the retry operation was successful.
    file_response:
      title: file_response
      required:
        - id
        - created_at
        - name
        - graph_ids
        - status
      type: object
      properties:
        id:
          type: string
          description: A unique identifier of the file.
        created_at:
          type: string
          format: date-time
          description: The timestamp when the file was uploaded.
        name:
          type: string
          description: The name of the file.
        graph_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            A list of Knowledge Graph IDs that the file is associated with.


            If you provided a `graphId` during upload, the file is associated with that Knowledge Graph.
            However, the `graph_ids` field in the upload response is an empty list. The association will be
            visible in the `graph_ids` list when you retrieve the file using the file retrieval endpoint.
        status:
          type: string
          description: The processing status of the file.
    graph_type:
      title: graph_type
      description: |-
        The type of Knowledge Graph:

        - `manual`: files are uploaded via UI or API
        - `connector`: files are uploaded via a data connector such as Google Drive or Confluence
        - `web`: URLs are connected to the Knowledge Graph
      type: string
      enum:
        - manual
        - connector
        - web
    files_response:
      title: files_response
      required:
        - data
        - has_more
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/file_response'
        has_more:
          type: boolean
          description: Indicates if there are more files available beyond the current page.
        first_id:
          type: string
          description: The ID of the first file in the current response.
        last_id:
          type: string
          description: The ID of the last file in the current response.
    application_graph_ids_request:
      title: application_graph_ids_request
      required:
        - graph_ids
      type: object
      properties:
        graph_ids:
          type: array
          description: >-
            A list of Knowledge Graph IDs to associate with the application. Note that this will replace the
            existing list of Knowledge Graphs associated with the application, not add to it.
          items:
            type: string
            format: uuid
    application_graphs_response:
      title: application_graphs_response
      required:
        - graph_ids
      type: object
      properties:
        graph_ids:
          type: array
          description: A list of Knowledge Graphs associated with the application.
          items:
            type: string
            format: uuid
    graph_data:
      title: graph_data
      type: object
      properties:
        sources:
          type: array
          items:
            $ref: '#/components/schemas/source'
        status:
          $ref: '#/components/schemas/graph_stage_status'
        subqueries:
          type: array
          items:
            $ref: '#/components/schemas/sub_query'
        references:
          $ref: '#/components/schemas/references'
    llm_data:
      title: llm_data
      required:
        - prompt
        - model
      type: object
      nullable: true
      properties:
        prompt:
          type: string
          description: The prompt processed by the model.
        model:
          type: string
          description: The model used by the tool.
    translation_data:
      title: translation_data
      required:
        - source_text
        - source_language_code
        - target_language_code
      type: object
      properties:
        source_text:
          type: string
          description: The text the tool translated.
        source_language_code:
          type: string
          description: The language code of the source text.
        target_language_code:
          type: string
          description: The language code of the target text.
    web_search_data:
      title: web_search_data
      required:
        - sources
      type: object
      properties:
        sources:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              raw_content:
                type: string
    graph_response:
      title: graph_response
      required:
        - id
        - created_at
        - name
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: A unique identifier of the Knowledge Graph.
        created_at:
          type: string
          format: date-time
          description: The timestamp when the Knowledge Graph was created.
        name:
          type: string
          description: The name of the Knowledge Graph (max 255 characters).
        description:
          type: string
          description: A description of the Knowledge Graph (max 255 characters).
        urls:
          type: array
          description: An array of web connector URLs associated with this Knowledge Graph.
          items:
            $ref: '#/components/schemas/web_connector_url'
    graph_stage_status:
      title: graph_stage_status
      type: string
      nullable: true
      enum:
        - processing
        - finished
    delete_graph_response:
      title: delete_graph_response
      required:
        - id
        - deleted
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: A unique identifier of the deleted Knowledge Graph.
        deleted:
          type: boolean
          description: Indicates whether the Knowledge Graph was successfully deleted.
    retry_files_request:
      title: retry_files_request
      required:
        - file_ids
      type: object
      properties:
        file_ids:
          type: array
          items:
            type: string
            format: uuid
          description: The unique identifier of the files to retry.
    graph_file_request:
      title: graph_file_request
      required:
        - file_id
      type: object
      properties:
        file_id:
          type: string
          description: The unique identifier of the file.
    graph_file_status:
      title: graph_file_status
      required:
        - in_progress
        - completed
        - failed
        - total
      type: object
      properties:
        in_progress:
          type: integer
          format: int64
          description: The number of files currently being processed.
        completed:
          type: integer
          format: int64
          description: The number of files that have been successfully processed.
        failed:
          type: integer
          format: int64
          description: The number of files that failed to process.
        total:
          type: integer
          format: int64
          description: The total number of files associated with the Knowledge Graph.
    graph_request:
      title: graph_request
      type: object
      properties:
        name:
          type: string
          description: >-
            The name of the Knowledge Graph (max 255 characters). Omitting this field leaves the name
            unchanged.
        description:
          type: string
          description: >-
            A description of the Knowledge Graph (max 255 characters). Omitting this field leaves the
            description unchanged.
    update_graph_request:
      title: update_graph_request
      type: object
      properties:
        name:
          type: string
          description: >-
            The name of the Knowledge Graph (max 255 characters). Omitting this field leaves the name
            unchanged.
        description:
          type: string
          description: >-
            A description of the Knowledge Graph (max 255 characters). Omitting this field leaves the
            description unchanged.
        urls:
          type: array
          description: >-
            An array of web connector URLs to update for this Knowledge Graph. You can only connect URLs to
            Knowledge Graphs with the type `web`. To clear the list of URLs, set this field to an empty array.
          items:
            $ref: '#/components/schemas/update_graph_web_url'
    update_graph_web_url:
      title: update_graph_web_url
      required:
        - url
        - type
      type: object
      properties:
        url:
          type: string
          description: The URL to be processed by the web connector.
        exclude_urls:
          type: array
          description: An array of URLs to exclude from processing within this web connector.
          items:
            type: string
        type:
          $ref: '#/components/schemas/web_connector_url_type'
          description: The type of web connector processing for this URL.
    graphs_response:
      title: graphs_response
      required:
        - data
        - has_more
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/graph'
        first_id:
          type: string
          format: uuid
          description: The ID of the first Knowledge Graph in the current response.
        last_id:
          type: string
          format: uuid
          description: The ID of the last Knowledge Graph in the current response.
        has_more:
          type: boolean
          description: Indicates if there are more Knowledge Graphs available beyond the current page.
    graph:
      title: graph
      required:
        - id
        - created_at
        - name
        - file_status
        - type
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the Knowledge Graph.
        created_at:
          type: string
          format: date-time
          description: The timestamp when the Knowledge Graph was created.
        name:
          type: string
          description: The name of the Knowledge Graph.
        description:
          type: string
          description: A description of the Knowledge Graph.
        file_status:
          $ref: '#/components/schemas/graph_file_status'
          description: The processing status of files in the Knowledge Graph.
        type:
          $ref: '#/components/schemas/graph_type'
          description: |-
            The type of Knowledge Graph.

            - `manual`: files are uploaded via UI or API
            - `connector`: files are uploaded via a data connector such as Google Drive or Confluence
            - `web`: URLs are connected to the Knowledge Graph
        urls:
          type: array
          description: An array of web connector URLs associated with this Knowledge Graph.
          items:
            $ref: '#/components/schemas/web_connector_url'
    web_connector_url:
      title: web_connector_url
      required:
        - url
        - status
        - type
      type: object
      properties:
        url:
          type: string
          description: The URL to be processed by the web connector.
        status:
          $ref: '#/components/schemas/web_connector_url_state'
          description: The current status of the URL processing.
        exclude_urls:
          type: array
          description: An array of URLs to exclude from processing within this web connector.
          items:
            type: string
        type:
          $ref: '#/components/schemas/web_connector_url_type'
          description: The type of web connector processing for this URL.
    web_connector_url_state:
      title: web_connector_url_state
      description: The state of a web connector URL processing.
      required:
        - status
      type: object
      properties:
        status:
          $ref: '#/components/schemas/web_connector_url_status'
          description: The current status of the URL processing.
        error_type:
          $ref: '#/components/schemas/web_connector_url_error_type'
          description: The type of error that occurred during processing, if any.
    web_connector_url_type:
      title: web_connector_url_type
      description: The type of web connector processing for a URL.
      type: string
      enum:
        - single_page
        - sub_pages
    web_connector_url_error_type:
      title: web_connector_url_error_type
      description: The type of error that can occur during web connector URL processing.
      type: string
      enum:
        - invalid_url
        - not_searchable
        - not_found
        - paywall_or_login_page
        - unexpected_error
    web_connector_url_status:
      title: web_connector_url_status
      description: The status of web connector URL processing.
      type: string
      enum:
        - validating
        - success
        - error
    generate_application_input:
      title: generate_application_input
      required:
        - id
        - value
      type: object
      properties:
        id:
          type: string
          description: >-
            The unique identifier for the input field from the application. All input types from the No-code
            application are supported (i.e. Text input, Dropdown, File upload, Image input). The identifier
            should be the name of the input type.
        value:
          type: array
          items:
            type: string
          description: >-
            The value for the input field. 


            If the input type is "File upload", you must pass the `file_id` of an uploaded file. You cannot
            pass a file object directly. See the [file upload
            endpoint](https://dev.writer.com/api-reference/file-api/upload-files) for instructions on
            uploading files or the [list files
            endpoint](https://dev.writer.com/api-reference/file-api/get-all-files) for how to see a list of
            uploaded files and their IDs.
    generate_application_request:
      title: generate_application_request
      required:
        - inputs
      type: object
      properties:
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/generate_application_input'
        stream:
          type: boolean
          description: >-
            Indicates whether the response should be streamed. Currently only supported for research assistant
            applications.
    get_async_application_jobs_response:
      title: get_async_application_jobs_response
      required:
        - result
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/get_async_application_job_response'
        totalCount:
          type: integer
          format: int64
          description: The total number of jobs associated with the application.
        pagination:
          type: object
          properties:
            offset:
              type: integer
              format: int64
              description: The pagination offset for retrieving the jobs.
            limit:
              type: integer
              format: int32
              description: The pagination limit for retrieving the jobs.
    get_async_application_job_response:
      title: get_async_application_job_response
      required:
        - id
        - status
        - application_id
        - created_at
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier for the job.
        status:
          $ref: '#/components/schemas/api_job_status'
        application_id:
          type: string
          description: The ID of the application associated with this job.
        created_at:
          type: string
          format: date-time
          description: The timestamp when the job was created.
        updated_at:
          type: string
          format: date-time
          description: The timestamp when the job was last updated.
        completed_at:
          type: string
          format: date-time
          description: The timestamp when the job was completed.
        data:
          type: object
          description: The result of the completed job, if applicable.
          $ref: '#/components/schemas/generate_application_response'
        error:
          type: string
          description: The error message if the job failed.
    generate_application_async_request:
      title: generate_application_async_request
      required:
        - inputs
      type: object
      properties:
        inputs:
          type: array
          description: A list of input objects to generate content for.
          items:
            $ref: '#/components/schemas/generate_application_input'
    generate_application_async_response:
      title: generate_application_async_response
      required:
        - id
        - status
        - created_at
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier for the async job created.
        status:
          $ref: '#/components/schemas/api_job_status'
        created_at:
          type: string
          format: date-time
          description: The timestamp when the job was created.
    retry_async_application_job_response:
      title: retry_async_application_job_response
      required:
        - job_id
      type: object
      properties:
        job_id:
          type: string
          description: The unique identifier for the retried async job.
        status:
          $ref: '#/components/schemas/api_job_status'
        created_at:
          type: string
          format: date-time
          description: The timestamp when the job was retried.
        application_id:
          type: string
          description: The ID of the application associated with this retried job.
    api_job_status:
      title: api_job_status
      description: The status of the job.
      type: string
      enum:
        - in_progress
        - failed
        - completed
    application_type:
      title: application_type
      description: The type of no-code application.
      type: string
      enum:
        - generation
    get_applications_response:
      title: get_applications_response
      description: Response object containing a paginated list of applications.
      required:
        - data
        - has_more
      type: object
      properties:
        data:
          type: array
          description: List of application objects with their configurations.
          items:
            $ref: '#/components/schemas/application_with_inputs'
        first_id:
          type: string
          format: uuid
          description: UUID of the first application in the current page.
        last_id:
          type: string
          format: uuid
          description: UUID of the last application in the current page.
        has_more:
          type: boolean
          description: Indicates if there are more results available in subsequent pages.
    application_with_inputs:
      title: application_with_inputs
      description: Detailed application object including its input configuration.
      required:
        - id
        - name
        - type
        - status
        - inputs
        - created_at
        - updated_at
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the application.
        name:
          type: string
          description: Display name of the application.
        type:
          $ref: '#/components/schemas/application_type'
        status:
          $ref: '#/components/schemas/application_status'
        inputs:
          type: array
          description: List of input configurations for the application.
          items:
            $ref: '#/components/schemas/application_input'
        created_at:
          type: string
          format: date-time
          description: Timestamp when the application was created.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the application was last updated.
        last_deployed_at:
          type: string
          format: date-time
          description: Timestamp when the application was last deployed.
    application_status:
      title: application_status
      description: >-
        Current deployment status of the application. Note: currently only `deployed` applications are
        returned.
      type: string
      enum:
        - deployed
        - draft
    application_input:
      title: application_input
      description: Configuration for an individual input field in the application.
      required:
        - name
        - input_type
        - required
      type: object
      properties:
        name:
          type: string
          description: Identifier for the input field.
        input_type:
          $ref: '#/components/schemas/application_input_type'
        description:
          type: string
          description: Human-readable description of the input field's purpose.
        required:
          type: boolean
          description: Indicates if this input field is mandatory.
        options:
          $ref: '#/components/schemas/application_input_options'
    application_input_type:
      title: application_input_type
      description: Type of input field determining its behavior and validation rules.
      type: string
      enum:
        - text
        - dropdown
        - file
        - media
    application_input_options:
      description: Type-specific configuration options for input fields.
      oneOf:
        - $ref: '#/components/schemas/application_input_dropdown_options'
        - $ref: '#/components/schemas/application_input_file_options'
        - $ref: '#/components/schemas/application_input_media_options'
        - $ref: '#/components/schemas/application_input_text_options'
    application_input_dropdown_options:
      title: Dropdown
      description: Configuration options specific to dropdown-type input fields.
      required:
        - list
      type: object
      properties:
        list:
          type: array
          description: List of available options in the dropdown menu.
          items:
            type: string
    application_input_file_options:
      title: File
      description: Configuration options specific to file upload input fields.
      required:
        - max_files
        - file_types
        - max_word_count
        - max_file_size_mb
        - upload_types
      type: object
      properties:
        max_files:
          type: integer
          format: int32
          description: Maximum number of files that can be uploaded.
        file_types:
          type: array
          description: List of allowed file extensions.
          items:
            type: string
        max_word_count:
          type: integer
          format: int32
          description: Maximum number of words allowed in text files.
        max_file_size_mb:
          type: integer
          format: int32
          description: Maximum file size allowed in megabytes.
        upload_types:
          type: array
          description: List of allowed upload types for file inputs.
          items:
            $ref: '#/components/schemas/file_upload_type'
    application_input_media_options:
      title: Media
      description: Configuration options specific to media upload input fields.
      required:
        - file_types
        - max_image_size_mb
      type: object
      properties:
        file_types:
          type: array
          description: List of allowed media file types.
          items:
            type: string
        max_image_size_mb:
          type: integer
          format: int32
          description: Maximum media file size allowed in megabytes.
    application_input_text_options:
      title: Text
      description: Configuration options specific to text input fields.
      required:
        - max_fields
        - min_fields
      type: object
      properties:
        max_fields:
          type: integer
          format: int32
          description: Maximum number of text fields allowed.
        min_fields:
          type: integer
          format: int32
          description: Minimum number of text fields required.
    file_upload_type:
      title: file_upload_type
      description: Type of file upload method supported by the application.
      type: string
      enum:
        - url
        - file_id
    generate_application_response:
      title: generate_application_response
      required:
        - suggestion
      type: object
      properties:
        title:
          type: string
          description: The name of the output field.
        suggestion:
          type: string
          description: The response from the model specified in the application.
    generate_application_response_chunk:
      title: generate_application_response_chunk
      required:
        - delta
      type: object
      properties:
        delta:
          $ref: '#/components/schemas/generate_application_delta'
    generate_application_delta:
      title: generate_application_delta
      type: object
      properties:
        title:
          type: string
          description: The name of the output.
        content:
          type: string
          description: The main text output.
        stages:
          type: array
          nullable: true
          description: A list of stages that show the 'thinking process'.
          items:
            $ref: '#/components/schemas/generate_application_chunk_stage'
          minItems: 1
    generate_application_chunk_stage:
      title: generate_application_chunk_stage
      required:
        - id
        - content
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for the stage.
          format: uuid
        content:
          type: string
          description: The text content of the stage.
        sources:
          type: array
          nullable: true
          description: A list of sources (URLs) that that stage used to process that particular step.
          items:
            type: string
          minItems: 1
    question_request:
      title: question_request
      required:
        - graph_ids
        - question
      type: object
      properties:
        graph_ids:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
          description: The unique identifiers of the Knowledge Graphs to query.
        subqueries:
          type: boolean
          description: Specify whether to include subqueries.
          default: false
        question:
          type: string
          description: The question to answer using the Knowledge Graph.
        stream:
          type: boolean
          description: >-
            Determines whether the model's output should be streamed. If true, the output is generated and
            sent incrementally, which can be useful for real-time applications.
          default: false
        query_config:
          $ref: '#/components/schemas/graph_query_config'
          description: >-
            Configuration options for Knowledge Graph queries, including search parameters and citation
            settings.
    question_response_chunk:
      required:
        - data
      type: object
      properties:
        data:
          $ref: '#/components/schemas/question_response'
    question_response:
      title: question_response
      required:
        - question
        - answer
        - sources
      type: object
      properties:
        question:
          type: string
          description: The question that was asked.
        answer:
          type: string
          description: The answer to the question.
        sources:
          type: array
          items:
            $ref: '#/components/schemas/source'
        subqueries:
          type: array
          items:
            $ref: '#/components/schemas/sub_query'
        references:
          $ref: '#/components/schemas/references'
    source:
      title: source
      description: A source snippet containing text and fileId from Knowledge Graph content.
      required:
        - file_id
        - snippet
      type: object
      nullable: true
      properties:
        file_id:
          type: string
          description: The unique identifier of the file in your Writer account.
        snippet:
          type: string
          description: The exact text snippet from the source document that was used to support the response.
    sub_query:
      title: sub_query
      description: >-
        A sub-question generated to break down complex queries into more manageable parts, along with its
        answer and supporting sources.
      required:
        - query
        - answer
        - sources
      type: object
      nullable: true
      properties:
        query:
          type: string
          description: The subquery that was generated to help answer the main question.
        answer:
          type: string
          description: The answer to the subquery based on Knowledge Graph content.
        sources:
          type: array
          description: Array of source snippets that were used to answer this subquery.
          items:
            $ref: '#/components/schemas/source'
    tool:
      type: object
      discriminator:
        propertyName: type
        mapping:
          function: '#/components/schemas/function_tool'
          graph: '#/components/schemas/graph_tool'
          llm: '#/components/schemas/llm_tool'
          translation: '#/components/schemas/translation_tool'
          vision: '#/components/schemas/vision_tool'
          web_search: '#/components/schemas/web_search_tool'
      oneOf:
        - $ref: '#/components/schemas/function_tool'
        - $ref: '#/components/schemas/graph_tool'
        - $ref: '#/components/schemas/llm_tool'
        - $ref: '#/components/schemas/translation_tool'
        - $ref: '#/components/schemas/vision_tool'
        - $ref: '#/components/schemas/web_search_tool'
    function_tool:
      title: Function tool
      required:
        - function
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of tool.
          enum:
            - function
        function:
          $ref: '#/components/schemas/tool_function'
    tool_function:
      title: tool_function
      description: A tool that uses a custom function.
      required:
        - name
      type: object
      properties:
        description:
          type: string
          description: Description of the function.
        name:
          type: string
          description: Name of the function.
        parameters:
          type: object
          additionalProperties: true
          description: The parameters of the function.
    graph_tool:
      title: Graph tool
      required:
        - function
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of tool.
          enum:
            - graph
        function:
          $ref: '#/components/schemas/graph_function'
    graph_function:
      title: graph_function
      description: A tool that uses Knowledge Graphs as context for responses.
      required:
        - graph_ids
        - subqueries
      type: object
      properties:
        description:
          type: string
          description: A description of the graph content.
        graph_ids:
          type: array
          description: An array of graph IDs to use in the tool.
          items:
            type: string
            format: uuid
          minItems: 1
        subqueries:
          type: boolean
          description: Boolean to indicate whether to include subqueries in the response.
        query_config:
          $ref: '#/components/schemas/graph_query_config'
          description: >-
            Configuration options for Knowledge Graph queries, including search parameters and citation
            settings.
    graph_query_config:
      title: graph_query_config
      description: Configuration options for Knowledge Graph queries.
      type: object
      properties:
        max_subquestions:
          type: integer
          format: int32
          minimum: 1
          maximum: 10
          default: 6
          description: >-
            Maximum number of subquestions to generate when processing complex queries. Set higher to improve
            detail, set lower to reduce response time. Range: 1-10, Default: 6.
        search_weight:
          type: integer
          format: int32
          minimum: 0
          maximum: 100
          default: 50
          description: >-
            Weight given to search results when ranking and selecting relevant information. Higher values
            (closer to 100) prioritize keyword-based matching, while lower values (closer to 0) prioritize
            semantic similarity matching. Use higher values for exact keyword searches, lower values for
            conceptual similarity searches. Range: 0-100, Default: 50.
        grounding_level:
          type: number
          format: double
          minimum: 0
          maximum: 1
          default: 0
          description: >-
            Level of grounding required for responses, controlling how closely answers must be tied to source
            material. Set lower for grounded outputs, higher for creativity. Higher values (closer to 1.0)
            allow more creative interpretation, while lower values (closer to 0.0) stick more closely to
            source material. Range: 0.0-1.0, Default: 0.0.
        max_snippets:
          type: integer
          format: int32
          minimum: 1
          maximum: 60
          default: 30
          description: >-
            Maximum number of text snippets to retrieve from the Knowledge Graph for context. Works in concert
            with `search_weight` to control best matches vs broader coverage. While technically supports 1-60,
            values below 5 may return no results due to RAG implementation. Recommended range: 5-25. Due to
            RAG system behavior, you may see more snippets than requested. Range: 1-60, Default: 30.
        max_tokens:
          type: integer
          format: int32
          minimum: 100
          maximum: 8000
          default: 4000
          description: >-
            Maximum number of tokens the model can generate in the response. This controls the length of the
            AI's answer. Set higher for longer answers, set lower for shorter, faster answers. Range:
            100-8000, Default: 4000.
        keyword_threshold:
          type: number
          format: double
          minimum: 0
          maximum: 1
          default: 0.7
          description: >-
            Threshold for keyword-based matching when searching Knowledge Graph content. Set higher for
            stricter relevance, lower for broader range. Higher values (closer to 1.0) require stronger
            keyword matches, while lower values (closer to 0.0) allow more lenient matching. Range: 0.0-1.0,
            Default: 0.7.
        semantic_threshold:
          type: number
          format: double
          minimum: 0
          maximum: 1
          default: 0.7
          description: >-
            Threshold for semantic similarity matching when searching Knowledge Graph content. Set higher for
            stricter relevance, lower for broader range. Higher values (closer to 1.0) require stronger
            semantic similarity, while lower values (closer to 0.0) allow more lenient semantic matching.
            Range: 0.0-1.0, Default: 0.7.
        inline_citations:
          type: boolean
          default: false
          description: >-
            Whether to include inline citations in the response, showing which Knowledge Graph sources were
            used. Default: false.
    llm_tool:
      title: LLM tool
      required:
        - function
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of tool.
          enum:
            - llm
        function:
          $ref: '#/components/schemas/llm_function'
    llm_function:
      title: LLM function
      description: A tool that uses another Writer model to generate a response.
      required:
        - description
        - model
      type: object
      properties:
        description:
          type: string
          description: A description of the model to use.
        model:
          type: string
          description: The model to use.
    vision_tool:
      title: Vision tool
      required:
        - function
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of tool.
          enum:
            - vision
        function:
          $ref: '#/components/schemas/vision_function'
    vision_function:
      title: Vision function
      description: >-
        A tool that uses Palmyra Vision to analyze images and documents. Supports JPG, PNG, PDF, and TXT files
        up to 7MB each.
      required:
        - model
        - variables
      type: object
      properties:
        variables:
          type: array
          items:
            $ref: '#/components/schemas/vision_tool_request_file_variable'
        model:
          type: string
          description: The model to use for image analysis.
          enum:
            - palmyra-vision
    vision_tool_request_file_variable:
      title: Vision Tool Request File Variable
      required:
        - name
        - file_id
      type: object
      properties:
        name:
          type: string
          description: >-
            The name of the file variable. You must reference this name in the `message.content` field of the
            request to the chat completions endpoint. Use double curly braces (`{{}}`) to reference the file.
            For example, `Describe the difference between the image {{image_1}} and the image {{image_2}}`.
        file_id:
          type: string
          description: >-
            The File ID of the file to analyze. The file must be uploaded to the Writer platform before you
            use it with the Vision tool. Supported file types: JPG, PNG, PDF, TXT. The maximum allowed file
            size is 7MB.
    tool_call:
      title: tool_call
      type: object
      required:
        - id
        - type
        - function
      properties:
        index:
          type: integer
          format: int32
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/function'
    tool_call_streaming:
      title: tool_call
      type: object
      required:
        - index
      properties:
        index:
          type: integer
          format: int32
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/function'
    function:
      title: function
      type: object
      required:
        - arguments
      properties:
        name:
          type: string
        arguments:
          type: string
    tool_choice:
      description: >-
        Configure how the model will call functions:

        - `auto`: allows the model to automatically choose the tool to use, or not call a tool

        - `none`: disables tool calling; the model will instead generate a message

        - `required`: requires the model to call one or more tools


        You can also use a JSON object to force the model to call a specific tool. For example, `{"type":
        "function", "function": {"name": "get_current_weather"}}` requires the model to call the
        `get_current_weather` function, regardless of the prompt.
      oneOf:
        - $ref: '#/components/schemas/string_tool_choice'
        - $ref: '#/components/schemas/json_object_tool_choice'
    json_object_tool_choice:
      title: JSON object
      required:
        - value
      type: object
      properties:
        value:
          type: object
          description: >-
            A JSON object that specifies the tool to call. For example, `{"type": "function", "function":
            {"name": "get_current_weather"}}`
          additionalProperties: true
    string_tool_choice:
      title: String
      required:
        - value
      type: object
      properties:
        value:
          $ref: '#/components/schemas/string_tool_choice_options'
    string_tool_choice_options:
      title: string_tool_choice_options
      type: string
      enum:
        - none
        - auto
        - required
    ai_detection_request:
      title: ai_detection_request
      required:
        - input
      type: object
      properties:
        input:
          type: string
          description: >-
            The content to determine if it is AI- or human-generated. Content must have at least 350
            characters.
          example: >-
            AI and ML continue to be at the forefront of technological advancements. In 2025, we can expect
            more sophisticated AI systems that can handle complex tasks with greater efficiency. AI will play
            a crucial role in various sectors, including healthcare, finance, and manufacturing. For instance,
            AI-powered diagnostic tools will become more accurate, helping doctors detect diseases at an early
            stage. In finance, AI algorithms will enhance fraud detection and risk management.
    ai_detection_response:
      title: ai_detection_response
      required:
        - label
        - score
      type: object
      properties:
        label:
          type: string
          enum:
            - fake
            - real
          example: fake
        score:
          type: number
          format: double
          example: 0.6265060305595398
    comprehend_medical_request:
      title: comprehend_medical_request
      required:
        - content
        - response_type
      type: object
      properties:
        content:
          type: string
          description: The text to analyze.
        response_type:
          $ref: '#/components/schemas/comprehend_medical_type'
          description: >-
            The structure of the response to return. `Entities` returns medical entities, `RxNorm` returns
            medication information, `ICD-10-CM` returns diagnosis codes, and `SNOMED CT` returns medical
            concepts.
    comprehend_medical_type:
      title: comprehend_medical_type
      type: string
      enum:
        - Entities
        - RxNorm
        - ICD-10-CM
        - SNOMED CT
    medical_comprehend_response:
      title: medical_comprehend_response
      required:
        - entities
      type: object
      properties:
        entities:
          description: An array of medical entities extracted from the input text.
          type: array
          items:
            $ref: '#/components/schemas/medical_comprehend_entity'
    medical_comprehend_entity:
      title: medical_comprehend_entity
      required:
        - category
        - begin_offset
        - end_offset
        - text
        - traits
        - concepts
        - score
        - attributes
        - type
      type: object
      properties:
        category:
          type: string
        begin_offset:
          type: integer
          format: int64
        end_offset:
          type: integer
          format: int64
        text:
          type: string
        traits:
          type: array
          items:
            $ref: '#/components/schemas/medical_comprehend_trait'
        concepts:
          type: array
          items:
            $ref: '#/components/schemas/medical_comprehend_concept'
        score:
          type: number
          format: double
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/medical_comprehend_attribute'
        type:
          type: string
    medical_comprehend_trait:
      title: medical_comprehend_trait
      required:
        - score
        - name
      type: object
      properties:
        score:
          type: number
          format: double
        name:
          type: string
    medical_comprehend_concept:
      title: medical_comprehend_concept
      required:
        - code
        - score
        - description
      type: object
      properties:
        code:
          type: string
        score:
          type: number
          format: double
        description:
          type: string
    medical_comprehend_attribute:
      title: medical_comprehend_attribute
      required:
        - relationship_score
        - begin_offset
        - end_offset
        - text
        - traits
        - concepts
        - score
        - type
      type: object
      properties:
        category:
          type: string
        relationship_score:
          type: number
          format: double
        begin_offset:
          type: integer
          format: int64
        end_offset:
          type: integer
          format: int64
        text:
          type: string
        traits:
          type: array
          items:
            $ref: '#/components/schemas/medical_comprehend_trait'
        concepts:
          type: array
          items:
            $ref: '#/components/schemas/medical_comprehend_concept'
        score:
          type: number
          format: double
        relationship_type:
          type: string
        type:
          type: string
    context_aware_text_splitting_request:
      title: context_aware_text_splitting_request
      required:
        - text
        - strategy
      type: object
      properties:
        text:
          type: string
          description: The text to split into chunks.
        strategy:
          $ref: '#/components/schemas/splitting_strategy'
          description: >-
            The strategy to use for splitting the text into chunks. `llm_split` uses the language model to
            split the text, `fast_split` uses a fast heuristic-based approach, and `hybrid_split` combines
            both strategies.
    splitting_strategy:
      title: splitting_strategy
      type: string
      enum:
        - llm_split
        - fast_split
        - hybrid_split
    context_aware_splitting_response:
      title: context_aware_splitting_response
      required:
        - chunks
      type: object
      properties:
        chunks:
          type: array
          items:
            type: string
          minItems: 1
          description: An array of text chunks generated by splitting the input text based on the specified strategy.
    parse_pdf_request:
      title: parse_pdf_request
      required:
        - format
      type: object
      properties:
        format:
          $ref: '#/components/schemas/pdf_conversion_format'
    pdf_conversion_format:
      title: pdf_conversion_format
      type: string
      enum:
        - text
        - markdown
      description: The format into which the PDF content should be converted.
    parse_pdf_response:
      title: parse_pdf_response
      required:
        - content
      type: object
      properties:
        content:
          type: string
          description: The extracted content from the PDF file, converted to the specified format.
    text_to_graph_request:
      title: text_to_graph_request
      required:
        - text
      type: object
      properties:
        text:
          type: string
          description: The text to convert into a graph structure. Maximum of 35,000 words.
    text_to_graph_response:
      title: text_to_graph_response
      required:
        - graph
      type: object
      properties:
        graph:
          type: array
          description: >-
            The graph structure generated from the input text, represented by a string array of entities and
            relationships.
          items:
            type: array
            description: >-
              A string array of entities and relationships representing the graph structure generated from the
              input text.
            items:
              type: string
    vision_request:
      title: Vision Request
      required:
        - model
        - prompt
        - variables
      type: object
      properties:
        model:
          type: string
          description: The model to use for image analysis.
          enum:
            - palmyra-vision
        prompt:
          type: string
          description: >-
            The prompt to use for the image analysis. The prompt must include the name of each image variable,
            surrounded by double curly braces (`{{}}`). For example, `Describe the difference between the
            image {{image_1}} and the image {{image_2}}`.
        variables:
          type: array
          items:
            $ref: '#/components/schemas/vision_request_file_variable'
    vision_request_file_variable:
      title: Vision Request File Variable
      description: >-
        An array of file variables required for the analysis. The files must be uploaded to the Writer
        platform before they can be used in a vision request. Learn how to upload files using the [Files
        API](https://dev.writer.com/api-reference/file-api/upload-files).


        Supported file types: JPG, PNG, PDF, TXT. The maximum allowed file size for each file is 7MB.
      required:
        - name
        - file_id
      type: object
      properties:
        name:
          type: string
          description: >-
            The name of the file variable. You must reference this name in the prompt with double curly braces
            (`{{}}`). For example, `Describe the difference between the image {{image_1}} and the image
            {{image_2}}`.
        file_id:
          type: string
          description: >-
            The File ID of the file to analyze. The file must be uploaded to the Writer platform before it can
            be used in a vision request. Supported file types: JPG, PNG, PDF, TXT (max 7MB each).
    vision_response:
      title: Vision Response
      required:
        - data
      type: object
      properties:
        data:
          type: string
          description: The result of the image analysis.
    translation_request:
      title: Translation Request
      required:
        - model
        - source_language_code
        - target_language_code
        - text
        - formality
        - length_control
        - mask_profanity
      type: object
      properties:
        model:
          type: string
          description: The model to use for translation.
          enum:
            - palmyra-translate
        source_language_code:
          type: string
          description: >-
            The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code of the
            original text to translate. For example, `en` for English, `zh` for Chinese, `fr` for French, `es`
            for Spanish. If the language has a variant, the code appends the two-digit [ISO-3166 country
            code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). For example, Mexican Spanish
            is `es-MX`. See the [list of supported languages and language
            codes](https://dev.writer.com/api-reference/translation-api/language-support).
        target_language_code:
          type: string
          description: >-
            The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code of the
            target language for the translation. For example, `en` for English, `zh` for Chinese, `fr` for
            French, `es` for Spanish. If the language has a variant, the code appends the two-digit [ISO-3166
            country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). For example, Mexican
            Spanish is `es-MX`. See the [list of supported languages and language
            codes](https://dev.writer.com/api-reference/translation-api/language-support).
        text:
          type: string
          description: The text to translate. Maximum of 100,000 words.
        formality:
          type: boolean
          description: >-
            Whether to use formal or informal language in the translation. See the [list of languages that
            support
            formality](https://dev.writer.com/api-reference/translation-api/language-support#formality). If
            the language does not support formality, this parameter is ignored.
        length_control:
          type: boolean
          description: >-
            Whether to control the length of the translated text. See the [list of languages that support
            length
            control](https://dev.writer.com/api-reference/translation-api/language-support#length-control). If
            the language does not support length control, this parameter is ignored.
        mask_profanity:
          type: boolean
          description: >-
            Whether to mask profane words in the translated text. See the [list of languages that do not
            support profanity
            masking](https://dev.writer.com/api-reference/translation-api/language-support#profanity-masking).
            If the language does not support profanity masking, this parameter is ignored.
    translation_response:
      title: Translation Response
      required:
        - data
      type: object
      properties:
        data:
          type: string
          description: The result of the translation.
    translation_tool:
      title: Translation tool
      description: >-
        A tool that uses Palmyra Translate to translate text. Note that this tool does not stream results. The
        response is returned after the translation is complete.
      required:
        - function
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of tool.
          enum:
            - translation
        function:
          $ref: '#/components/schemas/translation_function'
    translation_function:
      title: Translation function
      description: A tool that uses Palmyra Translate to translate text.
      required:
        - model
        - formality
        - length_control
        - mask_profanity
      type: object
      properties:
        model:
          type: string
          description: The model to use for translation.
          enum:
            - palmyra-translate
        source_language_code:
          type: string
          description: >-
            Optional. The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language
            code of the original text to translate. For example, `en` for English, `zh` for Chinese, `fr` for
            French, `es` for Spanish. If the language has a variant, the code appends the two-digit [ISO-3166
            country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). If you do not provide
            a language code, the LLM detects the language of the text.
        target_language_code:
          type: string
          description: >-
            Optional. The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language
            code of the target language for the translation. For example, `en` for English, `zh` for Chinese,
            `fr` for French, `es` for Spanish. If the language has a variant, the code appends the two-digit
            [ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). If you do
            not provide a language code, the LLM uses the content of the chat message to determine the target
            language.
        formality:
          type: boolean
          description: >-
            Whether to use formal or informal language in the translation. See the [list of languages that
            support
            formality](https://dev.writer.com/api-reference/translation-api/language-support#formality). If
            the language does not support formality, this parameter is ignored.
        length_control:
          type: boolean
          description: >-
            Whether to control the length of the translated text. See the [list of languages that support
            length
            control](https://dev.writer.com/api-reference/translation-api/language-support#length-control). If
            the language does not support length control, this parameter is ignored.
        mask_profanity:
          type: boolean
          description: >-
            Whether to mask profane words in the translated text. See the [list of languages that do not
            support profanity
            masking](https://dev.writer.com/api-reference/translation-api/language-support#profanity-masking).
            If the language does not support profanity masking, this parameter is ignored.
    web_search_request:
      type: object
      properties:
        query:
          type: string
          description: The search query.
        topic:
          type: string
          enum:
            - general
            - news
          default: general
          description: >-
            The search topic category. Use `news` for current events and news articles, or `general` for
            broader web search.
        search_depth:
          type: string
          enum:
            - basic
            - advanced
          default: basic
          description: |-
            Controls search comprehensiveness:

            - `basic`: Returns fewer but highly relevant results
            - `advanced`: Performs a deeper search with more results
        chunks_per_source:
          type: integer
          format: int32
          description: >-
            Only applies when `search_depth` is `advanced`. Specifies how many text segments to extract from
            each source. Limited to 3 chunks maximum.
        max_results:
          type: integer
          format: int32
          description: Limits the number of search results returned. Cannot exceed 20 sources.
        time_range:
          type: string
          enum:
            - day
            - week
            - month
            - year
            - d
            - w
            - m
            - 'y'
          description: >-
            Filters results to content published within the specified time range back from the current date.
            For example, `week` or `w` returns results from the past 7 days.
        days:
          type: integer
          format: int32
          description: For news topic searches, specifies how many days of news coverage to include.
        include_raw_content:
          oneOf:
            - type: string
              enum:
                - text
                - markdown
            - type: boolean
          default: false
          description: |-
            Controls how raw content is included in search results:

            - `text`: Returns plain text without formatting markup
            - `markdown`: Returns structured content with markdown formatting (headers, links, bold text)
            - `true`: Same as `markdown`
            - `false`: Raw content is not included (default if unset)
        include_answer:
          type: boolean
          default: true
          description: >-
            Whether to include a generated answer to the query in the response. If `false`, only search
            results are returned.
        include_domains:
          type: array
          items:
            type: string
          description: Domains to include in the search. If unset, the search includes all domains.
        exclude_domains:
          type: array
          items:
            type: string
          description: Domains to exclude from the search. If unset, the search includes all domains.
        country:
          type: string
          enum:
            - afghanistan
            - albania
            - algeria
            - andorra
            - angola
            - argentina
            - armenia
            - australia
            - austria
            - azerbaijan
            - bahamas
            - bahrain
            - bangladesh
            - barbados
            - belarus
            - belgium
            - belize
            - benin
            - bhutan
            - bolivia
            - bosnia and herzegovina
            - botswana
            - brazil
            - brunei
            - bulgaria
            - burkina faso
            - burundi
            - cambodia
            - cameroon
            - canada
            - cape verde
            - central african republic
            - chad
            - chile
            - china
            - colombia
            - comoros
            - congo
            - costa rica
            - croatia
            - cuba
            - cyprus
            - czech republic
            - denmark
            - djibouti
            - dominican republic
            - ecuador
            - egypt
            - el salvador
            - equatorial guinea
            - eritrea
            - estonia
            - ethiopia
            - fiji
            - finland
            - france
            - gabon
            - gambia
            - georgia
            - germany
            - ghana
            - greece
            - guatemala
            - guinea
            - haiti
            - honduras
            - hungary
            - iceland
            - india
            - indonesia
            - iran
            - iraq
            - ireland
            - israel
            - italy
            - jamaica
            - japan
            - jordan
            - kazakhstan
            - kenya
            - kuwait
            - kyrgyzstan
            - latvia
            - lebanon
            - lesotho
            - liberia
            - libya
            - liechtenstein
            - lithuania
            - luxembourg
            - madagascar
            - malawi
            - malaysia
            - maldives
            - mali
            - malta
            - mauritania
            - mauritius
            - mexico
            - moldova
            - monaco
            - mongolia
            - montenegro
            - morocco
            - mozambique
            - myanmar
            - namibia
            - nepal
            - netherlands
            - new zealand
            - nicaragua
            - niger
            - nigeria
            - north korea
            - north macedonia
            - norway
            - oman
            - pakistan
            - panama
            - papua new guinea
            - paraguay
            - peru
            - philippines
            - poland
            - portugal
            - qatar
            - romania
            - russia
            - rwanda
            - saudi arabia
            - senegal
            - serbia
            - singapore
            - slovakia
            - slovenia
            - somalia
            - south africa
            - south korea
            - south sudan
            - spain
            - sri lanka
            - sudan
            - sweden
            - switzerland
            - syria
            - taiwan
            - tajikistan
            - tanzania
            - thailand
            - togo
            - trinidad and tobago
            - tunisia
            - turkey
            - turkmenistan
            - uganda
            - ukraine
            - united arab emirates
            - united kingdom
            - united states
            - uruguay
            - uzbekistan
            - venezuela
            - vietnam
            - yemen
            - zambia
            - zimbabwe
          description: Localizes search results to a specific country. Only applies to general topic searches.
        stream:
          type: boolean
          default: false
          description: Enables streaming of search results as they become available.
    web_search_response:
      title: web_search_response
      required:
        - query
        - sources
      type: object
      properties:
        query:
          type: string
          description: The search query that was submitted.
        answer:
          type: string
          description: Generated answer based on the search results. Not included if `include_answer` is `false`.
        sources:
          type: array
          description: The search results found.
          items:
            type: object
            properties:
              url:
                type: string
                description: URL of the search result.
              raw_content:
                type: string
                description: Raw content from the source URL. Not included if `include_raw_content` is `false`.
    web_search_tool:
      title: Web search tool
      required:
        - function
        - type
      type: object
      properties:
        type:
          type: string
          description: The type of tool.
          enum:
            - web_search
        function:
          $ref: '#/components/schemas/web_search_function'
    web_search_function:
      title: web_search_function
      description: A tool that uses web search to find information.
      required:
        - exclude_domains
        - include_domains
      type: object
      properties:
        exclude_domains:
          type: array
          description: An array of domains to exclude from the search results.
          items:
            type: string
        include_domains:
          type: array
          description: An array of domains to include in the search results.
          items:
            type: string
    composite_content:
      title: composite_content
      description: >-
        A union type that can contain either text or image content fragments. This enables chat messages to
        include mixed content types, allowing users to send both text and images in a single message. Note:
        Image fragments are only supported with the Palmyra X5 model.
      oneOf:
        - $ref: '#/components/schemas/text_fragment'
        - $ref: '#/components/schemas/image_fragment'
    text_fragment:
      title: Text
      description: Represents a text content fragment within a chat message.
      required:
        - type
        - text
      type: object
      properties:
        type:
          type: string
          description: The type of content fragment. Must be `text` for text fragments.
          enum:
            - text
        text:
          type: string
          description: The actual text content of the message fragment.
    image_fragment:
      title: Image
      description: >-
        Represents an image content fragment within a chat message. Note: This content type is only supported
        with the Palmyra X5 model.
      required:
        - type
        - image_url
      type: object
      properties:
        type:
          type: string
          description: The type of content fragment. Must be `image_url` for image fragments.
          enum:
            - image_url
        image_url:
          type: object
          description: The image URL object containing the location of the image.
          required:
            - url
          properties:
            url:
              type: string
              description: The URL pointing to the image file. Supports common image formats like JPEG, PNG, GIF, etc.
    references:
      title: references
      description: >-
        Detailed source information organized by reference type, providing comprehensive metadata about the
        sources used to generate the response.
      type: object
      properties:
        files:
          type: array
          description: Array of file-based references from uploaded documents in the Knowledge Graph.
          items:
            $ref: '#/components/schemas/file'
          minItems: 1
        web:
          type: array
          description: Array of web-based references from online sources accessed during the query.
          items:
            $ref: '#/components/schemas/web'
          minItems: 1
    file:
      title: file
      description: A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.
      required:
        - text
        - fileId
        - score
      type: object
      properties:
        text:
          type: string
          description: The exact text snippet from the source document that was used to support the response.
        fileId:
          type: string
          description: The unique identifier of the file in your Writer account.
        score:
          type: number
          description: Internal score used during the retrieval process for ranking and selecting relevant snippets.
        page:
          type: integer
          format: int32
          description: Page number where this snippet was found in the source document.
        cite:
          type: string
          description: Unique citation ID that appears in inline citations within the response text (null if not cited).
    web:
      title: web
      description: A web-based reference containing text snippets from online sources accessed during the query.
      required:
        - text
        - url
        - title
        - score
      type: object
      properties:
        text:
          type: string
          description: The exact text snippet from the web source that was used to support the response.
        url:
          type: string
          description: The URL of the web page where this content was found.
          format: uri
        title:
          type: string
          description: The title of the web page where this content was found.
        score:
          type: number
          description: Internal score used during the retrieval process for ranking and selecting relevant snippets.