silicon-iam-cli 1.2.2

Command-line client for Silicon IAM, built on the silicon-iam-client crate.
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
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
openapi: 3.1.0
info:
  title: Silicon IAM API
  version: 1.0.0
  summary: Secure identity, organization governance, application login, and delegated access.
  description: |
    Normative public and privileged HTTP contract for Silicon IAM. PostgreSQL is
    authoritative; webhook delivery never substitutes for online authorization.
    Timestamps are UTC RFC 3339 values. One-time secret responses can be replayed
    for ten minutes only by the same caller using the same route, request digest,
    and Idempotency-Key.
    IAM-managed six-digit OTPs expire after ten minutes. Signup, Carbon login,
    invitation-join, and verified-channel step-up challenges allow ten failed
    verifications, then enter a 60-second cooldown before the current unexpired
    challenge receives a fresh ten-attempt window. Replacement codes inherit
    the partial failed-attempt count or active cooldown.
  contact: { email: auth@teamofsilicons.com }
servers:
  - { url: 'https://backend.iam.teamofsilicons.com', description: Production }
tags:
  - { name: System }
  - { name: Carbon signup }
  - { name: Carbon authentication }
  - { name: Carbon account }
  - { name: OAuth }
  - { name: Organizations }
  - { name: Memberships }
  - { name: Invitations }
  - { name: Silicons }
  - { name: Tags }
  - { name: Trust }
  - { name: Governance }
  - { name: SSO }
  - name: Applications
    description: >-
      Applications are organization-owned. Non-platform Application management
      requires a direct Carbon IAM bearer and current active owner/admin
      membership in the Application's organization.
  - name: OBO Access
    description: >-
      Strictly same-organization Application discovery, request-bound proof
      exchange, and single-use audience verification.
  - { name: Webhooks }
  - name: Testing environments
    description: >-
      A testing environment is an organization-owned replica of Silicon IAM
      running against a separate database and starting completely empty. Every
      plane-selectable route accepts an `X-Testing-Environment-Key` header; supplying one
      executes that request inside the named environment instead of production,
      against the same contract. OTP delivery is suppressed and verification
      accepts `000000`. Test webhook deliveries are explicitly marked and
      carry their environment key. Organization-prefixed lifecycle routes in
      this section always operate on production; the singular test-only routes
      require the environment header.
  - { name: Platform administration }

paths:
  /healthz:
    get:
      tags: [System]
      operationId: getLiveness
      security: []
      responses:
        '200': { $ref: '#/components/responses/HealthOk' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /readyz:
    get:
      tags: [System]
      operationId: getReadiness
      description: >-
        Verifies the production database schema and, when configured, the
        shared testing database's base plus testing-overlay migration ledgers.
      security: []
      responses:
        '200': { $ref: '#/components/responses/HealthOk' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/version:
    get:
      tags: [System]
      operationId: negotiateApiVersion
      summary: Negotiate a public API version before using any versioned route.
      description: >-
        The client advertises every API major it implements in descending
        preference order. IAM selects the highest common version. Official
        clients fail closed when no common version exists or the response does
        not match the advertised intersection.
      security: []
      parameters:
        - name: Silicon-IAM-Supported-API-Versions
          in: header
          required: true
          description: Comma-separated distinct API majors in descending client preference order.
          schema:
            type: string
            minLength: 2
            maxLength: 255
            pattern: '^v[1-9][0-9]{0,8}(, *v[1-9][0-9]{0,8}){0,15}$'
      responses:
        '200':
          description: The client and server agreed on the highest common API version.
          headers:
            Silicon-IAM-API-Version:
              required: true
              schema: { type: string, pattern: '^v[1-9][0-9]{0,8}$' }
            Vary:
              required: true
              schema: { const: Silicon-IAM-Supported-API-Versions }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApiVersionNegotiation' }
        '406': { $ref: '#/components/responses/NotAcceptable' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
  /api/v1/version:
    get:
      tags: [System]
      operationId: getVersion
      security: []
      responses:
        '200':
          description: Running contract and build version.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/VersionInfo' }
  /api/v1/signup/sessions:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon signup]
      operationId: createSignupSession
      security: []
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      responses:
        '201':
          description: Signup session created for 48 hours.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/AuthSession' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/signup/sessions/{session_id}/email:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon signup]
      operationId: sendSignupEmailCode
      security: []
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/EmailInput' }
      responses:
        '202': { $ref: '#/components/responses/CodeDispatchAccepted' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/signup/sessions/{session_id}/email/verify:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon signup]
      operationId: verifySignupEmail
      security: []
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody: { $ref: '#/components/requestBodies/VerificationCode' }
      responses:
        '200': { $ref: '#/components/responses/Verified' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/signup/sessions/{session_id}/phone:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon signup]
      operationId: sendSignupPhoneCode
      security: []
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/PhoneInput' }
      responses:
        '202': { $ref: '#/components/responses/CodeDispatchAccepted' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/signup/sessions/{session_id}/phone/verify:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon signup]
      operationId: verifySignupPhone
      security: []
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody: { $ref: '#/components/requestBodies/VerificationCode' }
      responses:
        '200': { $ref: '#/components/responses/Verified' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/signup/sessions/{session_id}/complete:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon signup]
      operationId: completeCarbonSignup
      security: []
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/CarbonSignupComplete' }
      responses:
        '201':
          description: Carbon created after verified identities are rechecked atomically.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/CarbonSelf' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/carbon-ids/{carbon_id}/availability:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Carbon signup]
      operationId: checkCarbonIdAvailability
      security: []
      parameters: [{ $ref: '#/components/parameters/CarbonIdPath' }]
      responses:
        '200':
          description: Current availability; this does not reserve the handle.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Availability' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/carbons/search:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Carbon account]
      operationId: searchCarbons
      security: [{ iamBearer: [] }]
      parameters:
        - { name: q, in: query, required: true, schema: { type: string, minLength: 1, maxLength: 100 } }
        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 10, default: 10 } }
      responses:
        '200':
          description: Zero to ten fuzzy Carbon ID suggestions; no profile or contact data is returned.
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: { type: array, maxItems: 10, items: { $ref: '#/components/schemas/CarbonSuggestion' } }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/carbons/resolve/email:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon account]
      operationId: resolveCarbonByEmail
      description: Resolve an exact active verified email to its Carbon ID. Only an authenticated direct Carbon may call this endpoint.
      security: [{ iamBearer: [] }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/EmailInput' }
      responses:
        '200':
          description: Exact active Carbon identity resolved.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/CarbonResolution' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/carbons/resolve/phone:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon account]
      operationId: resolveCarbonByPhone
      description: Resolve an exact active verified phone number to its Carbon ID. Only an authenticated direct Carbon may call this endpoint.
      security: [{ iamBearer: [] }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/PhoneInput' }
      responses:
        '200':
          description: Exact active Carbon identity resolved.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/CarbonResolution' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/login:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Login]
      operationId: startLogin
      summary: Sign in, and mint a short-lived token for an application.
      description: |
        Naming an `app_id` makes this a login on that application's behalf and
        produces a short-lived token; omitting it is an ordinary Silicon IAM
        login and produces none. A `redirect_uri` decides delivery only: given
        one, the token is appended to it as `slt` and the browser is sent there;
        without one the token is rendered on a page, because there is nowhere to
        send it. The token is valid for two minutes and for a single exchange.
      security: [{ sessionCookie: [] }]
      parameters:
        - { name: app_id, in: query, schema: { $ref: '#/components/schemas/AppId' } }
        - { name: redirect_uri, in: query, schema: { type: string, format: uri, maxLength: 2048 } }
        - { name: org_id, in: query, schema: { $ref: '#/components/schemas/OrgId' } }
      responses:
        '200':
          description: The short-lived token rendered as HTML, when no redirect URI was given.
          content: { text/html: { schema: { type: string } } }
        '302':
          description: The given redirect URI with the short-lived token appended as `slt`.
          headers: { Location: { schema: { type: string, format: uri } } }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/login/status:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Login]
      operationId: readLoginStatus
      summary: Report what became of a short-lived token that was shown.
      description: |
        The page that shows a token cannot run a script, so it carries a meta
        refresh onto this route timed to the token's expiry. By then the token
        has either been exchanged, and the login worked, or it has expired.
      security: [{ sessionCookie: [] }]
      parameters:
        - { name: request, in: query, required: true, schema: { type: string, format: uuid } }
      responses:
        '200':
          description: Whether the token was exchanged or expired, as HTML.
          content: { text/html: { schema: { type: string } } }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
  /api/v1/app-auth/tokens:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Login]
      operationId: exchangeApplicationToken
      summary: Trade a short-lived token, or a refresh token, for a session.
      description: |
        The application authenticates itself the same way in both cases, so
        which one it is asking for is simply which credential it presented.
        Present exactly one of `slt` and `refresh_token`.
      security: [{ applicationBasic: [] }]
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema: { $ref: '#/components/schemas/ApplicationTokenRequest' }
      responses:
        '200':
          description: Opaque access token and rotating refresh token.
          headers:
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/OAuthTokenResponse' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/app-auth/short-lived-tokens:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Login]
      operationId: issueShortLivedToken
      summary: Get a short-lived token while already signed in.
      description: |
        For a caller that already holds a session -- a Silicon, which has no
        browser to be redirected in, or a Carbon that should not have to start
        another login. The token is valid for two minutes and for a single
        exchange, and the application completes it at /api/v1/app-auth/tokens
        exactly as it would one delivered through a redirect.
      security: [{ bearerAuth: [] }]
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ShortLivedTokenRequest' }
      responses:
        '201':
          description: The short-lived token and its lifetime in seconds.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ShortLivedToken' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/oauth/introspect:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [OAuth]
      operationId: introspectOAuthToken
      security: [{ applicationBasic: [] }]
      parameters: [{ $ref: '#/components/parameters/OrgContext' }]
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema: { $ref: '#/components/schemas/TokenIntrospectionRequest' }
      responses:
        '200':
          description: Activity after current revocation and membership checks.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TokenIntrospection' }
        '400':
          description: The token-type hint or optional X-Org-ID header is malformed or duplicated.
          content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/oauth/revoke:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [OAuth]
      operationId: revokeOAuthToken
      description: |
        Revoking an access token invalidates that token only. Revoking a refresh
        token invalidates its complete refresh family and access authority issued
        for the same Application session. Unknown tokens deliberately succeed.
      security: [{ applicationBasic: [] }]
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema: { $ref: '#/components/schemas/OAuthRevocationRequest' }
      responses:
        '200':
          description: Revocation accepted; unknown tokens also return 200.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/login/challenges:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication]
      operationId: createLoginChallenge
      security: []
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/LoginChallengeCreate' }
      responses:
        '201':
          description: Challenge created for an existing Carbon; Carbon-ID login may dispatch to both verified channels.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/AuthSession' }
        '404':
          description: No active Carbon exists for the submitted email, phone number, or Carbon ID.
          content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/login/challenges/{session_id}/verify:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication]
      operationId: verifyLoginChallenge
      security: []
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody: { $ref: '#/components/requestBodies/VerificationCode' }
      responses:
        '200':
          description: Carbon session established and every code in the challenge consumed.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/IamTokenResponse' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/step-up/challenges:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication]
      operationId: createStepUpChallenge
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/StepUpChallengeCreate' }
      responses:
        '201':
          description: Reauthentication code sent to a verified channel.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/AuthSession' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/step-up/challenges/{session_id}/verify:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication]
      operationId: verifyStepUpChallenge
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody: { $ref: '#/components/requestBodies/VerificationCode' }
      responses:
        '200':
          description: Five-minute action-bound step-up token.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/StepUpTokenResponse' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/auth/tokens/refresh:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication]
      operationId: refreshIamToken
      security: []
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/RefreshTokenRequest' }
      responses:
        '200':
          description: Rotated tokens; reuse of a consumed refresh token revokes its family.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/IamTokenResponse' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/logout:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication]
      operationId: logout
      description: >-
        Revokes the current session immediately by default. If all_sessions
        would revoke another active session, every target and the authenticating
        session must be at least 12 hours old and X-Step-Up-Token must carry a
        verified-channel account.sessions_revoke_all assertion bound to the
        current Carbon principal. Browser-cookie authentication additionally
        requires X-CSRF-Token to exactly match the token bound into the signed
        session cookie; bearer authentication does not. The operation fails
        atomically if any active target is younger. A Carbon OAuth bearer may
        also trigger logout only when its client is its audience; that form
        revokes every IAM and Application authority bound to the parent session
        across configured Applications and cannot select all_sessions.
      security: [{ iamBearer: [] }, { sessionCookie: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - name: X-Step-Up-Token
          in: header
          required: false
          description: Required only when all_sessions would revoke another active session.
          schema: { type: string, pattern: '^sup_[A-Za-z0-9_-]{43}$' }
        - name: X-CSRF-Token
          in: header
          required: false
          description: Required only with sessionCookie authentication; it must exactly match the cookie-bound CSRF token.
          schema: { type: string, minLength: 32, maxLength: 512 }
      requestBody:
        required: false
        content:
          application/json:
            schema: { $ref: '#/components/schemas/LogoutRequest' }
      responses:
        '204':
          description: Selected families revoked and application logout events queued.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }

  /api/v1/me:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Carbon account]
      operationId: getCurrentCarbon
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Current Carbon including self-only contact details.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/CarbonSelf' }
        '401': { $ref: '#/components/responses/Unauthorized' }
    patch:
      tags: [Carbon account]
      operationId: updateCurrentCarbon
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/CarbonProfilePatch' }
      responses:
        '200':
          description: Profile updated.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/CarbonSelf' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/me/sessions:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Carbon account]
      operationId: listCurrentCarbonSessions
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Active and recently revoked session families.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SessionPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
  /api/v1/me/sessions/{session_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    delete:
      tags: [Carbon account]
      operationId: revokeCurrentCarbonSession
      description: >-
        Revokes one active session after it is at least 12 hours old. Revoking a
        different session also requires the authenticating session to be at
        least 12 hours old. X-Step-Up-Token must carry a verified-channel
        account.session_revoke assertion bound to session_id. Immediate
        current-session logout remains available through POST /api/v1/logout.
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/SessionId' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '204':
          description: Session family revoked.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/me/login-history:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Carbon account]
      operationId: listCurrentCarbonLoginHistory
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: User-wide and application login events.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/LoginEventPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
  /api/v1/silicon-auth/token:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Carbon authentication, Silicons]
      operationId: authenticateSilicon
      security: []
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/SiliconAuthenticationRequest' }
      responses:
        '200':
          description: Independently generated Silicon access and refresh tokens.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/IamTokenResponse' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/organization-ids/{org_id}/availability:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Organizations]
      operationId: checkOrganizationIdAvailability
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/OrgIdPath' }]
      responses:
        '200':
          description: Current availability; no reservation is created.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Availability' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Organizations]
      operationId: listOrganizations
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: status, in: query, schema: { type: string, enum: [active, removed] } }
      responses:
        '200':
          description: Organizations for the authenticated Carbon; Silicons are forbidden.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/OrganizationPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    post:
      tags: [Organizations]
      operationId: createOrganization
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/OrganizationCreate' }
      responses:
        '201':
          description: Organization and sole owner membership created atomically.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Organization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}:
    parameters: [{ $ref: '#/components/parameters/OrgIdPath' }, { $ref: '#/components/parameters/TestingEnvironmentSelection' }]
    get:
      tags: [Organizations]
      operationId: getOrganization
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Non-secret organization configuration visible to an active member.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Organization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    patch:
      tags: [Organizations]
      operationId: updateOrganization
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/OrganizationPatch' }
      responses:
        '200':
          description: Organization updated; org_id is immutable.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Organization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/ownership-transfers:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Organizations, Governance]
      operationId: transferOrganizationOwnership
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/OwnershipTransfer' }
      responses:
        '200':
          description: Owner swapped atomically; the previous owner becomes an admin with no delegated capabilities.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Organization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }

  /api/v1/organizations/{org_id}/members:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Memberships]
      operationId: listOrganizationMembers
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: principal_type, in: query, schema: { type: string, enum: [carbon, silicon] } }
        - { name: tag_id, in: query, schema: { type: string, format: uuid } }
        - { name: status, in: query, schema: { type: string, enum: [active, removed] } }
      responses:
        '200':
          description: Typed membership directory page.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/MembershipPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /api/v1/organizations/{org_id}/members/{membership_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/MembershipIdPath' }
    get:
      tags: [Memberships]
      operationId: getOrganizationMember
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Membership directory record.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Membership' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    patch:
      tags: [Memberships]
      operationId: updateOrganizationMemberDirectory
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/MembershipDirectoryPatch' }
      responses:
        '200':
          description: First Silicon, extra Silicons, profile data, or reporting line updated; tags and job_role use governed request workflows.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Membership' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    delete:
      tags: [Memberships]
      operationId: removeOrganizationMember
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
        - name: reassign_reports_to
          in: query
          description: Required replacement Silicon membership when removing a Silicon with direct reports.
          schema: { type: string, format: uuid }
      responses:
        '204':
          description: Authority revoked immediately; membership identity and history are retained.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/members/{membership_id}/authorization:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/MembershipIdPath' }
    get:
      tags: [Memberships, Governance]
      operationId: getOrganizationMemberAuthorization
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Organization tier, delegated capabilities, and authorization epoch.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/MembershipAuthorization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /api/v1/organizations/{org_id}/members/{membership_id}/admin-promotions:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Memberships, Governance]
      operationId: promoteOrganizationMemberToAdmin
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '200':
          description: Active Carbon member promoted to admin with no implicit capabilities.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/MembershipAuthorization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/members/{membership_id}/admin-demotions:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Memberships, Governance]
      operationId: demoteOrganizationAdmin
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '200':
          description: Admin demoted to member and all organization capabilities revoked.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/MembershipAuthorization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/members/{membership_id}/capabilities:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    put:
      tags: [Memberships, Governance]
      operationId: replaceOrganizationMemberCapabilities
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/OrganizationCapabilitiesReplace' }
      responses:
        '200':
          description: Explicit organization capabilities replaced without changing org_role.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/MembershipAuthorization' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/directory/self:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Memberships]
      operationId: getOrganizationDirectorySelf
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/DirectoryFields' }
      responses:
        '200':
          description: The requester's active organization-directory projection. Trust is evaluated only for Carbon-to-Silicon or Silicon-to-Silicon and is null for rows with no defined direction.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/DirectoryMember' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
  /api/v1/organizations/{org_id}/directory/members:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Memberships]
      operationId: listOrganizationDirectoryMembers
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { $ref: '#/components/parameters/DirectoryFields' }
      responses:
        '200':
          description: Active team members projected from the requester's point of view; trust is null for Carbon rows because Carbon-to-Carbon and Silicon-to-Carbon are undefined.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/DirectoryPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
  /api/v1/organizations/{org_id}/directory/members/{membership_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Memberships]
      operationId: getOrganizationDirectoryMember
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/DirectoryFields' }
      responses:
        '200':
          description: One active team member projected from the requester's point of view; trust is null when the requester-to-row direction is undefined.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/DirectoryMember' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }

  /api/v1/organizations/{org_id}/carbon-invites:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Invitations]
      operationId: listCarbonInvitations
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: status, in: query, schema: { $ref: '#/components/schemas/InviteStatus' } }
      responses:
        '200':
          description: Invitations visible to the owner or callers with members.invite.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/InvitePage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    post:
      tags: [Invitations]
      operationId: createCarbonInvitation
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/CarbonInviteCreate' }
      responses:
        '201':
          description: 48-hour invitation created for an existing Carbon; org_role is always member.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Invite' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/carbon-invites/{invite_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/InviteIdPath' }
    get:
      tags: [Invitations]
      operationId: getCarbonInvitation
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Invitation with masked target identity.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Invite' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    delete:
      tags: [Invitations]
      operationId: revokeCarbonInvitation
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '204':
          description: Pending invitation and its OTP challenges revoked.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/join/email-verification-code:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Invitations]
      operationId: initiateEmailInvitationJoin
      description: >-
        An authenticated direct Carbon submits the invited email. The service
        verifies that it is the exact active verified address immutably bound
        when that Carbon's invitation was created and that a pending unexpired
        invitation exists for this active email-join organization, then creates
        a pending challenge and sends the six-digit Postmark OTP outside the
        database transaction. The challenge becomes deliverable and the
        endpoint succeeds only after provider confirmation. The
        response exposes only the invitation ID needed by the join request and
        the code lifetime, never contact data. Ten attempts per Carbon and
        organization, including misses and varied emails, start a complete
        60-second cooldown. A successful idempotent replay does not consume an
        additional attempt.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/EmailInput' }
      responses:
        '202':
          description: Matching invitation resolved and Postmark confirmed delivery acceptance for its replacement code.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/InvitationEmailCodeResponse' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404':
          description: The authenticated Carbon has no matching usable invitation (`not_invited`).
          content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/organizations/{org_id}/join:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Invitations, Memberships]
      operationId: joinOrganizationByEmailInvite
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/InvitationAcceptance' }
      responses:
        '200':
          description: Membership created or deliberately reactivated with the invitation directory and trust snapshot applied atomically.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Membership' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/organizations/{org_id}/silicons:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Silicons]
      operationId: listOrganizationSilicons
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: tag_id, in: query, schema: { type: string, format: uuid } }
      responses:
        '200':
          description: Active Silicons in the organization.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    post:
      tags: [Silicons]
      operationId: createSilicon
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/SiliconCreate' }
      responses:
        '201':
          description: Active Silicon profile and 32-hex-character raw token created; webhook configuration is independent.
          headers:
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconCreated' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/silicons/{silicon_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/SiliconIdPath' }
    get:
      tags: [Silicons]
      operationId: getSilicon
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Silicon profile, immutable directory identity, and hierarchy level.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Silicon' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    patch:
      tags: [Silicons]
      operationId: updateSilicon
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/SiliconPatch' }
      responses:
        '200':
          description: Mutable profile or hierarchy fields updated; public IDs and job role remain unchanged.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Silicon' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
    delete:
      tags: [Silicons]
      operationId: removeSilicon
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
        - name: reassign_reports_to
          in: query
          description: Required replacement Silicon when direct reports exist.
          schema: { type: string, format: uuid }
      responses:
        '204':
          description: 'Silicon disabled, credentials revoked, reports reassigned, and events queued.'
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/silicons/{silicon_id}/webhook:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/SiliconIdPath' }
    get:
      tags: [Silicons, Webhooks]
      operationId: getSiliconWebhook
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Active subscriber-managed endpoint. The signing secret is never returned by GET.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconWebhook' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
    put:
      tags: [Silicons, Webhooks]
      operationId: replaceSiliconWebhook
      description: >-
        Configures or replaces the HTTPS endpoint and rotates its signing secret.
        A Carbon manager must also present verified-channel step-up. If an active
        endpoint already exists, If-Match is required; initial creation has no
        existing representation and may omit it.
      x-carbon-step-up-assurance: verified_channel
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - name: If-Match
          in: header
          required: false
          description: Strong current endpoint ETag; required when replacing an existing endpoint.
          schema: { type: string, pattern: '^"[0-9]+"$' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/SiliconWebhookReplace' }
      responses:
        '200':
          description: Endpoint active; the new HMAC secret is shown only in this no-store response.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconWebhookConfigured' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    delete:
      tags: [Silicons, Webhooks]
      operationId: deleteSiliconWebhook
      description: Disables the endpoint, retires its signing keys, and removes its subscription.
      x-carbon-step-up-assurance: verified_channel
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '204':
          description: Endpoint disabled and subscription removed.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }

  /api/v1/organizations/{org_id}/silicons/{silicon_id}/webhook/dead-letters:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Silicons, Webhooks]
      operationId: listSiliconWebhookDeadLetters
      description: Lists only dead letters currently visible to this Silicon recipient or its authorized Carbon manager.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/SiliconIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Recipient-scoped dead-letter page in reverse dead-letter order.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WebhookDeadLetterPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/silicons/{silicon_id}/webhook/dead-letters/replays:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Silicons, Webhooks]
      operationId: replaySiliconWebhookDeadLetters
      description: >-
        Reauthorizes the current endpoint and subscription, then requeues up to
        100 exact deliveries in original event order using the current URL and
        signing secret. Original event identity, payload, occurrence time,
        aggregate version, and attempt history are preserved.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/SiliconIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/WebhookReplayRequest' }
      responses:
        '202':
          description: Authorized dead letters were reset for ordered redelivery.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WebhookReplayResponse' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/organizations/{org_id}/silicons/{silicon_id}/webhook/subscription:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/SiliconIdPath' }
    get:
      tags: [Silicons, Webhooks]
      operationId: getSiliconWebhookSubscription
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Active topic and tag-filter subscription.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconWebhookSubscription' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
    put:
      tags: [Silicons, Webhooks]
      operationId: replaceSiliconWebhookSubscription
      description: >-
        Creates or replaces the subscription. An active endpoint must already
        exist. A Carbon manager must also present verified-channel step-up. If a
        subscription already exists, If-Match is required; initial creation may
        omit it.
      x-carbon-step-up-assurance: verified_channel
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - name: If-Match
          in: header
          required: false
          description: Strong current subscription ETag; required when replacing an existing subscription.
          schema: { type: string, pattern: '^"[0-9]+"$' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/SiliconWebhookSubscriptionReplace' }
      responses:
        '200':
          description: Canonical subscription created or replaced.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconWebhookSubscription' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    delete:
      tags: [Silicons, Webhooks]
      operationId: deleteSiliconWebhookSubscription
      description: Removes the subscription without changing the configured endpoint.
      x-carbon-step-up-assurance: verified_channel
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '204':
          description: Subscription removed; delivery stops.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/silicons/{silicon_id}/token-rotation-requests:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Silicons, Governance]
      operationId: requestSiliconTokenRotation
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/SiliconIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '201':
          description: Immutable owner-approval request created.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApprovalRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/silicons/{silicon_id}/token-rotation-requests/{request_id}/complete:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Silicons, Governance]
      operationId: completeSiliconTokenRotation
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/SiliconIdPath' }
        - { $ref: '#/components/parameters/ApprovalRequestIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: >-
            Generates and reveals the replacement credential after approval has
            already invalidated the old credential and revoked its session and
            token authority.
          headers:
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SiliconTokenRotated' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/organizations/{org_id}/tags:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Tags]
      operationId: listOrganizationTags
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Normalized organization-scoped tags.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TagPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    post:
      tags: [Tags]
      operationId: createOrganizationTag
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TagCreate' }
      responses:
        '201':
          description: Tag created.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Tag' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/tags/{tag_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TagIdPath' }
    get:
      tags: [Tags]
      operationId: getOrganizationTag
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Tag.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Tag' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    patch:
      tags: [Tags]
      operationId: updateOrganizationTag
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/TagPatch' }
      responses:
        '200':
          description: Tag renamed without changing its stable identifier.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Tag' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
    delete:
      tags: [Tags]
      operationId: deleteOrganizationTag
      security: [{ iamBearer: [] }]
      description: >-
        Deletes a tag. Requires `tags.manage`, which owners hold implicitly and
        admins by grant. The tag stops existing for every caller: it leaves
        listings and member projections immediately, stops conferring Silicon
        access, and its name becomes available again. The cascade is atomic --
        assignments are removed from every member who held it, tag-scoped trust
        rules are archived, and the affected members' authorization epochs
        advance so cached authority is invalidated at once. The removal is
        recorded in each affected member's tag history and published as
        `organization.tag_archived.v1`.
      parameters:
        - { $ref: '#/components/parameters/IfMatch' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '204':
          description: Tag deleted.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/tags/{tag_id}/members:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Tags, Memberships]
      operationId: listOrganizationTagMembers
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/TagIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Carbon and Silicon memberships assigned to the tag.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/MembershipPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }

  /api/v1/organizations/{org_id}/trust/default:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Trust]
      operationId: getOrganizationDefaultTrust
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/OrgIdPath' }]
      responses:
        '200':
          description: Organization default trust, initially internal/not_trusted.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustValue' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    put:
      tags: [Trust]
      operationId: replaceOrganizationDefaultTrust
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TrustValue' }
      responses:
        '200':
          description: Advisory default replaced.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustValue' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/trust/rules:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Trust]
      operationId: listTrustRules
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Typed advisory trust rules.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustRulePage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    post:
      tags: [Trust]
      operationId: createTrustRule
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TrustRuleCreate' }
      responses:
        '201':
          description: Advisory rule created.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustRule' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/trust/rules/{rule_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TrustRuleIdPath' }
    get:
      tags: [Trust]
      operationId: getTrustRule
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Trust rule.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustRule' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    patch:
      tags: [Trust]
      operationId: updateTrustRule
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/TrustRulePatch' }
      responses:
        '200':
          description: Trust rule updated.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustRule' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
    delete:
      tags: [Trust]
      operationId: deleteTrustRule
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '204':
          description: Rule deleted.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/trust/effective:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Trust]
      operationId: evaluateEffectiveTrust
      description: >-
        Uses a Carbon subject's membership-wide default or the organization
        default for a Silicon subject, then applies tag and exact-Silicon rules.
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/OrgIdPath' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TrustEvaluationRequest' }
      responses:
        '200':
          description: Advisory value and matching-rule explanation; never an authorization decision.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TrustEvaluation' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }

  /api/v1/organizations/{org_id}/role-change-requests:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Governance]
      operationId: createRoleChangeRequest
      description: Only an active Silicon may create this governed request; regular Carbons use no request path.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/RoleChangeRequestCreate' }
      responses:
        '201':
          description: Immutable approval request created with target-specific quorum.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApprovalRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
  /api/v1/organizations/{org_id}/approval-requests:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Governance]
      operationId: listApprovalRequests
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: status, in: query, schema: { $ref: '#/components/schemas/ApprovalStatus' } }
        - { name: kind, in: query, schema: { $ref: '#/components/schemas/ApprovalKind' } }
        - { name: actionable_by_me, in: query, schema: { type: boolean } }
      responses:
        '200':
          description: Pending and historical requests visible to the caller.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApprovalRequestPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /api/v1/organizations/{org_id}/approval-requests/{request_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Governance]
      operationId: getApprovalRequest
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/ApprovalRequestIdPath' }
      responses:
        '200':
          description: Immutable request and collected decisions.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApprovalRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /api/v1/organizations/{org_id}/approval-requests/{request_id}/decisions:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Governance]
      operationId: decideApprovalRequest
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/ApprovalRequestIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
        - name: X-Step-Up-Token
          in: header
          required: false
          description: Required with verified-channel assurance when deciding a Silicon token-rotation request.
          schema: { type: string, pattern: '^sup_[A-Za-z0-9_-]{43}$' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ApprovalDecisionCreate' }
      responses:
        '200':
          description: >-
            Unique decision recorded. Terminal job-role/tag changes apply
            exactly once. Approval of a Silicon credential rotation immediately
            invalidates the old credential and its token/session authority but
            does not generate the replacement secret.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApprovalRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/members/{membership_id}/job-role:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    put:
      tags: [Governance]
      operationId: replaceMemberJobRole
      description: >-
        A Carbon owner, or an admin with roles.approve, directly replaces the
        descriptive job role for any active Carbon or Silicon and appends
        immutable direct-actor history.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/DirectJobRoleReplace' }
      responses:
        '200':
          description: Job role replaced directly and history appended.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Membership' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/organizations/{org_id}/members/{membership_id}/job-role-history:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Governance]
      operationId: listMemberJobRoleHistory
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Applied job-role changes and their approvers.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/RoleHistoryPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }

  /api/v1/organizations/{org_id}/members/{membership_id}/tag-change-requests:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Governance]
      operationId: createMemberTagChangeRequest
      description: Only an active Silicon may request this tag-set change for an active Carbon or Silicon target.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TagChangeRequestCreate' }
      responses:
        '201':
          description: >-
            Immutable tag-change request created. Carbon targets require the
            affected Carbon and an eligible owner/admin; Silicon targets
            require an eligible owner/admin.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApprovalRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/organizations/{org_id}/members/{membership_id}/tags:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    put:
      tags: [Governance, Tags]
      operationId: replaceMemberTags
      description: >-
        A Carbon owner, or an admin with tags.manage, atomically replaces the
        complete active tag set for any active Carbon or Silicon, advances its
        authorization epoch, and appends immutable direct-actor history.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/DirectTagSetReplace' }
      responses:
        '200':
          description: Complete membership tag set replaced directly.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Membership' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/organizations/{org_id}/members/{membership_id}/tag-history:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Governance]
      operationId: listMemberTagHistory
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/MembershipIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Applied membership tag sets with their requester and approvers.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TagHistoryPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }

  /api/v1/organizations/{org_id}/testing-environments:
    parameters:
      - { $ref: '#/components/parameters/OrgIdPath' }
    get:
      tags: [Testing environments]
      operationId: listTestingEnvironments
      security: [{ iamBearer: [] }]
      description: Lists the organization's environments. Deleted environments are hidden unless `status` asks for them.
      parameters:
        - { $ref: '#/components/parameters/TestingEnvironmentStatus' }
        - { $ref: '#/components/parameters/TestingEnvironmentCursor' }
        - { $ref: '#/components/parameters/TestingEnvironmentLimit' }
      responses:
        '200':
          description: Environments owned by the organization.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
    post:
      tags: [Testing environments]
      operationId: createTestingEnvironment
      security: [{ iamBearer: [] }]
      description: >-
        Creates an empty environment. Any active member may create one, Carbon
        or Silicon, and becomes its creator with permanent administrative
        authority over it. The key is returned here for convenience and stays
        retrievable afterwards.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TestingEnvironmentCreate' }
      responses:
        '201':
          description: Environment created; the response carries its key.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentWithKey' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/organizations/{org_id}/testing-environments/{environment_id}:
    parameters:
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TestingEnvironmentIdPath' }
    get:
      tags: [Testing environments]
      operationId: getTestingEnvironment
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Environment.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironment' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
    patch:
      tags: [Testing environments]
      operationId: updateTestingEnvironment
      security: [{ iamBearer: [] }]
      description: Renames or re-describes a live environment. Restricted to its creator and to organization owners and admins.
      parameters:
        - { $ref: '#/components/parameters/IfMatch' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TestingEnvironmentPatch' }
      responses:
        '200':
          description: Environment updated.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironment' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
    delete:
      tags: [Testing environments]
      operationId: deleteTestingEnvironment
      security: [{ iamBearer: [] }]
      description: >-
        Retires the environment. Nothing is erased yet: the record survives with
        a `purge_after` deadline and can be restored until it passes, after
        which the data is destroyed permanently.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: Environment retired and scheduled for purge.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironment' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/organizations/{org_id}/testing-environments/{environment_id}/key:
    parameters:
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TestingEnvironmentIdPath' }
    get:
      tags: [Testing environments]
      operationId: getTestingEnvironmentKey
      security: [{ iamBearer: [] }]
      description: >-
        Returns the current environment key. Restricted to the environment's
        creator and to organization owners and admins, and audited on every
        read.
      responses:
        '200':
          description: Current environment key.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentKey' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/organizations/{org_id}/testing-environments/{environment_id}/key-rotations:
    parameters:
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TestingEnvironmentIdPath' }
    post:
      tags: [Testing environments]
      operationId: rotateTestingEnvironmentKey
      security: [{ iamBearer: [] }]
      description: Issues a new key and invalidates the previous one immediately.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: Key rotated; the response carries the new key.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentWithKey' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/organizations/{org_id}/testing-environments/{environment_id}/cleanings:
    parameters:
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TestingEnvironmentIdPath' }
    post:
      tags: [Testing environments]
      operationId: cleanTestingEnvironment
      security: [{ iamBearer: [] }]
      description: >-
        Deletes every row the environment holds while keeping the environment
        itself. The key is unchanged and the environment stays usable.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: Environment data erased.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentCleaning' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/organizations/{org_id}/testing-environments/{environment_id}/restorations:
    parameters:
      - { $ref: '#/components/parameters/OrgIdPath' }
      - { $ref: '#/components/parameters/TestingEnvironmentIdPath' }
    post:
      tags: [Testing environments]
      operationId: restoreTestingEnvironment
      security: [{ iamBearer: [] }]
      description: >-
        Brings a retired environment back before its `purge_after` deadline.
        Conflicts when the name has been taken by another environment in the
        meantime, or when the deadline has already passed.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: Environment restored.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironment' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/testing-environment:
    get:
      tags: [Testing environments]
      operationId: describeCurrentTestingEnvironment
      security: [{ testingEnvironmentKey: [] }]
      description: >-
        Describes the environment the presented key opens. Authorized by the
        key alone, so it needs no IAM identity and discloses nothing about the
        owning organization's members or production state.
      responses:
        '200':
          description: The environment this key opens.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentSelf' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/testing-environment/cleanings:
    post:
      tags: [Testing environments]
      operationId: cleanCurrentTestingEnvironment
      security: [{ testingEnvironmentKey: [] }]
      description: >-
        Deletes every row the environment holds, authorized by the key alone.
        The key is the environment's root authority, and the data is disposable
        by construction.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: Environment data erased.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingEnvironmentCleaning' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/testing-environment/applications/imports:
    post:
      tags: [Testing environments, Applications]
      operationId: importTestingApplication
      security: [{ iamBearer: [], testingEnvironmentKey: [] }]
      description: >-
        Imports one canonical production Application into the selected testing
        environment. If its organization is absent there, IAM creates it and
        makes the authenticated test Carbon its owner. The Application keeps
        its production app_id, base_url, webhook URL, OBO surface, and inherited
        webhook signing secret; that inherited secret is never returned. IAM
        issues and returns a fresh test-only client secret.
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/TestingApplicationImport' }
      responses:
        '201':
          description: Production Application imported with a fresh test-only client secret.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestingApplicationImported' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '503': { $ref: '#/components/responses/ServiceUnavailable' }
  /api/v1/organizations/{org_id}/sso:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [SSO]
      operationId: getSsoConfiguration
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/OrgIdPath' }]
      responses:
        '200':
          description: Non-secret WorkOS mapping, entitlement, connection, and join-method state.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SsoConfiguration' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    delete:
      tags: [SSO]
      operationId: disableSsoConfiguration
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '204':
          description: Connection disabled after join_method is safely changed away from sso.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
  /api/v1/organizations/{org_id}/sso/setup-link:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [SSO]
      operationId: createSsoSetupLink
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '201':
          description: Five-minute WorkOS Admin Portal setup link. The idempotency reservation commits before provider I/O; an in-flight identical key returns a retryable conflict and a completed response is replayable for five minutes.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SsoSetupLink' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '502': { $ref: '#/components/responses/BadGateway' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/organizations/{org_id}/sso/authorize:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [SSO]
      operationId: authorizeSsoJoin
      security: [{ sessionCookie: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { name: return_to, in: query, schema: { type: string, format: uri } }
      responses:
        '302':
          description: Validated redirect to WorkOS with state and nonce bound to the authenticated Carbon.
          headers: { Location: { schema: { type: string, format: uri } } }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '502': { $ref: '#/components/responses/BadGateway' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/sso/callback:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [SSO]
      operationId: handleSsoCallback
      security: [{ sessionCookie: [] }]
      parameters:
        - { name: code, in: query, required: true, schema: { type: string, minLength: 1, maxLength: 2048 } }
        - { name: state, in: query, required: true, schema: { type: string, minLength: 16, maxLength: 512 } }
      responses:
        '302':
          description: Existing Carbon admitted or linked through the active tenant-bound WorkOS connection, using fixed conservative member defaults on admission or reactivation, then redirected only to the stored validated return URI.
          headers: { Location: { schema: { type: string, format: uri } } }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '502': { $ref: '#/components/responses/BadGateway' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/organizations/{org_id}/sso/test:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [SSO]
      operationId: testSsoConfiguration
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      responses:
        '200':
          description: Reads the exact provider organization and connection; succeeds only when the connection is active and belongs to the permanently mapped organization.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/TestResult' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
        '502': { $ref: '#/components/responses/BadGateway' }
        '504': { $ref: '#/components/responses/GatewayTimeout' }
  /api/v1/provider-webhooks/workos:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [SSO, Webhooks]
      operationId: receiveWorkOsWebhook
      security: [{ workosSignature: [] }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { type: object, additionalProperties: true, maxProperties: 100 }
      responses:
        '202': { description: 'Signature-valid, fresh, replay-safe event accepted idempotently.' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '409': { $ref: '#/components/responses/Conflict' }
        '413': { $ref: '#/components/responses/PayloadTooLarge' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/applications:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Applications]
      operationId: listApplications
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: status, in: query, schema: { $ref: '#/components/schemas/ApplicationStatus' } }
      responses:
        '200':
          description: Applications owned by organizations in which the authenticated Carbon is a current active owner/admin.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    post:
      tags: [Applications]
      operationId: createApplication
      security: [{ iamBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/IdempotencyKey' }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ApplicationCreate' }
      responses:
        '201':
          description: >-
            Verified organization-owned Application with canonical
            `{org_id}>{handle}` id and discoverable base URL. IAM generates the
            app secret and stores the caller-supplied webhook secret. The
            response echoes the supplied webhook secret for v1 compatibility.
            Current owner/admin authority is rechecked before creation or
            secret replay.
          headers:
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationCreated' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/application-directory/{app_id}:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Applications]
      operationId: discoverApplicationBaseUrl
      description: >-
        Returns the public backend base URL of a verified Application. Any
        authenticated Application may discover any other Application,
        including one outside its organization. The caller is derived only
        from HTTP Basic credentials. With an X-Testing-Environment-Key, both
        the caller credential and target resolve exclusively inside that
        environment.
      security: [{ applicationBasic: [] }]
      parameters: [{ $ref: '#/components/parameters/AppIdPath' }]
      responses:
        '200':
          description: Canonical Application id and its configured base URL.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationBaseUrl' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}:
    parameters: [{ $ref: '#/components/parameters/AppIdPath' }, { $ref: '#/components/parameters/TestingEnvironmentSelection' }]
    get:
      tags: [Applications]
      operationId: getApplication
      security: [{ iamBearer: [] }]
      responses:
        '200':
          description: Organization-owned manageable application without raw secrets.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Application' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    patch:
      tags: [Applications]
      operationId: updateApplication
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema: { $ref: '#/components/schemas/ApplicationPatch' }
      responses:
        '200':
          description: Non-sensitive metadata updated; scope or redirect changes enter review before activation.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Application' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/client-secret-rotations:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Applications]
      operationId: rotateApplicationClientSecret
      description: >-
        Atomically retires every prior usable client secret and reveals exactly
        one active successor. Step-up action application.client_secret.rotate
        is bound to the internal Application UUID. Exact idempotent replay may
        recover the no-store response for ten minutes.
      x-required-step-up-assurance: verified_channel
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      responses:
        '200':
          description: Client secret rotated and shown once.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationSecretRotated' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/webhook-secret-rotations:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Applications, Webhooks]
      operationId: rotateApplicationWebhookSecret
      description: >-
        Atomically retires the current webhook signing secret and installs the
        caller-supplied successor. New deliveries use the returned secret version;
        already persisted in-flight deliveries retain their original signed
        bytes and version. Exact idempotent replay may recover the no-store
        response for ten minutes. Step-up action
        application.webhook_secret.rotate is bound to the internal
        Application UUID.
      x-required-step-up-assurance: verified_channel
      security: [{ iamBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ApplicationWebhookSecretRotate' }
      responses:
        '200':
          description: Caller-supplied webhook signing secret installed; the response echoes it for v1 compatibility.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationWebhookSecretRotated' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/webhook:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Applications, Webhooks]
      operationId: getApplicationWebhook
      description: >-
        Available to the owning organization's current Carbon owner/admin
        or an IAM platform administrator with applications.review. Includes
        the internal Application UUID used to bind webhook-approval step-up.
      security: [{ iamBearer: [] }, { platformAdminBearer: [] }]
      parameters: [{ $ref: '#/components/parameters/AppIdPath' }]
      responses:
        '200':
          description: One active destination plus any pending reviewed replacement. The body version and ETag are the same application aggregate version.
          headers: { ETag: { $ref: '#/components/headers/ETag' } }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationWebhook' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
    put:
      tags: [Applications, Webhooks]
      operationId: proposeApplicationWebhookReplacement
      description: >-
        In production, validates and proposes a replacement for approval by
        the owning organization's current owner/admin or an IAM platform
        administrator with applications.review, while the current endpoint
        remains active. In a testing
        environment, which deliberately has no platform reviewer, atomically
        retires the old endpoint and activates this replacement immediately.
        Repeating the active or pending URL without a replacement secret, or
        supplying the exact current URL and secret where they can be compared,
        returns `409 application_webhook_unchanged` without changing the
        Application version or emitting audit/outbox events.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ApplicationWebhookReplace' }
      responses:
        '200':
          description: >-
            Testing-environment replacement activated immediately. When an
            imported test Application still inherits its production signing
            key, the request must provide a new test-only signing secret and
            this response echoes it for v1 compatibility.
            The body version and ETag are the same Application aggregate
            version.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Cache-Control:
              schema: { const: no-store }
              description: Present when the response echoes a caller-supplied signing secret.
            Pragma:
              schema: { const: no-cache }
              description: Present when the response echoes a caller-supplied signing secret.
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationWebhook' }
        '202':
          description: >-
            HTTPS destination passed SSRF validation and awaits webhook
            approval. Normally the active destination and signing secret are
            unchanged. If the request supplies a replacement secret, IAM
            installs it for the pending endpoint and echoes it for v1
            compatibility. The body version and ETag are the same Application
            aggregate version.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Cache-Control:
              schema: { const: no-store }
              description: Present when the response echoes a caller-supplied signing secret.
            Pragma:
              schema: { const: no-cache }
              description: Present when the response echoes a caller-supplied signing secret.
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationWebhook' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/webhook/approvals:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Applications, Webhooks]
      operationId: approveApplicationWebhook
      description: >-
        Activates the pending webhook destination of an already verified
        Application, retiring its previous active endpoint if present.
        Authorized for the owning organization's current Carbon owner/admin
        or an IAM platform administrator with applications.review. The
        creator is audit metadata, not an independent source of authority.
        Requires verified-channel step-up action application.webhook.approve
        bound to the internal Application UUID, the current Application
        If-Match version, and an Idempotency-Key. No request fields are needed;
        omit the body or send an empty JSON object.
        This narrow operation changes neither Application status nor scopes.
        A newly registered verified Application's first pending webhook is
        eligible; an Application itself still under_review requires platform
        application review. Missing pending endpoints return 409
        application_webhook_no_pending_endpoint; non-verified Applications
        return 409 application_webhook_approval_state_conflict. Test endpoints
        normally activate immediately and therefore have no pending endpoint
        to approve. IAM revalidates the destination's public HTTPS/DNS safety
        at approval; an unsafe destination returns 422 without activation.
      x-required-step-up-assurance: verified_channel
      security:
        - { iamBearer: [], stepUpToken: [] }
        - { platformAdminBearer: [], stepUpToken: [] }
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: false
        content:
          application/json:
            schema: { type: object, additionalProperties: false }
      responses:
        '200':
          description: Pending webhook activated. The body version and ETag are the same Application aggregate version; no secret is returned.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ApplicationWebhook' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/webhook/dead-letters:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Applications, Webhooks]
      operationId: listApplicationWebhookDeadLetters
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: Application-recipient dead-letter page in reverse dead-letter order.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WebhookDeadLetterPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/webhook/dead-letters/replays:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Applications, Webhooks]
      operationId: replayApplicationWebhookDeadLetters
      description: >-
        Reauthorizes current Application access, then requeues up to 100 exact
        deliveries in original event order using the current endpoint and
        signing secret while preserving immutable event and attempt history.
        The secret-free session.logout.v1 revocation-control event instead
        requires the exact persisted dead-letter recipient to remain bound to
        this Application because logout itself revoked the delegated authority.
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/WebhookReplayRequest' }
      responses:
        '202':
          description: Authorized dead letters were reset for ordered redelivery.
          headers:
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/WebhookReplayResponse' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/applications/{app_id}/login-history:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Applications]
      operationId: listApplicationLoginHistory
      security: [{ iamBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
      responses:
        '200':
          description: App-specific authorization and token-exchange history.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/LoginEventPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/obo-access/applications/{app_id}/endpoints:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [OBO Access]
      operationId: discoverApplicationOboEndpoints
      description: >-
        Returns the active callable endpoint catalog of a verified Application
        in the authenticated Application's organization. Nonexistent,
        unverified, and cross-organization targets all return the same 404.
      security: [{ applicationBasic: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
      responses:
        '200':
          description: Same-organization Application reference and its active endpoints in endpoint_id order.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/OboEndpointCatalog' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/obo-access/exchanges:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [OBO Access]
      operationId: exchangeOboAccessProof
      description: >-
        Authenticates App A with HTTP Basic and a fresh request HMAC. IAM
        derives the tenant from App A, requires audience App B and the subject
        membership to belong to that same organization, loads registered_path
        from the selected active endpoint, and verifies X-OBO-Signature in
        constant time over
        timestamp.method.registered_path.body_sha256.Idempotency-Key. The
        request carries only metadata and the body digest, never the downstream
        body or file. Exact idempotent replay expires no later than the proof.
      security: [{ applicationBasic: [] }]
      parameters:
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/OboTimestamp' }
        - { $ref: '#/components/parameters/OboSignature' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/OboExchangeRequest' }
      responses:
        '201':
          description: Random single-use proof bound to same-organization source, audience, subject token, actor, registered endpoint, method, path, body digest, and exact metadata; valid for at most 60 seconds.
          headers:
            Cache-Control: { schema: { const: no-store } }
            Pragma: { schema: { const: no-cache } }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/OboProofResponse' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/obo-access/verify:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [OBO Access]
      operationId: consumeOboAccessProof
      description: >-
        App B submits the proof and the method, path, and body digest calculated
        from the actual downstream request. IAM verifies every binding before
        atomically consuming the proof. Successful verification is never stored
        or replayed; exactly one concurrent call succeeds and later use returns
        409. No Idempotency-Key, X-Org-ID, or actual request body is accepted.
      security: [{ applicationBasic: [] }]
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/OboVerifyRequest' }
      responses:
        '200':
          description: Proof consumed exactly once; returns its bound actor, endpoint, and exact metadata for audience-side authorization.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/OboAccessResult' }
        '400': { $ref: '#/components/responses/BadRequest' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '409': { $ref: '#/components/responses/Conflict' }
        '410': { $ref: '#/components/responses/Gone' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '429': { $ref: '#/components/responses/TooManyRequests' }

  /api/v1/admin/applications:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    get:
      tags: [Platform administration]
      operationId: adminListApplications
      security: [{ platformAdminBearer: [] }]
      parameters:
        - { $ref: '#/components/parameters/Cursor' }
        - { $ref: '#/components/parameters/Limit' }
        - { name: status, in: query, schema: { $ref: '#/components/schemas/ApplicationStatus' } }
      responses:
        '200':
          description: Platform review queue and application inventory.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/AdminApplicationPage' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/admin/applications/{app_id}/decisions:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    post:
      tags: [Platform administration]
      operationId: adminDecideApplication
      x-required-step-up-assurance: verified_channel
      security: [{ platformAdminBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/AppIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ApplicationAdminDecision' }
      responses:
        '200':
          description: Review, suspension, reactivation, deletion, consent setting, or pending configuration decision applied.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/AdminApplication' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '422': { $ref: '#/components/responses/UnprocessableEntity' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
        '429': { $ref: '#/components/responses/TooManyRequests' }
  /api/v1/admin/organizations/{org_id}/sso-entitlement:
    parameters:
      - { $ref: '#/components/parameters/TestingEnvironmentSelection' }
    put:
      tags: [Platform administration, SSO]
      operationId: adminReplaceSsoEntitlement
      x-required-step-up-assurance: verified_channel
      security: [{ platformAdminBearer: [], stepUpToken: [] }]
      parameters:
        - { $ref: '#/components/parameters/OrgIdPath' }
        - { $ref: '#/components/parameters/IdempotencyKey' }
        - { $ref: '#/components/parameters/IfMatch' }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/SsoEntitlement' }
      responses:
        '200':
          description: Backend-only SSO entitlement changed.
          headers:
            ETag: { $ref: '#/components/headers/ETag' }
            Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SsoEntitlement' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409': { $ref: '#/components/responses/Conflict' }
        '412': { $ref: '#/components/responses/PreconditionFailed' }
        '428': { $ref: '#/components/responses/PreconditionRequired' }
webhooks:
  applicationEvent:
    post:
      tags: [Webhooks]
      operationId: deliverApplicationWebhookEvent
      summary: IAM delivers a minimal versioned event to the application's one active HTTPS endpoint.
      security: []
      parameters:
        - { name: X-Silicon-IAM-Event-ID, in: header, required: true, schema: { type: string, format: uuid } }
        - { name: X-Silicon-IAM-Timestamp, in: header, required: true, schema: { type: integer } }
        - { name: X-Silicon-IAM-Key-Version, in: header, required: true, schema: { type: integer, minimum: 1 } }
        - { name: X-Silicon-IAM-Signature, in: header, required: true, schema: { type: string, pattern: '^v1=[a-f0-9]{64}$' } }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - { $ref: '#/components/schemas/WebhookEvent' }
                - { $ref: '#/components/schemas/TestingWebhookEvent' }
      responses:
        '200': { description: Event accepted idempotently. }
        '202': { description: Event accepted for asynchronous local processing. }
        '204': { description: Event accepted with no response body. }
  siliconEvent:
    post:
      tags: [Webhooks]
      operationId: deliverSiliconWebhookEvent
      summary: IAM delivers subscribed organization changes to a Silicon's configured HTTPS endpoint.
      security: []
      parameters:
        - { name: X-Silicon-IAM-Event-ID, in: header, required: true, schema: { type: string, format: uuid } }
        - { name: X-Silicon-IAM-Timestamp, in: header, required: true, schema: { type: integer } }
        - { name: X-Silicon-IAM-Key-Version, in: header, required: true, schema: { type: integer, minimum: 1 } }
        - { name: X-Silicon-IAM-Signature, in: header, required: true, schema: { type: string, pattern: '^v1=[a-f0-9]{64}$' } }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - { $ref: '#/components/schemas/SiliconWebhookEvent' }
                - { $ref: '#/components/schemas/TestingWebhookEvent' }
      responses:
        '200': { description: Event accepted idempotently. }
        '202': { description: Event accepted for asynchronous local processing. }
        '204': { description: Event accepted with no response body. }

components:
  securitySchemes:
    iamBearer:
      type: http
      scheme: bearer
      bearerFormat: opaque IAM access token
      description: Carbon, Silicon, or actor-bound application access token; actor class is checked per operation.
    sessionCookie:
      type: apiKey
      in: cookie
      name: iam_session
      description: Secure, HttpOnly, SameSite browser session used only by interactive authorization flows.
    applicationBasic:
      type: http
      scheme: basic
      description: Application ID as username and current versioned application secret as password.
    platformAdminBearer:
      type: http
      scheme: bearer
      bearerFormat: opaque platform-admin access token
      description: IAM token whose current Carbon principal has active platform-administrator authority.
    stepUpToken:
      type: apiKey
      in: header
      name: X-Step-Up-Token
      description: Five-minute action-bound token from the step-up verification flow.
    testingEnvironmentKey:
      type: apiKey
      in: header
      name: X-Testing-Environment-Key
      description: >-
        A 32-character alphanumeric testing environment key. Presented on any
        other route it selects that environment for the request; presented on
        the `/api/v1/testing-environment` routes it is the sole authority.
    workosSignature:
      type: apiKey
      in: header
      name: WorkOS-Signature
      description: >-
        Comma-delimited `t=<epoch_ms>,v1=<hex_hmac>` value. IAM verifies
        HMAC-SHA256 over `timestamp + '.' + exact raw UTF-8 body` in constant
        time, enforces a 300-second tolerance, and deduplicates provider event ID.
  parameters:
    TestingEnvironmentSelection:
      name: X-Testing-Environment-Key
      in: header
      required: false
      description: >-
        Optionally selects an isolated testing data plane for this otherwise
        ordinary plane-selected operation. Omit the header to use production. The value
        is the 32-character alphanumeric key issued for an active testing
        environment; it supplies selection context, not sole authorization.
      schema: { $ref: '#/components/schemas/TestingEnvironmentKeyValue' }
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: Opaque caller-generated key containing 16 to 255 printable ASCII bytes. Reuse with different bytes returns idempotency_conflict.
      schema: { type: string, minLength: 16, maxLength: 255, pattern: '^[\x21-\x7E]{16,255}$' }
    OboTimestamp:
      name: X-OBO-Timestamp
      in: header
      required: true
      description: Canonical positive Unix timestamp in seconds; accepted only within 60 seconds of IAM's clock.
      schema: { type: string, pattern: '^[1-9][0-9]{0,18}$' }
    OboSignature:
      name: X-OBO-Signature
      in: header
      required: true
      description: >-
        Exactly 64 lowercase hexadecimal characters: HMAC-SHA256 using App A's
        current Application secret over
        timestamp.method.registered_path.body_sha256.Idempotency-Key.
      schema: { type: string, pattern: '^[0-9a-f]{64}$' }
    IfMatch:
      name: If-Match
      in: header
      required: true
      description: Strong ETag containing the expected aggregate version.
      schema: { type: string, pattern: '^"[0-9]+"$' }
    OrgContext:
      name: X-Org-ID
      in: header
      required: false
      description: Optional introspection organization context; it must agree with the token and grant. OBO never accepts this header.
      schema: { $ref: '#/components/schemas/OrgId' }
    SessionId:
      name: session_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    CarbonIdPath:
      name: carbon_id
      in: path
      required: true
      schema: { $ref: '#/components/schemas/CarbonId' }
    OrgIdPath:
      name: org_id
      in: path
      required: true
      schema: { $ref: '#/components/schemas/OrgId' }
    AppIdPath:
      name: app_id
      in: path
      required: true
      schema: { $ref: '#/components/schemas/AppId' }
    SiliconIdPath:
      name: silicon_id
      in: path
      required: true
      description: Global Silicon handle including the organization suffix.
      schema: { $ref: '#/components/schemas/SiliconGlobalId' }
    MembershipIdPath:
      name: membership_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    InviteIdPath:
      name: invite_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    ApprovalRequestIdPath:
      name: request_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    TagIdPath:
      name: tag_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    TrustRuleIdPath:
      name: rule_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    TestingEnvironmentIdPath:
      name: environment_id
      in: path
      required: true
      schema: { type: string, format: uuid }
    TestingEnvironmentStatus:
      name: status
      in: query
      required: false
      description: Lifecycle filter. Defaults to `active`; `all` includes environments awaiting purge.
      schema: { type: string, enum: [active, deleted, all], default: active }
    TestingEnvironmentCursor:
      name: cursor
      in: query
      required: false
      description: Identifier of the last environment on the previous page.
      schema: { type: string, format: uuid }
    TestingEnvironmentLimit:
      name: limit
      in: query
      required: false
      schema: { type: integer, minimum: 1, maximum: 100, default: 25 }
    Cursor:
      name: cursor
      in: query
      required: false
      description: Opaque continuation cursor scoped to the filters and caller.
      schema: { type: string, minLength: 1, maxLength: 2048 }
    Limit:
      name: limit
      in: query
      required: false
      schema: { type: integer, minimum: 1, maximum: 100, default: 50 }
    DirectoryFields:
      name: fields
      in: query
      required: false
      description: Comma-separated sparse projection. Omit it to return every directory field.
      schema:
        type: string
        minLength: 1
        pattern: '^(name|id|role|org|tags|trust)(,(name|id|role|org|tags|trust))*$'
  headers:
    RequestId:
      description: Trace identifier generated or accepted from X-Request-ID.
      schema: { type: string, minLength: 1, maxLength: 128 }
    ETag:
      description: Strong aggregate-version ETag.
      schema: { type: string, pattern: '^"[0-9]+"$' }
    RetryAfter:
      description: Seconds before retrying.
      schema: { type: integer, minimum: 1 }
    RateLimitLimit:
      description: Effective request limit for the tightest active bucket.
      schema: { type: integer, minimum: 1 }
    RateLimitRemaining:
      description: Remaining requests in that bucket.
      schema: { type: integer, minimum: 0 }
    RateLimitReset:
      description: Seconds until that bucket resets.
      schema: { type: integer, minimum: 0 }
    IdempotencyReplayed:
      description: True when this is a replay of the stored idempotent response.
      schema: { type: boolean }
  requestBodies:
    VerificationCode:
      required: true
      content:
        application/json:
          schema:
            type: object
            required: [code]
            additionalProperties: false
            properties:
              code: { $ref: '#/components/schemas/VerificationCode' }
  responses:
    HealthOk:
      description: Process is healthy for the requested probe.
      content:
        application/json:
          schema:
            type: object
            required: [ok]
            properties: { ok: { const: true } }
    CodeDispatchAccepted:
      description: >-
        Signup contact check completed. If the normalized identity already
        belongs to a Carbon, no OTP is sent and already_exists is true.
        Otherwise a ten-minute OTP is dispatched and already_exists is false.
      headers:
        X-Request-ID: { $ref: '#/components/headers/RequestId' }
        Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
      content:
        application/json:
          schema: { $ref: '#/components/schemas/CodeDispatchResult' }
    Verified:
      description: Verification completed and the OTP was consumed atomically.
      headers:
        Idempotency-Replayed: { $ref: '#/components/headers/IdempotencyReplayed' }
      content:
        application/json:
          schema:
            type: object
            required: [verified]
            properties: { verified: { const: true } }
    BadRequest:
      description: Malformed syntax, unsupported media type, or invalid protocol request.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    Unauthorized:
      description: Missing, invalid, expired, or revoked authentication.
      headers: { WWW-Authenticate: { schema: { type: string } } }
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    Forbidden:
      description: Authenticated principal lacks the current actor type, scope, capability, or step-up authorization.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    NotFound:
      description: Resource is absent or intentionally hidden across a tenant boundary.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    Conflict:
      description: Unique, idempotency, replay, terminal-state, or concurrent-state conflict.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    NotAcceptable:
      description: The client and server do not support a common public API version.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    Gone:
      description: One-time challenge, short-lived login token, invitation, proof, or response window expired.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    PreconditionFailed:
      description: If-Match does not equal the current aggregate version.
      headers: { ETag: { $ref: '#/components/headers/ETag' } }
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    PayloadTooLarge:
      description: Request body exceeds the endpoint's configured bound.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    UnprocessableEntity:
      description: Well-formed request violates field, policy, hierarchy, quorum, or tenant invariants.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    PreconditionRequired:
      description: Required Idempotency-Key, If-Match, or step-up precondition is absent.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    TooManyRequests:
      description: One or more distributed request buckets are exhausted, or an OTP challenge is inside its 60-second cooldown after ten failed verifications.
      headers:
        Retry-After: { $ref: '#/components/headers/RetryAfter' }
        RateLimit-Limit: { $ref: '#/components/headers/RateLimitLimit' }
        RateLimit-Remaining: { $ref: '#/components/headers/RateLimitRemaining' }
        RateLimit-Reset: { $ref: '#/components/headers/RateLimitReset' }
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    BadGateway:
      description: Authenticated upstream provider returned an invalid or failed response.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    ServiceUnavailable:
      description: Required local dependency or provider is temporarily unavailable.
      headers: { Retry-After: { $ref: '#/components/headers/RetryAfter' } }
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
    GatewayTimeout:
      description: A bounded server or provider processing deadline elapsed.
      content: { application/json: { schema: { $ref: '#/components/schemas/ErrorEnvelope' } } }
  schemas:
    ErrorEnvelope:
      type: object
      required: [error]
      additionalProperties: false
      properties:
        error:
          type: object
          required: [code, message, request_id]
          additionalProperties: false
          properties:
            code: { type: string, pattern: '^[a-z][a-z0-9_]{1,63}$' }
            message: { type: string, minLength: 1, maxLength: 500 }
            details: { type: object, additionalProperties: true }
            request_id: { type: string, minLength: 1, maxLength: 128 }
    VersionInfo:
      type: object
      required: [service, api_version, build, commit]
      properties:
        service: { const: silicon-iam }
        api_version: { const: v1 }
        build: { type: string }
        commit: { type: string }
    ApiVersionNegotiation:
      type: object
      required: [service, selected_api_version, supported_api_versions, build, commit]
      additionalProperties: false
      properties:
        service: { const: silicon-iam }
        selected_api_version: { type: string, pattern: '^v[1-9][0-9]{0,8}$' }
        supported_api_versions:
          type: array
          minItems: 1
          maxItems: 16
          uniqueItems: true
          description: Server-supported API majors in descending preference order.
          items: { type: string, pattern: '^v[1-9][0-9]{0,8}$' }
        build: { type: string }
        commit: { type: string }
    VerificationCode:
      type: string
      pattern: '^[0-9]{6}$'
      description: Six-digit code with a ten-minute expiry; ten failed verifications trigger a 60-second reusable-challenge cooldown.
    CarbonId:
      type: string
      pattern: '^[a-z1-9_-]{3,30}$'
      description: New immutable Carbon ID; zero is not admitted.
    ExistingCarbonId:
      type: string
      pattern: '^[a-z0-9_-]{3,30}$'
      description: Existing Carbon lookup/projection, including immutable legacy IDs containing zero.
    OrgId: { type: string, pattern: '^[a-z0-9_-]{3,50}$' }
    ApplicationHandle:
      type: string
      pattern: '^[a-z][a-z0-9_-]{2,79}$'
      description: Local handle supplied at creation; the public id becomes `{org_id}>{handle}`.
    AppId:
      type: string
      pattern: '^[a-z0-9_-]{3,50}>[a-z][a-z0-9_-]{2,79}$'
      description: Canonical organization-qualified Application id, `{org_id}>{handle}`.
    SiliconHandle:
      type: string
      pattern: '^[a-z0-9_-]{3,50}$'
      description: Client-supplied handle component; only the resulting `{handle}:{org_id}` Silicon ID is public.
    SiliconGlobalId: { type: string, pattern: '^[a-z0-9_-]{3,50}:[a-z0-9_-]{3,50}$' }
    TimeZoneId:
      type: string
      minLength: 1
      maxLength: 255
      pattern: '^[A-Za-z0-9._+-]+(/[A-Za-z0-9._+-]+)*$'
      description: Exact identifier that must resolve in the IANA Time Zone Database, such as UTC or Asia/Kolkata.
    EmailInput:
      type: object
      required: [email]
      additionalProperties: false
      properties: { email: { type: string, format: email, maxLength: 320 } }
    PhoneInput:
      type: object
      required: [phone_number]
      additionalProperties: false
      properties: { phone_number: { type: string, pattern: '^\\+[1-9][0-9]{7,14}$' } }
    AuthSession:
      type: object
      required: [session_id, expires_at]
      additionalProperties: false
      properties:
        session_id: { type: string, format: uuid }
        expires_at: { type: string, format: date-time }
        local_otp:
          type: string
          pattern: '^[0-9]{6}$'
          description: Present only when the explicitly configured local-development provider exposes the generated code.
    CodeDispatchResult:
      type: object
      required: [already_exists]
      additionalProperties: false
      properties:
        already_exists: { type: boolean }
        expires_in:
          type: integer
          const: 600
          description: Present only when a new verification code was sent.
        local_otp:
          type: string
          pattern: '^[0-9]{6}$'
          description: Present only when the explicitly configured local-development provider exposes the generated code.
    Availability:
      type: object
      required: [available]
      properties: { available: { type: boolean } }
    ActorRef:
      type: object
      required: [principal_id, type, public_id]
      additionalProperties: false
      properties:
        principal_id: { type: string, format: uuid }
        type: { type: string, enum: [carbon, silicon, application] }
        public_id: { type: string }
    CarbonPublic:
      type: object
      required: [principal_id, carbon_id, display_name, profile_photo, created_at]
      properties:
        principal_id: { type: string, format: uuid }
        carbon_id: { $ref: '#/components/schemas/ExistingCarbonId' }
        display_name: { type: string, minLength: 1, maxLength: 200 }
        description: { type: [string, 'null'], maxLength: 5000 }
        profile_photo: { type: string, format: uri, maxLength: 2048 }
        created_at: { type: string, format: date-time }
    CarbonSuggestion:
      type: object
      required: [carbon_id]
      additionalProperties: false
      properties:
        carbon_id: { $ref: '#/components/schemas/ExistingCarbonId' }
    CarbonResolution:
      type: object
      required: [carbon_id]
      additionalProperties: false
      properties:
        carbon_id: { $ref: '#/components/schemas/ExistingCarbonId' }
    CarbonSelf:
      allOf:
        - { $ref: '#/components/schemas/CarbonPublic' }
        - type: object
          required: [timezone, email, phone_number, status, version, updated_at]
          properties:
            timezone: { $ref: '#/components/schemas/TimeZoneId' }
            email: { type: string, format: email }
            phone_number: { type: string }
            status: { type: string, enum: [active, suspended] }
            version: { type: integer, minimum: 1 }
            updated_at: { type: string, format: date-time }
    CarbonSignupComplete:
      type: object
      required: [carbon_id, display_name]
      additionalProperties: false
      properties:
        carbon_id: { $ref: '#/components/schemas/CarbonId' }
        display_name: { type: string, minLength: 1, maxLength: 200 }
        timezone:
          allOf: [{ $ref: '#/components/schemas/TimeZoneId' }]
          description: Defaults to UTC when omitted.
        description: { type: [string, 'null'], maxLength: 5000 }
        profile_photo: { type: [string, 'null'], format: uri, maxLength: 2048 }
    CarbonProfilePatch:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        display_name: { type: string, minLength: 1, maxLength: 200 }
        timezone: { $ref: '#/components/schemas/TimeZoneId' }
        description: { type: [string, 'null'], maxLength: 5000 }
        profile_photo: { type: [string, 'null'], format: uri, maxLength: 2048 }
    LoginChallengeCreate:
      type: object
      minProperties: 1
      maxProperties: 1
      oneOf:
        - { required: [email] }
        - { required: [phone_number] }
        - { required: [carbon_id] }
      additionalProperties: false
      properties:
        email: { type: string, format: email, maxLength: 320 }
        phone_number: { type: string, pattern: '^\\+[1-9][0-9]{7,14}$' }
        carbon_id: { $ref: '#/components/schemas/ExistingCarbonId' }
    StepUpAction:
      type: string
      description: >-
        Closed privileged-action catalog. account.session_revoke binds
        resource_id to the target session UUID; account.sessions_revoke_all
        binds it to the current Carbon principal UUID. The Silicon-webhook
        redirect action binds it to the target Silicon membership UUID. The
        Application client-secret rotation, webhook-secret rotation and
        webhook approval actions bind it to the internal Application UUID.
        Every action requires one non-null resource_id.
      enum:
        - account.session_revoke
        - account.sessions_revoke_all
        - organization.transfer_ownership
        - organization.authorization_change
        - organization.sso_change
        - organization.silicon_webhook.redirect
        - application.client_secret.rotate
        - application.webhook_secret.rotate
        - application.webhook.approve
        - silicon.rotate_token
        - platform_admin.sso_entitlement
        - platform_admin.application_review
    StepUpChallengeCreate:
      type: object
      required: [channel, action, resource_id]
      additionalProperties: false
      properties:
        channel: { type: string, enum: [email, phone_number] }
        action: { $ref: '#/components/schemas/StepUpAction' }
        resource_id: { type: string, format: uuid }
    StepUpTokenResponse:
      type: object
      required: [step_up_token, action, assurance, expires_in]
      properties:
        step_up_token: { type: string, pattern: '^sup_[A-Za-z0-9_-]{43}$' }
        action: { $ref: '#/components/schemas/StepUpAction' }
        assurance: { type: string, enum: [verified_channel] }
        expires_in: { type: integer, const: 300 }
    IamTokenResponse:
      type: object
      required: [access_token, refresh_token, token_type, expires_in, refresh_expires_at, actor, session_id]
      properties:
        access_token:
          type: string
          pattern: '^(cat|sat)_[A-Za-z0-9_-]{43}$'
          description: Carbon access tokens use cat_; Silicon access tokens use sat_.
        refresh_token: { type: string, pattern: '^rft_[A-Za-z0-9_-]{43}$' }
        token_type: { const: Bearer }
        expires_in: { type: integer, const: 1800 }
        refresh_expires_at: { type: string, format: date-time, description: Exactly 900 days from family creation. }
        actor: { $ref: '#/components/schemas/ActorRef' }
        session_id: { type: string, format: uuid }
    RefreshTokenRequest:
      type: object
      required: [refresh_token]
      additionalProperties: false
      properties:
        refresh_token: { type: string, minLength: 32, maxLength: 512 }
    TokenIntrospectionRequest:
      type: object
      required: [token]
      properties:
        token: { type: string, minLength: 32, maxLength: 4096 }
        token_type_hint: { type: string, enum: [access_token, refresh_token] }
    TokenIntrospection:
      type: object
      description: >-
        Live token state. An active organization-bound access token also returns
        authorization, a synchronous bootstrap/resynchronization snapshot. No
        directory mutation or webhook delivery is required. Refresh tokens and
        unscoped access tokens do not carry organization authorization.
      required: [active]
      properties:
        active: { type: boolean }
        principal_id: { type: string, format: uuid }
        actor_type: { type: string, enum: [carbon, silicon, application] }
        client_id: { $ref: '#/components/schemas/AppId' }
        org_id: { $ref: '#/components/schemas/OrgId' }
        membership_id: { type: string, format: uuid }
        session_id: { type: string, format: uuid }
        scope: { type: string }
        audience: { type: string }
        issued_at: { type: integer }
        expires_at: { type: integer }
        authorization_epoch: { type: integer, minimum: 0 }
        authorization: { $ref: '#/components/schemas/ApplicationAuthorization' }
    AuthorizationTag:
      type: object
      required: [id, name]
      properties:
        id: { type: string, format: uuid }
        name: { type: string }
    ApplicationAuthorization:
      type: object
      description: >-
        Current active membership bound to the authenticated token or verified
        proof, audience, organization, principal and testing plane. Use on first
        login and cache misses; webhook snapshots are asynchronous updates, not
        prerequisites for initial access. org_role requires roles.read and tags
        requires memberships.read. Null means undisclosed, not member or empty
        tags. OBO disclosure uses the intersection of the parent token scopes
        and recipient application's currently approved scopes. The binding
        authorizes no action outside the verified proof's endpoint/request.
        Do not reuse it for a different principal, membership, epoch, audience,
        organization, environment or effective scope set. Never fill undisclosed
        fields from a broader cached token. Introspect current bearer tokens again
        before relying on cached authority; a consumed OBO proof is single-use.
      required: [principal_id, actor_type, public_id, organization_id, org_id, membership_id, membership_version, authorization_epoch, audience, testing_environment_id, scopes, org_role, tags]
      properties:
        principal_id: { type: string, format: uuid }
        actor_type: { type: string, enum: [carbon, silicon] }
        public_id: { type: string }
        organization_id: { type: string, format: uuid }
        org_id: { $ref: '#/components/schemas/OrgId' }
        membership_id: { type: string, format: uuid }
        membership_version: { type: integer, minimum: 1 }
        authorization_epoch: { type: integer, minimum: 0 }
        audience: { $ref: '#/components/schemas/AppId' }
        testing_environment_id: { type: [string, 'null'], format: uuid }
        scopes: { type: array, items: { type: string } }
        org_role: { type: [string, 'null'], enum: [owner, admin, member, null] }
        tags: { type: [array, 'null'], items: { $ref: '#/components/schemas/AuthorizationTag' } }
    LogoutRequest:
      type: object
      additionalProperties: false
      properties:
        mode: { type: string, enum: [current_session, all_sessions], default: current_session }
    Session:
      type: object
      required: [session_id, actor, status, created_at, last_used_at, absolute_expires_at]
      properties:
        session_id: { type: string, format: uuid }
        actor: { $ref: '#/components/schemas/ActorRef' }
        status: { type: string, enum: [active, revoked, expired, replay_revoked] }
        user_agent_summary: { type: [string, 'null'], maxLength: 500 }
        ip_prefix: { type: [string, 'null'], maxLength: 64 }
        created_at: { type: string, format: date-time }
        last_used_at: { type: string, format: date-time }
        absolute_expires_at: { type: string, format: date-time }
        revoked_at: { type: [string, 'null'], format: date-time }
    PageInfo:
      type: object
      required: [next_cursor, has_more]
      properties:
        next_cursor: { type: [string, 'null'] }
        has_more: { type: boolean }
    SessionPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Session' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    LoginEvent:
      type: object
      required: [id, actor, event_type, occurred_at, success, request_id]
      properties:
        id: { type: string, format: uuid }
        actor: { $ref: '#/components/schemas/ActorRef' }
        app_id: { type: [string, 'null'] }
        org_id: { type: [string, 'null'] }
        event_type: { type: string, enum: [login_challenge, login_success, login_failure, oauth_authorization, oauth_token_exchange, logout, refresh_replay] }
        success: { type: boolean }
        ip_prefix: { type: [string, 'null'] }
        user_agent_summary: { type: [string, 'null'] }
        request_id: { type: string }
        occurred_at: { type: string, format: date-time }
    LoginEventPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/LoginEvent' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    SiliconAuthenticationRequest:
      type: object
      required: [silicon_id, silicon_token]
      additionalProperties: false
      properties:
        silicon_id: { $ref: '#/components/schemas/SiliconGlobalId' }
        silicon_token: { type: string, pattern: '^stk-[a-f0-9]{32}$' }
    ShortLivedTokenRequest:
      type: object
      required: [app_id]
      additionalProperties: false
      properties:
        app_id: { $ref: '#/components/schemas/AppId' }
        org_id:
          allOf: [{ $ref: '#/components/schemas/OrgId' }]
          description: Optional organization membership to bind into the resulting Application tokens. Omit for an unscoped login.
    ShortLivedToken:
      type: object
      required: [slt, expires_in]
      properties:
        slt: { type: string }
        expires_in: { type: integer }
    ApplicationTokenRequest:
      type: object
      required: [app_id]
      additionalProperties: false
      oneOf:
        - required: [slt]
        - required: [refresh_token]
      properties:
        app_id: { $ref: '#/components/schemas/AppId' }
        slt: { type: string, minLength: 32, maxLength: 512 }
        refresh_token: { type: string, minLength: 32, maxLength: 512 }
    OAuthTokenResponse:
      type: object
      required: [access_token, refresh_token, token_type, expires_in, scope, actor]
      properties:
        access_token: { type: string, pattern: '^oat_[A-Za-z0-9_-]{43}$' }
        refresh_token: { type: string, pattern: '^ort_[A-Za-z0-9_-]{43}$' }
        token_type: { const: Bearer }
        expires_in: { type: integer, const: 1800 }
        scope: { type: string }
        actor: { $ref: '#/components/schemas/ActorRef' }
        org_id: { type: [string, 'null'] }
    OAuthRevocationRequest:
      type: object
      required: [token]
      properties:
        token: { type: string, minLength: 32, maxLength: 4096 }
        token_type_hint: { type: string, enum: [access_token, refresh_token] }
    OrganizationCreate:
      type: object
      required: [org_id, name]
      additionalProperties: false
      properties:
        org_id: { $ref: '#/components/schemas/OrgId' }
        name: { type: string, minLength: 1, maxLength: 200 }
        logo: { type: [string, 'null'], format: uri, maxLength: 2048 }
        description: { type: [string, 'null'], maxLength: 5000 }
    OrganizationPatch:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        name: { type: string, minLength: 1, maxLength: 200 }
        logo: { type: [string, 'null'], format: uri, maxLength: 2048 }
        description: { type: [string, 'null'], maxLength: 5000 }
        join_method: { type: string, enum: [email, sso] }
    Organization:
      type: object
      required: [id, org_id, name, owner_membership_id, join_method, sso_status, status, version, created_at, updated_at]
      properties:
        id: { type: string, format: uuid }
        org_id: { $ref: '#/components/schemas/OrgId' }
        name: { type: string }
        logo: { type: [string, 'null'], format: uri }
        description: { type: [string, 'null'] }
        owner_membership_id: { type: string, format: uuid }
        join_method: { type: string, enum: [email, sso] }
        sso_status: { type: string, enum: [disabled, pending, active, error] }
        status: { type: string, enum: [active, disabled] }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    OrganizationPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Organization' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    OwnershipTransfer:
      type: object
      required: [new_owner_membership_id]
      additionalProperties: false
      properties:
        new_owner_membership_id: { type: string, format: uuid }
    OrganizationCapability:
      type: string
      enum:
        - organization.update
        - members.invite
        - members.update_directory
        - members.remove
        - silicons.create
        - silicons.update_directory
        - silicons.manage_hierarchy
        - silicons.remove
        - silicons.rotate_token
        - tags.manage
        - trust.manage
        - roles.request
        - roles.approve
        - admins.create
        - admins.manage
        - sso.manage
    Membership:
      type: object
      required: [id, org_id, principal, status, org_role, job_role, tags, extra_silicons, authorization_epoch, version, created_at, updated_at]
      properties:
        id: { type: string, format: uuid }
        org_id: { $ref: '#/components/schemas/OrgId' }
        principal: { $ref: '#/components/schemas/ActorRef' }
        status: { type: string, enum: [active, removed] }
        org_role: { type: string, enum: [owner, admin, member] }
        job_role: { type: string, maxLength: 5000 }
        tags: { type: array, uniqueItems: true, items: { $ref: '#/components/schemas/TagSummary' } }
        first_silicon_membership_id: { type: [string, 'null'], format: uuid }
        extra_silicons: { type: array, uniqueItems: true, items: { type: string, format: uuid } }
        default_trust:
          description: Carbon-wide advisory trust baseline; null for Silicon memberships.
          oneOf:
            - { $ref: '#/components/schemas/TrustValue' }
            - { type: 'null' }
        reports_to_membership_id: { type: [string, 'null'], format: uuid }
        hierarchy_level: { type: [integer, 'null'], minimum: 1 }
        authorization_epoch: { type: integer, minimum: 0 }
        removed_at: { type: [string, 'null'], format: date-time }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    MembershipPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Membership' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    MembershipDirectoryPatch:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        first_silicon_membership_id: { type: [string, 'null'], format: uuid }
        extra_silicon_membership_ids: { type: array, uniqueItems: true, maxItems: 500, items: { type: string, format: uuid } }
        default_trust:
          allOf: [{ $ref: '#/components/schemas/TrustValue' }]
          description: Carbon-only advisory trust baseline; requires trust.manage.
        reports_to_membership_id: { type: [string, 'null'], format: uuid }
        profile_photo: { type: [string, 'null'], format: uri, maxLength: 2048 }
    MembershipAuthorization:
      type: object
      required: [membership_id, org_role, capabilities, authorization_epoch, version]
      properties:
        membership_id: { type: string, format: uuid }
        org_role: { type: string, enum: [owner, admin, member] }
        capabilities: { type: array, uniqueItems: true, items: { $ref: '#/components/schemas/OrganizationCapability' } }
        authorization_epoch: { type: integer, minimum: 0 }
        version: { type: integer, minimum: 1 }
    OrganizationCapabilitiesReplace:
      type: object
      required: [capabilities]
      additionalProperties: false
      properties:
        capabilities: { type: array, uniqueItems: true, items: { $ref: '#/components/schemas/OrganizationCapability' } }
    DirectoryRole:
      type: object
      required: [org_role, job_role]
      additionalProperties: false
      properties:
        org_role: { type: string, enum: [owner, admin, member] }
        job_role: { type: string, maxLength: 5000 }
    DirectoryOrganization:
      type: object
      required: [id, name]
      additionalProperties: false
      properties:
        id: { $ref: '#/components/schemas/OrgId' }
        name: { type: string, minLength: 1, maxLength: 200 }
    DirectoryMember:
      type: object
      additionalProperties: false
      description: >-
        Sparse organization-directory projection. Omitted fields were not
        requested. trust is null when no Carbon-to-Silicon or
        Silicon-to-Carbon/Silicon orientation exists, including Carbon-to-Carbon.
      properties:
        name: { type: string, minLength: 1, maxLength: 200 }
        id:
          type: string
          description: Public Carbon ID or global Silicon ID.
        role: { $ref: '#/components/schemas/DirectoryRole' }
        org: { $ref: '#/components/schemas/DirectoryOrganization' }
        tags: { type: array, uniqueItems: true, items: { $ref: '#/components/schemas/TagSummary' } }
        trust:
          oneOf:
            - { $ref: '#/components/schemas/TrustEvaluation' }
            - { type: 'null' }
    DirectoryPage:
      type: object
      required: [items, page]
      additionalProperties: false
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/DirectoryMember' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    TrustValue:
      type: object
      required: [boundary, level]
      additionalProperties: false
      properties:
        boundary: { type: string, enum: [internal, external] }
        level: { type: string, enum: [not_trusted, needs_approval, trusted] }
    InvitationTagTrustOverride:
      type: object
      required: [tag_id, trust]
      additionalProperties: false
      properties:
        tag_id: { type: string, format: uuid }
        trust: { $ref: '#/components/schemas/TrustValue' }
    InvitationSiliconTrustOverride:
      type: object
      required: [silicon_membership_id, trust]
      additionalProperties: false
      properties:
        silicon_membership_id: { type: string, format: uuid }
        trust: { $ref: '#/components/schemas/TrustValue' }
    CarbonInviteCreate:
      type: object
      required: [job_role, default_trust]
      minProperties: 3
      oneOf:
        - { required: [carbon_id] }
        - { required: [email] }
      additionalProperties: false
      properties:
        carbon_id: { $ref: '#/components/schemas/ExistingCarbonId' }
        email: { type: string, format: email, maxLength: 320 }
        job_role: { type: string, maxLength: 5000 }
        tag_ids: { type: array, uniqueItems: true, maxItems: 100, items: { type: string, format: uuid } }
        first_silicon_membership_id: { type: [string, 'null'], format: uuid }
        extra_silicon_membership_ids: { type: array, uniqueItems: true, maxItems: 500, items: { type: string, format: uuid } }
        default_trust: { $ref: '#/components/schemas/TrustValue' }
        tag_trust_overrides:
          type: array
          maxItems: 100
          default: []
          description: At most one override per active organization tag.
          items: { $ref: '#/components/schemas/InvitationTagTrustOverride' }
        silicon_trust_overrides:
          type: array
          maxItems: 500
          default: []
          description: At most one override per active Silicon membership.
          items: { $ref: '#/components/schemas/InvitationSiliconTrustOverride' }
        redirect_app_id:
          type: [string, 'null']
          pattern: '^[a-z0-9_-]{3,50}>[a-z][a-z0-9_-]{2,79}$'
          description: Canonical organization-qualified Application id when the invitation should continue into an Application login.
    InviteStatus: { type: string, enum: [pending, accepted, revoked, expired] }
    Invite:
      type: object
      required: [id, org_id, target_carbon, org_role, job_role, tag_ids, extra_silicon_membership_ids, default_trust, tag_trust_overrides, silicon_trust_overrides, invited_by, status, expires_at, version, created_at]
      properties:
        id: { type: string, format: uuid }
        org_id: { $ref: '#/components/schemas/OrgId' }
        target_carbon: { $ref: '#/components/schemas/CarbonPublic' }
        masked_delivery_address: { type: string }
        org_role: { const: member }
        job_role: { type: string, maxLength: 5000 }
        tag_ids: { type: array, uniqueItems: true, items: { type: string, format: uuid } }
        first_silicon_membership_id: { type: [string, 'null'], format: uuid }
        extra_silicon_membership_ids: { type: array, uniqueItems: true, items: { type: string, format: uuid } }
        default_trust: { $ref: '#/components/schemas/TrustValue' }
        tag_trust_overrides:
          type: array
          items: { $ref: '#/components/schemas/InvitationTagTrustOverride' }
        silicon_trust_overrides:
          type: array
          items: { $ref: '#/components/schemas/InvitationSiliconTrustOverride' }
        invited_by: { $ref: '#/components/schemas/ActorRef' }
        status: { $ref: '#/components/schemas/InviteStatus' }
        expires_at: { type: string, format: date-time }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        accepted_at: { type: [string, 'null'], format: date-time }
    InvitePage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Invite' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    InvitationAcceptance:
      type: object
      required: [invite_id, verification_code]
      additionalProperties: false
      properties:
        invite_id: { type: string, format: uuid }
        verification_code: { $ref: '#/components/schemas/VerificationCode' }
    InvitationEmailCodeResponse:
      type: object
      required: [accepted, invite_id, expires_in]
      additionalProperties: false
      properties:
        accepted: { const: true }
        invite_id: { type: string, format: uuid }
        expires_in: { type: integer, minimum: 1, maximum: 600 }
    SiliconCreate:
      type: object
      required: [silicon_id, job_role]
      additionalProperties: false
      properties:
        silicon_id: { $ref: '#/components/schemas/SiliconHandle' }
        display_name:
          type: string
          minLength: 1
          maxLength: 200
          description: Defaults to the immutable local Silicon handle when omitted.
        timezone:
          allOf: [{ $ref: '#/components/schemas/TimeZoneId' }]
          description: Defaults to UTC when omitted.
        description: { type: [string, 'null'], maxLength: 5000 }
        profile_photo: { type: [string, 'null'], format: uri, maxLength: 2048 }
        job_role: { type: string, maxLength: 5000 }
        reports_to_membership_id: { type: [string, 'null'], format: uuid }
        tag_ids: { type: array, uniqueItems: true, maxItems: 100, items: { type: string, format: uuid } }
    SiliconPatch:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        display_name: { type: string, minLength: 1, maxLength: 200 }
        timezone: { $ref: '#/components/schemas/TimeZoneId' }
        description: { type: [string, 'null'], maxLength: 5000 }
        profile_photo: { type: [string, 'null'], format: uri, maxLength: 2048 }
        reports_to_membership_id: { type: [string, 'null'], format: uuid }
    Silicon:
      type: object
      required: [principal_id, membership_id, silicon_id, org_id, display_name, timezone, profile_photo, job_role, tags, hierarchy_level, webhook_configured, status, version, created_at, updated_at]
      properties:
        principal_id: { type: string, format: uuid }
        membership_id: { type: string, format: uuid }
        silicon_id: { $ref: '#/components/schemas/SiliconGlobalId' }
        org_id: { $ref: '#/components/schemas/OrgId' }
        display_name: { type: string, minLength: 1, maxLength: 200 }
        timezone: { $ref: '#/components/schemas/TimeZoneId' }
        description: { type: [string, 'null'], maxLength: 5000 }
        profile_photo: { type: string, format: uri }
        job_role: { type: string, maxLength: 5000 }
        reports_to_membership_id: { type: [string, 'null'], format: uuid }
        tags: { type: array, items: { $ref: '#/components/schemas/TagSummary' } }
        hierarchy_level: { type: integer, minimum: 1 }
        webhook_configured: { type: boolean }
        status: { type: string, enum: [active, removed] }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    SiliconCreated:
      type: object
      required: [silicon, silicon_token, secret_replay_expires_at]
      properties:
        silicon: { $ref: '#/components/schemas/Silicon' }
        silicon_token: { type: string, pattern: '^stk-[a-f0-9]{32}$' }
        secret_replay_expires_at: { type: string, format: date-time }
    SiliconPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Silicon' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    SiliconWebhookReplace:
      type: object
      required: [url]
      additionalProperties: false
      properties:
        url: { type: string, format: uri, pattern: '^https://', maxLength: 2048 }
    SiliconWebhook:
      type: object
      required: [silicon_id, url, status, secret_version, version, created_at, updated_at]
      properties:
        silicon_id: { $ref: '#/components/schemas/SiliconGlobalId' }
        url: { type: string, format: uri, pattern: '^https://', maxLength: 2048 }
        status: { const: active }
        secret_version: { type: integer, minimum: 1 }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    SiliconWebhookConfigured:
      type: object
      required: [webhook, webhook_signing_secret, secret_replay_expires_at]
      properties:
        webhook: { $ref: '#/components/schemas/SiliconWebhook' }
        webhook_signing_secret: { type: string, pattern: '^swhs_[A-Za-z0-9_-]{43}$' }
        secret_replay_expires_at: { type: string, format: date-time }
    SiliconWebhookSubscriptionTopic:
      type: string
      enum: [membership_lifecycle, member_updates, trust_updates]
    SiliconWebhookSubscriptionReplace:
      type: object
      required: [mode]
      additionalProperties: false
      description: >-
        all receives every explicitly Silicon-routed organization event, including
        Full-only metadata, catalog, invitation, governance, credential, and
        configuration events, and canonicalizes the response to all three topic
        values. selected requires at least one exact topic: membership_lifecycle is
        actual creation/reactivation/removal, member_updates is applied existing-member
        role/tag/profile/hierarchy/authorization/ownership change, and trust_updates is
        trust state only. Optional tag_filter always includes the Silicon's own
        event-time before/after tag audience and may add active organization tags;
        later own-tag changes never alter an older event's audience.
      properties:
        mode: { type: string, enum: [all, selected] }
        topics:
          type: array
          uniqueItems: true
          maxItems: 3
          default: []
          items: { $ref: '#/components/schemas/SiliconWebhookSubscriptionTopic' }
        tag_filter:
          oneOf:
            - { $ref: '#/components/schemas/SiliconWebhookTagFilter' }
            - { type: 'null' }
    SiliconWebhookTagFilter:
      type: object
      additionalProperties: false
      properties:
        additional_tag_ids:
          type: array
          uniqueItems: true
          maxItems: 100
          default: []
          items: { type: string, format: uuid }
    SiliconWebhookSubscription:
      type: object
      required: [silicon_id, mode, topics, tag_filter, version, created_at, updated_at]
      properties:
        silicon_id: { $ref: '#/components/schemas/SiliconGlobalId' }
        mode: { type: string, enum: [all, selected] }
        topics:
          type: array
          minItems: 1
          maxItems: 3
          uniqueItems: true
          items: { $ref: '#/components/schemas/SiliconWebhookSubscriptionTopic' }
        tag_filter:
          description: >-
            Null disables tag filtering. When present, organization-wide and
            unattributed events are suppressed; affected tags must intersect
            either the Silicon's immutable event-time own-tag audience or a
            currently configured additional tag.
          oneOf:
            - { $ref: '#/components/schemas/SiliconWebhookTagFilter' }
            - { type: 'null' }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    SiliconTokenRotated:
      type: object
      required: [silicon_id, credential_version, silicon_token, secret_replay_expires_at]
      properties:
        silicon_id: { $ref: '#/components/schemas/SiliconGlobalId' }
        credential_version: { type: integer, minimum: 1 }
        silicon_token: { type: string, pattern: '^stk-[a-f0-9]{32}$' }
        secret_replay_expires_at: { type: string, format: date-time }
    TagCreate:
      type: object
      required: [name]
      additionalProperties: false
      properties: { name: { type: string, minLength: 1, maxLength: 100 } }
    TagPatch:
      type: object
      required: [name]
      additionalProperties: false
      properties: { name: { type: string, minLength: 1, maxLength: 100 } }
    TagSummary:
      type: object
      required: [id, name]
      properties:
        id: { type: string, format: uuid }
        name: { type: string }
    Tag:
      allOf:
        - { $ref: '#/components/schemas/TagSummary' }
        - type: object
          required: [org_id, version, created_at, updated_at]
          properties:
            org_id: { $ref: '#/components/schemas/OrgId' }
            version: { type: integer, minimum: 1 }
            created_at: { type: string, format: date-time }
            updated_at: { type: string, format: date-time }
    TagPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Tag' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    TestingEnvironment:
      type: object
      required:
        [id, org_id, name, description, status, created_by_membership_id,
         key_generation, key_rotated_at, last_activity_at, cleaned_at,
         deleted_at, purge_after, version, created_at, updated_at]
      properties:
        id: { type: string, format: uuid }
        org_id: { $ref: '#/components/schemas/OrgId' }
        name: { type: string, minLength: 1, maxLength: 64 }
        description: { type: [string, 'null'], maxLength: 500 }
        status: { type: string, enum: [active, deleted] }
        created_by_membership_id:
          type: string
          format: uuid
          description: Membership that created the environment; it keeps administrative authority while active.
        key_generation:
          type: integer
          minimum: 1
          description: Increments on every key rotation.
        key_rotated_at: { type: [string, 'null'], format: date-time }
        last_activity_at:
          type: string
          format: date-time
          description: Last accepted request in the environment; idleness beyond the configured window auto-deletes it.
        cleaned_at: { type: [string, 'null'], format: date-time }
        deleted_at: { type: [string, 'null'], format: date-time }
        purge_after:
          type: [string, 'null']
          format: date-time
          description: Deadline after which the environment and its data are destroyed permanently. Restorable until then.
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    TestingEnvironmentPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/TestingEnvironment' } }
        page:
          type: object
          required: [next_cursor, has_more]
          properties:
            next_cursor: { type: [string, 'null'], format: uuid }
            has_more: { type: boolean }
    TestingEnvironmentCreate:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 64 }
        description: { type: [string, 'null'], maxLength: 500 }
    TestingEnvironmentPatch:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        name: { type: string, minLength: 1, maxLength: 64 }
        description: { type: [string, 'null'], maxLength: 500 }
    TestingEnvironmentKeyValue:
      type: string
      pattern: '^[A-Za-z0-9]{32}$'
      description: Root authority for one environment. Anyone holding it can do anything inside that environment.
    TestingEnvironmentWithKey:
      allOf:
        - { $ref: '#/components/schemas/TestingEnvironment' }
        - type: object
          required: [key]
          properties:
            key: { $ref: '#/components/schemas/TestingEnvironmentKeyValue' }
    TestingEnvironmentKey:
      type: object
      required: [environment_id, key_generation, key_rotated_at, key]
      properties:
        environment_id: { type: string, format: uuid }
        key_generation: { type: integer, minimum: 1 }
        key_rotated_at: { type: [string, 'null'], format: date-time }
        key: { $ref: '#/components/schemas/TestingEnvironmentKeyValue' }
    TestingEnvironmentSelf:
      type: object
      required: [id, name, description, key_generation, created_at]
      description: What a key holder may see about the environment it holds a key to.
      properties:
        id: { type: string, format: uuid }
        name: { type: string, minLength: 1, maxLength: 64 }
        description: { type: [string, 'null'], maxLength: 500 }
        key_generation: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
    TestingEnvironmentCleaning:
      type: object
      required: [environment_id, erased_rows, cleaned_at]
      properties:
        environment_id: { type: string, format: uuid }
        erased_rows: { type: integer, minimum: 0 }
        cleaned_at: { type: string, format: date-time }
    TestingApplicationImport:
      type: object
      required: [app_id]
      additionalProperties: false
      properties:
        app_id:
          $ref: '#/components/schemas/AppId'
          description: Canonical production Application id to copy.
    TestingApplicationImported:
      type: object
      required: [application, app_secret, app_secret_version, webhook_secret_inherited, secret_replay_expires_at]
      additionalProperties: false
      properties:
        application: { $ref: '#/components/schemas/Application' }
        app_secret:
          type: string
          pattern: '^ask_[A-Za-z0-9_-]{43}$'
          description: Fresh credential valid only inside this testing environment.
        app_secret_version: { type: integer, minimum: 1 }
        webhook_secret_inherited:
          type: boolean
          const: true
          description: Confirms that the production signing secret was inherited but not disclosed.
        secret_replay_expires_at: { type: string, format: date-time }
    TrustSelector:
      type: object
      additionalProperties: false
      oneOf:
        - required: [kind, tag_id]
          properties: { kind: { const: tag }, tag_id: { type: string, format: uuid } }
        - required: [kind, membership_id]
          properties: { kind: { const: membership }, membership_id: { type: string, format: uuid } }
      properties:
        kind: { type: string, enum: [tag, membership] }
        tag_id: { type: string, format: uuid }
        membership_id: { type: string, format: uuid }
    TrustRuleCreate:
      type: object
      required: [subject, target, trust]
      additionalProperties: false
      properties:
        subject: { $ref: '#/components/schemas/TrustSelector' }
        target: { $ref: '#/components/schemas/TrustSelector' }
        trust: { $ref: '#/components/schemas/TrustValue' }
    TrustRulePatch:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        subject: { $ref: '#/components/schemas/TrustSelector' }
        target: { $ref: '#/components/schemas/TrustSelector' }
        trust: { $ref: '#/components/schemas/TrustValue' }
    TrustRule:
      allOf:
        - { $ref: '#/components/schemas/TrustRuleCreate' }
        - type: object
          required: [id, org_id, specificity, version, created_at, updated_at]
          properties:
            id: { type: string, format: uuid }
            org_id: { $ref: '#/components/schemas/OrgId' }
            specificity: { type: integer, minimum: 0, maximum: 2 }
            version: { type: integer, minimum: 1 }
            created_at: { type: string, format: date-time }
            updated_at: { type: string, format: date-time }
    TrustRulePage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/TrustRule' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    TrustEvaluationRequest:
      type: object
      required: [subject_membership_id, target_silicon_membership_id]
      additionalProperties: false
      properties:
        subject_membership_id: { type: string, format: uuid }
        target_silicon_membership_id: { type: string, format: uuid }
    TrustEvaluation:
      type: object
      required: [trust, source, matching_rule_ids, advisory]
      properties:
        trust: { $ref: '#/components/schemas/TrustValue' }
        source: { type: string, enum: [organization_default, tag_rule, exact_rule] }
        matching_rule_ids: { type: array, items: { type: string, format: uuid } }
        advisory: { const: true }
    ApprovalKind: { type: string, enum: [carbon_job_role_change, silicon_job_role_change, carbon_tag_change, silicon_tag_change, silicon_token_rotation] }
    ApprovalStatus: { type: string, enum: [pending, approved, rejected, completed] }
    RoleChangeRequestCreate:
      type: object
      required: [target_membership_id, proposed_job_role]
      additionalProperties: false
      properties:
        target_membership_id: { type: string, format: uuid }
        proposed_job_role: { type: string, maxLength: 5000 }
        reason: { type: [string, 'null'], maxLength: 2000 }
    TagChangeRequestCreate:
      type: object
      additionalProperties: false
      anyOf:
        - required: [add_tag_ids]
          properties:
            add_tag_ids: { minItems: 1 }
        - required: [remove_tag_ids]
          properties:
            remove_tag_ids: { minItems: 1 }
      properties:
        add_tag_ids:
          type: array
          uniqueItems: true
          maxItems: 100
          default: []
          items: { type: string, format: uuid }
        remove_tag_ids:
          type: array
          uniqueItems: true
          maxItems: 100
          default: []
          items: { type: string, format: uuid }
        reason: { type: [string, 'null'], minLength: 1, maxLength: 2000 }
    DirectJobRoleReplace:
      type: object
      required: [job_role]
      additionalProperties: false
      properties:
        job_role: { type: string, maxLength: 5000 }
    DirectTagSetReplace:
      type: object
      required: [tag_ids]
      additionalProperties: false
      properties:
        tag_ids:
          type: array
          uniqueItems: true
          maxItems: 100
          items: { type: string, format: uuid }
    ApprovalDecisionCreate:
      type: object
      required: [decision]
      additionalProperties: false
      properties:
        decision: { type: string, enum: [approve, reject] }
        comment: { type: [string, 'null'], maxLength: 2000 }
    ApprovalDecision:
      type: object
      required: [id, approver, decision, decided_at]
      properties:
        id: { type: string, format: uuid }
        approver: { $ref: '#/components/schemas/ActorRef' }
        decision: { type: string, enum: [approve, reject] }
        comment: { type: [string, 'null'] }
        decided_at: { type: string, format: date-time }
    ApprovalRequest:
      type: object
      required: [id, org_id, kind, status, requested_by, target_membership_id, immutable_payload, required_approvals, decisions, version, created_at]
      properties:
        id: { type: string, format: uuid }
        org_id: { $ref: '#/components/schemas/OrgId' }
        kind: { $ref: '#/components/schemas/ApprovalKind' }
        status: { $ref: '#/components/schemas/ApprovalStatus' }
        requested_by: { $ref: '#/components/schemas/ActorRef' }
        target_membership_id: { type: string, format: uuid }
        immutable_payload: { type: object, additionalProperties: true }
        required_approvals:
          type: object
          required: [target_carbon, eligible_owner_or_admin]
          properties:
            target_carbon: { type: integer, minimum: 0, maximum: 1 }
            eligible_owner_or_admin: { type: integer, minimum: 1, maximum: 1 }
        decisions: { type: array, items: { $ref: '#/components/schemas/ApprovalDecision' } }
        completed_at: { type: [string, 'null'], format: date-time }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
    ApprovalRequestPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/ApprovalRequest' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    RoleHistory:
      type: object
      required: [id, membership_id, old_job_role, new_job_role, requested_by, approvers, approval_request_id, applied_at]
      properties:
        id: { type: string, format: uuid }
        membership_id: { type: string, format: uuid }
        old_job_role: { type: string }
        new_job_role: { type: string }
        requested_by: { $ref: '#/components/schemas/ActorRef' }
        approvers: { type: array, items: { $ref: '#/components/schemas/ActorRef' } }
        approval_request_id:
          type: [string, 'null']
          format: uuid
          description: Null for an owner/admin direct change.
        applied_at: { type: string, format: date-time }
    RoleHistoryPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/RoleHistory' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    TagHistory:
      type: object
      required: [id, membership_id, previous_tag_ids, applied_tag_ids, requested_by, approvers, approval_request_id, membership_version, applied_at]
      properties:
        id: { type: string, format: uuid }
        membership_id: { type: string, format: uuid }
        previous_tag_ids:
          type: array
          uniqueItems: true
          maxItems: 100
          items: { type: string, format: uuid }
        applied_tag_ids:
          type: array
          uniqueItems: true
          maxItems: 100
          items: { type: string, format: uuid }
        requested_by: { $ref: '#/components/schemas/ActorRef' }
        approvers: { type: array, items: { $ref: '#/components/schemas/ActorRef' } }
        approval_request_id:
          type: [string, 'null']
          format: uuid
          description: Null for an owner/admin direct change.
        membership_version: { type: integer, minimum: 1 }
        applied_at: { type: string, format: date-time }
    TagHistoryPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/TagHistory' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    SsoEntitlement:
      type: object
      required: [enabled, version]
      properties:
        enabled: { type: boolean }
        reason: { type: [string, 'null'], maxLength: 2000 }
        version: { type: integer, minimum: 1 }
    SsoConfiguration:
      type: object
      required: [org_id, entitled, status, join_method, version, updated_at]
      properties:
        org_id: { $ref: '#/components/schemas/OrgId' }
        entitled: { type: boolean }
        status: { type: string, enum: [disabled, pending, active, error] }
        join_method: { type: string, enum: [email, sso] }
        workos_organization_id: { type: [string, 'null'] }
        connection_id: { type: [string, 'null'] }
        version: { type: integer, minimum: 1 }
        updated_at: { type: string, format: date-time }
    SsoSetupLink:
      type: object
      required: [url, expires_in, expires_at]
      properties:
        url: { type: string, format: uri }
        expires_in: { type: integer, const: 300 }
        expires_at: { type: string, format: date-time }
    TestResult:
      type: object
      required: [ok, checked_at]
      properties:
        ok: { type: boolean }
        message: { type: [string, 'null'], maxLength: 1000 }
        checked_at: { type: string, format: date-time }
    ApplicationStatus:
      type: string
      enum: [under_review, verified, rejected, suspended, deleted]
    ApplicationCreate:
      type: object
      required: [app_id, org_id, webhook_url, webhook_secret, base_url]
      additionalProperties: false
      description: Requires the authenticated Carbon to be a current active owner/admin of org_id.
      properties:
        app_id: { $ref: '#/components/schemas/ApplicationHandle' }
        org_id: { $ref: '#/components/schemas/OrgId' }
        app_name: { type: [string, 'null'], maxLength: 200 }
        app_logo: { type: [string, 'null'], format: uri, maxLength: 2048 }
        webhook_url: { type: string, format: uri, pattern: '^https://', maxLength: 2048 }
        webhook_secret: { $ref: '#/components/schemas/ApplicationWebhookSecret' }
        base_url:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            Pathless Application backend origin with no trailing slash,
            credentials, query or fragment. HTTPS is required except for
            literal loopback HTTP in local development.
        obo_endpoints:
          type: array
          maxItems: 50
          default: []
          items: { $ref: '#/components/schemas/ApplicationOboEndpoint' }
    ApplicationPatch:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        app_name: { type: [string, 'null'], maxLength: 200 }
        app_logo: { type: [string, 'null'], format: uri, maxLength: 2048 }
        base_url:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            Pathless backend origin without a trailing slash; HTTPS except for
            literal loopback development.
        obo_endpoints:
          type: array
          maxItems: 50
          description: Full replacement. An empty array retires every active endpoint.
          items: { $ref: '#/components/schemas/ApplicationOboEndpoint' }
    Application:
      type: object
      required: [id, app_id, org_id, created_by, base_url, requested_scopes, approved_scopes, obo_endpoints, status, webhook, has_pending_changes, version, created_at, updated_at]
      description: Organization-owned Application. created_by is immutable provenance and does not confer management authority.
      properties:
        id: { type: string, format: uuid }
        app_id: { $ref: '#/components/schemas/AppId' }
        org_id: { $ref: '#/components/schemas/OrgId' }
        created_by: { $ref: '#/components/schemas/ActorRef' }
        app_name: { type: [string, 'null'] }
        app_logo: { type: [string, 'null'], format: uri }
        base_url:
          type: string
          format: uri
          maxLength: 2048
          description: Pathless backend origin without a trailing slash.
        requested_scopes: { type: array, uniqueItems: true, items: { type: string } }
        approved_scopes: { type: array, uniqueItems: true, items: { type: string } }
        obo_endpoints:
          type: array
          maxItems: 50
          items: { $ref: '#/components/schemas/ApplicationOboEndpoint' }
        status: { $ref: '#/components/schemas/ApplicationStatus' }
        webhook: { $ref: '#/components/schemas/ApplicationWebhook' }
        has_pending_changes: { type: boolean }
        version: { type: integer, minimum: 1 }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    ApplicationCreated:
      type: object
      required: [application, app_secret, app_secret_version, webhook_signing_secret, webhook_secret_version, secret_replay_expires_at]
      properties:
        application: { $ref: '#/components/schemas/Application' }
        app_secret: { type: string, pattern: '^ask_[A-Za-z0-9_-]{43}$' }
        app_secret_version: { type: integer, minimum: 1 }
        webhook_signing_secret: { $ref: '#/components/schemas/ApplicationWebhookSecret' }
        webhook_secret_version: { type: integer, minimum: 1 }
        secret_replay_expires_at: { type: string, format: date-time }
    ApplicationSecretRotated:
      type: object
      required: [app_id, app_secret, app_secret_version, application_version, secret_replay_expires_at]
      additionalProperties: false
      properties:
        app_id: { $ref: '#/components/schemas/AppId' }
        app_secret: { type: string, pattern: '^ask_[A-Za-z0-9_-]{43}$' }
        app_secret_version: { type: integer, minimum: 1 }
        application_version: { type: integer, minimum: 1 }
        secret_replay_expires_at: { type: string, format: date-time }
    ApplicationWebhookSecretRotated:
      type: object
      required: [app_id, webhook_signing_secret, webhook_secret_version, application_version, secret_replay_expires_at]
      additionalProperties: false
      properties:
        app_id: { $ref: '#/components/schemas/AppId' }
        webhook_signing_secret: { $ref: '#/components/schemas/ApplicationWebhookSecret' }
        webhook_secret_version: { type: integer, minimum: 1 }
        application_version: { type: integer, minimum: 1 }
        secret_replay_expires_at: { type: string, format: date-time }
    ApplicationBaseUrl:
      type: object
      required: [app_id, base_url]
      additionalProperties: false
      properties:
        app_id: { $ref: '#/components/schemas/AppId' }
        base_url:
          type: string
          format: uri
          maxLength: 2048
          description: Pathless backend origin without a trailing slash.
    ApplicationPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/Application' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    AdminApplication:
      allOf:
        - { $ref: '#/components/schemas/Application' }
    AdminApplicationPage:
      type: object
      required: [items, page]
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/AdminApplication' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    ApplicationWebhook:
      type: object
      required: [active_url, status, secret_version, version]
      properties:
        application_id:
          type: [string, 'null']
          format: uuid
          description: Internal Application UUID for binding webhook-approval step-up. Present on current reads and new mutation responses; optional for compatibility with older persisted idempotency responses.
        active_url:
          type: [string, 'null']
          format: uri
          description: Null until the application's initial destination is approved; a verified application's pending endpoint may be approved by its current organization owner/admin or an IAM platform reviewer.
        pending_url: { type: [string, 'null'], format: uri }
        status: { type: string, enum: [pending_review, active, replacement_under_review, disabled] }
        secret_version: { type: integer, minimum: 1 }
        webhook_signing_secret:
          $ref: '#/components/schemas/ApplicationWebhookSecret'
          description: >-
            Echoes a caller-supplied replacement secret for v1 compatibility.
        secret_replay_expires_at:
          type: string
          format: date-time
          description: Present exactly when webhook_signing_secret is present.
        version:
          type: integer
          minimum: 1
          description: Application aggregate version; identical to the response ETag and the value required by If-Match for replacement or approval.
    ApplicationWebhookReplace:
      type: object
      required: [url]
      additionalProperties: false
      description: >-
        Replaces only the reviewed destination candidate. It normally reuses
        the existing encrypted signing secret. An imported test Application
        still on its inherited production key must provide a new test-only
        secret. Supplying a secret for any replacement installs it for the new
        endpoint.
      properties:
        url: { type: string, format: uri, pattern: '^https://', maxLength: 2048 }
        webhook_secret: { $ref: '#/components/schemas/ApplicationWebhookSecret' }
    ApplicationWebhookSecret:
      type: string
      minLength: 32
      maxLength: 512
      pattern: '^[!-~]+$'
      description: >-
        Caller-chosen Application webhook signing secret containing only
        non-whitespace ASCII characters. IAM encrypts it at rest and never
        generates it.
    ApplicationWebhookSecretRotate:
      type: object
      required: [webhook_secret]
      additionalProperties: false
      properties:
        webhook_secret: { $ref: '#/components/schemas/ApplicationWebhookSecret' }
    WebhookDeadLetter:
      type: object
      required: [delivery_id, event_id, event_type, occurred_at, aggregate_type, aggregate_id, aggregate_version, status, attempt_count, cycle_attempt_count, manual_replay_count, last_http_status, last_error_code, dead_lettered_at, version]
      additionalProperties: false
      properties:
        delivery_id: { type: string, format: uuid }
        event_id: { type: string, format: uuid }
        event_type: { type: string }
        occurred_at: { type: string, format: date-time }
        aggregate_type: { type: string }
        aggregate_id: { type: string, format: uuid }
        aggregate_version: { type: integer, minimum: 1 }
        status: { type: string, enum: [pending, dead_letter] }
        attempt_count: { type: integer, minimum: 0 }
        cycle_attempt_count: { type: integer, minimum: 0 }
        manual_replay_count: { type: integer, minimum: 0 }
        last_http_status: { type: [integer, 'null'], minimum: 100, maximum: 599 }
        last_error_code: { type: [string, 'null'] }
        dead_lettered_at: { type: [string, 'null'], format: date-time }
        version: { type: integer, minimum: 1 }
    WebhookDeadLetterPage:
      type: object
      required: [items, page]
      additionalProperties: false
      properties:
        items: { type: array, items: { $ref: '#/components/schemas/WebhookDeadLetter' } }
        page: { $ref: '#/components/schemas/PageInfo' }
    WebhookReplayRequest:
      type: object
      required: [delivery_ids]
      additionalProperties: false
      properties:
        delivery_ids:
          type: array
          minItems: 1
          maxItems: 100
          uniqueItems: true
          items: { type: string, format: uuid }
    WebhookReplayResponse:
      type: object
      required: [deliveries, replayed_count]
      additionalProperties: false
      properties:
        deliveries:
          type: array
          maxItems: 100
          items: { $ref: '#/components/schemas/WebhookDeadLetter' }
        replayed_count: { type: integer, minimum: 1, maximum: 100 }
    WebhookEvent:
      type: object
      required: [spec_version, event_id, event_type, occurred_at, aggregate, data]
      properties:
        spec_version: { const: '1.0' }
        event_id: { type: string, format: uuid }
        event_type:
          type: string
          pattern: '^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+\.v[1-9][0-9]*$'
          description: Stable dotted event name with its positive schema version suffix.
        occurred_at: { type: string, format: date-time }
        organization_id: { type: [string, 'null'], format: uuid }
        aggregate:
          type: object
          required: [id, type, version]
          properties:
            id: { type: string, format: uuid }
            type: { type: string }
            version: { type: integer, minimum: 1 }
        data:
          type: object
          additionalProperties: true
          description: >-
            Event-type-specific authorized projection; never contains credentials or raw provider records.
            For carbon.updated.v1, changed_fields and the complete current state are captured at the
            aggregate version and filtered per Application by its effective after-change profile, email,
            and phone consent scopes. The recipient union is authorized Applications immediately before
            or after the change, so a before-only recipient receives no fields it can no longer read.
            For the closed organization-member Application vocabulary (organization/ownership, tag,
            trust, membership/directory/authorization, and Silicon lifecycle or completed credential
            rotation events), recipient union, complete current state, and exact changed_fields are frozen
            in the domain transaction and filtered by profile, organizations.read, memberships.read,
            roles.read, and Carbon-only email/phone scopes. Member events always use
            current.members as an array; organization.updated uses current.organization and requires
            organizations.read; tag and trust events use current.resource plus current.members so their
            independently versioned aggregate is retained. Before-only recipients keep union-scope-filtered
            changed_fields but receive only stable resource/version authorization tombstones. Workers never
            hydrate these events from later state. An affected resource is an Application-readable principal
            or organization projection with an effective data scope; invitations, SSO/webhook configuration,
            administrative/protocol controls, and an unassigned tag creation have no Application projection.
            organization.membership.profile_updated.v1 and
            rotation-request, configuration, subscription, and protocol/control events are excluded from
            this Application projection vocabulary.
            organization.membership.profile_updated.v1 is the organization-bound Silicon projection of
            that mutation: it contains the changed non-contact profile fields, complete current membership
            state, and before/after affected tags captured at the same Carbon version.
    TestingWebhookEvent:
      type: object
      required: [test]
      additionalProperties: false
      description: >-
        Explicit test-plane envelope. The signature covers these exact outer
        bytes. testing_key is the environment root credential and must never
        be logged or persisted with the event.
      properties:
        test:
          type: object
          required: [testing_key, metadata, data]
          additionalProperties: false
          properties:
            testing_key: { $ref: '#/components/schemas/TestingEnvironmentKeyValue' }
            metadata:
              type: object
              required: [spec_version, event_id, event_type, occurred_at, organization_id, aggregate]
              additionalProperties: false
              properties:
                spec_version: { const: '1.0' }
                event_id: { type: string, format: uuid }
                event_type:
                  type: string
                  pattern: '^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+\.v[1-9][0-9]*$'
                occurred_at: { type: string, format: date-time }
                organization_id: { type: [string, 'null'], format: uuid }
                aggregate:
                  type: object
                  required: [type, id, version]
                  additionalProperties: false
                  properties:
                    type: { type: string }
                    id: { type: string, format: uuid }
                    version: { type: integer, minimum: 1 }
            data:
              type: object
              additionalProperties: true
    SiliconFullEventType:
      type: string
      description: Exact closed 38-event vocabulary delivered by Silicon mode=all subscriptions.
      enum:
        - organization.membership.created.v1
        - organization.membership.reactivated.v1
        - organization.membership.removed.v1
        - organization.silicon.created.v1
        - organization.silicon.removed.v1
        - organization.membership.updated.v1
        - organization.membership.profile_updated.v1
        - organization.membership.authorization_updated.v1
        - organization.ownership_transferred.v1
        - organization.admin.promoted.v1
        - organization.admin.demoted.v1
        - organization.silicon.updated.v1
        - organization.tag_updated.v1
        - organization.trust.default_updated.v1
        - organization.trust.rule_created.v1
        - organization.trust.rule_updated.v1
        - organization.trust.rule_archived.v1
        - organization.created.v1
        - organization.updated.v1
        - organization.tag_created.v1
        - organization.invitation.created.v1
        - organization.invitation.accepted.v1
        - organization.invitation.revoked.v1
        - organization.role_change.requested.v1
        - organization.tag_change.requested.v1
        - organization.approval.decided.v1
        - organization.silicon.rotation_requested.v1
        - organization.silicon.credential_rotated.v1
        - organization.silicon.webhook.configured.v1
        - organization.silicon.webhook.deleted.v1
        - organization.silicon.webhook_subscription.updated.v1
        - organization.silicon.webhook_subscription.deleted.v1
        - sso.setup_link.created.v1
        - sso.configuration.disabled.v1
        - sso.entitlement.replaced.v1
        - sso.connection.activated.v1
        - sso.connection.deactivated.v1
        - sso.connection.deleted.v1
    SiliconWebhookEvent:
      allOf:
        - { $ref: '#/components/schemas/WebhookEvent' }
        - type: object
          required: [event_type]
          properties:
            event_type: { $ref: '#/components/schemas/SiliconFullEventType' }
    ApplicationAdminDecision:
      type: object
      required: [decision]
      additionalProperties: false
      description: >-
        Platform transition for an application that is already in use.
        Applications arrive verified, so this suspends, reactivates, rejects or
        deletes one rather than admitting it. delete is terminal, requires all
        application administration capabilities plus verified-channel step-up,
        and accepts reason only; approved_scopes is rejected.
      properties:
        decision: { type: string, enum: [approve, reject, suspend, reactivate, delete, approve_pending_changes, reject_pending_changes] }
        approved_scopes: { type: array, uniqueItems: true, items: { type: string } }
        reason: { type: [string, 'null'], maxLength: 2000 }
    ApplicationOboEndpoint:
      type: object
      required: [endpoint_id, path, metadata]
      additionalProperties: false
      description: Callable endpoint definition configurable only by a current owner/admin of the Application's organization.
      properties:
        endpoint_id:
          type: string
          minLength: 3
          maxLength: 128
          pattern: '^[a-z][a-z0-9_.:-]{2,127}$'
          description: Stable identifier; an existing identifier cannot be assigned a different path.
        path:
          type: string
          minLength: 1
          maxLength: 2048
          pattern: '^/(?!/)(?!.*(?:^|/)\.\.?(?:/|$))(?!.*[?#\x00-\x20\x7F]).*$'
          description: Stable absolute audience-application endpoint path.
        metadata:
          type: object
          additionalProperties: true
          description: Each top-level key is required at exchange. A descriptor may declare type as string, number, integer, boolean, object, array, or null; size, nesting, and node count are bounded.
    OboEndpointReference:
      type: object
      required: [endpoint_id, path]
      additionalProperties: false
      properties:
        endpoint_id: { type: string, pattern: '^[a-z][a-z0-9_.:-]{2,127}$' }
        path: { type: string, maxLength: 2048 }
    OboApplicationReference:
      type: object
      required: [app_id, org_id]
      additionalProperties: false
      properties:
        app_id: { $ref: '#/components/schemas/AppId' }
        org_id: { $ref: '#/components/schemas/OrgId' }
    OboEndpointCatalog:
      type: object
      required: [application, endpoints]
      additionalProperties: false
      properties:
        application: { $ref: '#/components/schemas/OboApplicationReference' }
        endpoints:
          type: array
          maxItems: 50
          description: Active definitions ordered by endpoint_id.
          items: { $ref: '#/components/schemas/ApplicationOboEndpoint' }
    OboRequestMethod:
      type: string
      minLength: 1
      maxLength: 32
      pattern: "^[A-Z][A-Z0-9!#$%&'*+.^_`|~-]{0,31}$"
      description: Canonical uppercase HTTP method included byte-for-byte in the OBO HMAC and proof binding.
    OboBodySha256:
      type: string
      pattern: '^[0-9a-f]{64}$'
      description: Lowercase hexadecimal SHA-256 digest of the exact downstream request body bytes.
    OboExchangeRequestBinding:
      type: object
      required: [method, body_sha256]
      additionalProperties: false
      properties:
        method: { $ref: '#/components/schemas/OboRequestMethod' }
        body_sha256: { $ref: '#/components/schemas/OboBodySha256' }
    OboVerifyRequestBinding:
      type: object
      required: [method, path, body_sha256]
      additionalProperties: false
      properties:
        method: { $ref: '#/components/schemas/OboRequestMethod' }
        path:
          type: string
          minLength: 1
          maxLength: 2048
          pattern: '^/(?!/)(?!.*(?:^|/)\.\.?(?:/|$))(?!.*[?#\x00-\x20\x7F]).*$'
          description: Exact registered path of the downstream request.
        body_sha256: { $ref: '#/components/schemas/OboBodySha256' }
    OboExchangeRequest:
      type: object
      required: [subject_token, audience, endpoint_id, metadata, request]
      additionalProperties: false
      description: Organization is derived from App A and App B; org_id and X-Org-ID are not accepted.
      properties:
        subject_token: { type: string, minLength: 32, maxLength: 4096, description: Actor-bound application access token issued to the calling app. }
        audience: { $ref: '#/components/schemas/AppId' }
        endpoint_id: { type: string, minLength: 3, maxLength: 128, pattern: '^[a-z][a-z0-9_.:-]{2,127}$' }
        metadata:
          type: object
          additionalProperties: true
          description: Exact metadata bound into the proof. It must contain every registered key, no unregistered keys, and values matching every declared type.
        request: { $ref: '#/components/schemas/OboExchangeRequestBinding' }
    OboProofResponse:
      type: object
      required: [access_proof, proof_id, expires_in, expires_at]
      additionalProperties: false
      description: The idempotency replay envelope for this secret response expires no later than expires_at.
      properties:
        access_proof: { type: string, pattern: '^obo_[A-Za-z0-9_-]{43}$' }
        proof_id: { type: string, format: uuid }
        expires_in: { type: integer, minimum: 1, maximum: 60, default: 60 }
        expires_at: { type: string, format: date-time }
    OboVerifyRequest:
      type: object
      required: [access_proof, request]
      additionalProperties: false
      description: Exact actual-request binding; successful verification is strictly single-use and not idempotently replayable.
      properties:
        access_proof: { type: string, pattern: '^obo_[A-Za-z0-9_-]{43}$' }
        request: { $ref: '#/components/schemas/OboVerifyRequestBinding' }
    OboAccessResult:
      type: object
      required: [valid, proof_id, issuer_app_id, audience, actor, authorization, org_id, endpoint, metadata, expires_at, consumed_at]
      properties:
        valid: { const: true }
        proof_id: { type: string, format: uuid }
        issuer_app_id: { $ref: '#/components/schemas/AppId' }
        audience: { $ref: '#/components/schemas/AppId' }
        actor: { $ref: '#/components/schemas/ActorRef' }
        authorization: { $ref: '#/components/schemas/ApplicationAuthorization' }
        org_id: { $ref: '#/components/schemas/OrgId' }
        endpoint: { $ref: '#/components/schemas/OboEndpointReference' }
        metadata: { type: object, additionalProperties: true }
        expires_at: { type: string, format: date-time }
        consumed_at: { type: string, format: date-time }