-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenapi.yaml
More file actions
4341 lines (4156 loc) · 132 KB
/
openapi.yaml
File metadata and controls
4341 lines (4156 loc) · 132 KB
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
openapi: "3.1.0"
info:
title: Akashi API
description: |
Version control for AI decisions. Akashi is the decision coordination
layer for multi-agent AI systems — recording, querying, and auditing
every agent decision. Check before deciding to surface precedents and
active conflicts. Trace after deciding to record reasoning, alternatives,
and confidence. Captures the full decision lifecycle: outcome, reasoning,
alternatives considered, evidence, and confidence level.
## Authentication
All `/v1/` endpoints require a Bearer JWT token obtained from
`POST /auth/token`. Tokens are scoped to an organization and carry
the agent's RBAC role.
## Response Envelope
All JSON responses are wrapped in a standard envelope:
```json
{
"data": { ... },
"meta": {
"request_id": "uuid",
"timestamp": "2026-01-15T10:30:00Z"
}
}
```
Error responses use a parallel structure:
```json
{
"error": {
"code": "INVALID_INPUT",
"message": "description"
},
"meta": {
"request_id": "uuid",
"timestamp": "2026-01-15T10:30:00Z"
}
}
```
version: 0.1.0
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:8080
description: Local development
tags:
- name: Auth
description: Authentication
- name: Agents
description: Agent management (admin-only)
- name: Runs
description: Agent run lifecycle
- name: Trace
description: Convenience endpoint for single-call decision recording
- name: Query
description: Decision querying and history
- name: Search
description: Full-text and semantic search
- name: Access
description: Fine-grained access grants between agents
- name: Export
description: Bulk data export for auditors
- name: Keys
description: API key management (admin-only)
- name: Usage
description: Usage metering (admin-only)
- name: Settings
description: Organization settings and policies
- name: System
description: Health, SSE, and infrastructure
security:
- bearerAuth: []
paths:
# ── Auth ───────────────────────────────────────────────────────────
/auth/token:
post:
operationId: createToken
tags: [Auth]
summary: Authenticate and obtain a JWT
description: |
Exchange agent credentials for a JWT.
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AuthTokenRequest"
responses:
"200":
description: JWT issued successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AuthTokenResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
/auth/signup:
post:
operationId: signup
tags: [Auth]
summary: Self-serve org signup with API key issuance
description: |
Creates an organization, its owner agent (org_owner role), and a managed
API key in one atomic operation. The raw key is returned exactly once.
Requires AKASHI_SIGNUP_ENABLED=true; returns 404 when disabled.
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SignupRequest"
responses:
"201":
description: Organization, agent, and API key created successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_SignupResponse"
"400":
$ref: "#/components/responses/BadRequest"
"409":
$ref: "#/components/responses/Conflict"
"429":
$ref: "#/components/responses/RateLimited"
/auth/refresh:
post:
operationId: refreshToken
tags: [Auth]
summary: Refresh a JWT
description: Same as `/auth/token` — exchange credentials for a new JWT.
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AuthTokenRequest"
responses:
"200":
description: JWT issued successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AuthTokenResponse"
"401":
$ref: "#/components/responses/Unauthorized"
/v1/auth/scoped-token:
post:
operationId: createScopedToken
tags: [Auth]
summary: Issue a scoped token (admin only)
description: |
Issues a short-lived JWT that authenticates as a target agent, with the
issuing admin's identity recorded in a `scoped_by` claim. Useful for
testing access control and debugging what a specific agent can see without
needing its API key.
- Requires `admin` role or higher.
- Scoped tokens cannot issue further scoped tokens (no delegation chains).
- TTL defaults to 5 minutes; maximum is 1 hour (`expires_in` is capped).
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ScopedTokenRequest"
responses:
"200":
description: Scoped token issued successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_ScopedTokenResponse"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
# ── Agents ─────────────────────────────────────────────────────────
/v1/agents:
post:
operationId: createAgent
tags: [Agents]
summary: Create an agent
description: |
Register a new agent within the caller's organization.
Requires `admin` role or higher.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateAgentRequest"
responses:
"201":
description: Agent created.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_Agent"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"409":
$ref: "#/components/responses/Conflict"
get:
operationId: listAgents
tags: [Agents]
summary: List all agents
description: |
List all agents in the caller's organization.
Requires `admin` role or higher. Use `?include=stats` to
enrich each agent with decision_count and last_decision_at.
parameters:
- name: include
in: query
required: false
schema:
type: string
enum: [stats]
description: |
Pass `stats` to include decision_count and last_decision_at
on each agent in the response.
- name: limit
in: query
required: false
schema:
type: integer
default: 200
description: Maximum number of agents to return (1-1000).
- name: offset
in: query
required: false
schema:
type: integer
default: 0
description: Number of agents to skip.
responses:
"200":
description: List of agents.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AgentList"
"403":
$ref: "#/components/responses/Forbidden"
/v1/agents/{agent_id}:
get:
operationId: getAgent
tags: [Agents]
summary: Get an agent by ID
description: |
Retrieve a single agent by its agent_id.
Requires `admin` role or higher.
parameters:
- $ref: "#/components/parameters/AgentIDPath"
responses:
"200":
description: The agent.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_Agent"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
patch:
operationId: updateAgent
tags: [Agents]
summary: Update an agent
description: |
Partially update an agent's name and/or metadata. Metadata is
merge-patched (new keys are added, existing keys are overwritten).
Requires `admin` role or higher.
parameters:
- $ref: "#/components/parameters/AgentIDPath"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UpdateAgentRequest"
responses:
"200":
description: Agent updated. Returns the updated agent.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_Agent"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
delete:
operationId: deleteAgent
tags: [Agents]
summary: Delete an agent and all associated data
description: |
Permanently deletes the agent and all associated runs, events,
decisions, evidence, alternatives, and access grants. This is a
GDPR-compliant erasure operation. Cannot delete the "admin" agent.
Requires `admin` role or higher.
parameters:
- $ref: "#/components/parameters/AgentIDPath"
responses:
"200":
description: Agent and all data deleted.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_DeleteAgentResponse"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
/v1/agents/{agent_id}/stats:
get:
operationId: getAgentStats
tags: [Agents]
summary: Get agent statistics
description: |
Returns aggregate decision statistics for a specific agent:
total count, average confidence, quality breakdown, and
decision type distribution.
Requires `admin` role or higher.
parameters:
- $ref: "#/components/parameters/AgentIDPath"
responses:
"200":
description: Agent statistics.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AgentStats"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
/v1/agents/{agent_id}/tags:
patch:
operationId: updateAgentTags
tags: [Agents]
summary: Update an agent's tags
description: |
Replace the tags for an agent. Tags enable group-based access control:
agents sharing at least one tag can see each other's decisions without
explicit grants. Tags coexist with the existing grant system.
Requires `admin` role or higher.
parameters:
- $ref: "#/components/parameters/AgentIDPath"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UpdateAgentTagsRequest"
responses:
"200":
description: Tags updated. Returns the updated agent.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_Agent"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
# ── Runs ───────────────────────────────────────────────────────────
/v1/runs:
post:
operationId: createRun
tags: [Runs]
summary: Start a new agent run
description: |
Create a new run for the authenticated agent. Runs are the top-level
execution context for recording events and decisions.
Requires `agent` role or higher.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateRunRequest"
responses:
"201":
description: Run created.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AgentRun"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
/v1/runs/{run_id}:
get:
operationId: getRun
tags: [Runs]
summary: Get a run with events and decisions
description: |
Retrieve a run along with all its events and decisions.
Requires `reader` role or higher.
parameters:
- $ref: "#/components/parameters/RunIDPath"
responses:
"200":
description: Run details with events and decisions.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_GetRunResponse"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
/v1/runs/{run_id}/events:
post:
operationId: appendEvents
tags: [Runs]
summary: Append events to a run
description: |
Append one or more events to an existing run.
Supports idempotent retries via `Idempotency-Key`.
Requires `agent` role or higher.
parameters:
- $ref: "#/components/parameters/RunIDPath"
- $ref: "#/components/parameters/IdempotencyKeyHeader"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AppendEventsRequest"
responses:
"200":
description: Events persisted.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AppendEventsResponse"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
/v1/runs/{run_id}/complete:
post:
operationId: completeRun
tags: [Runs]
summary: Complete or fail a run
description: |
Mark a run as completed or failed. Updates the run status and
records the completion time.
Supports idempotent retries via `Idempotency-Key`.
Requires `agent` role or higher.
parameters:
- $ref: "#/components/parameters/RunIDPath"
- $ref: "#/components/parameters/IdempotencyKeyHeader"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CompleteRunRequest"
responses:
"200":
description: Run completed.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AgentRun"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
# ── Trace ──────────────────────────────────────────────────────────
/v1/trace:
post:
operationId: trace
tags: [Trace]
summary: Record a decision in a single call
description: |
Convenience endpoint that creates a run, records a decision with
alternatives and evidence, appends lifecycle events, and completes
the run — all in a single transaction.
Supports idempotent retries via `Idempotency-Key`.
Requires `agent` role or higher.
parameters:
- $ref: "#/components/parameters/IdempotencyKeyHeader"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/TraceRequest"
example:
agent_id: planner
decision:
decision_type: architecture
outcome: "Use Redis for session caching"
confidence: 0.85
reasoning: "Redis handles expected QPS with sub-ms latency. TTL-based expiry prevents stale sessions without manual cleanup."
alternatives:
- label: "Redis"
score: 0.85
selected: true
- label: "Memcached"
score: 0.6
selected: false
rejection_reason: "No persistence — sessions lost on restart"
- label: "Database sessions"
score: 0.3
selected: false
rejection_reason: "Adds read load to primary database"
evidence:
- source_type: document
source_uri: "https://redis.io/docs/latest/develop/use/client-side-caching/"
content: "Redis supports client-side caching with server-assisted invalidation via RESP3."
relevance_score: 0.9
- source_type: agent_output
content: "Load test showed p99 < 2ms at 10k req/s with Redis 7 cluster."
relevance_score: 0.85
metadata:
sprint: "2026-Q1"
ticket: "ARCH-142"
responses:
"201":
description: Decision traced successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_TraceResponse"
example:
data:
run_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
decision_id: "f9e8d7c6-b5a4-3210-fedc-ba9876543210"
event_count: 6
meta:
request_id: "11223344-5566-7788-99aa-bbccddeeff00"
timestamp: "2026-01-15T10:30:00Z"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
# ── Query ──────────────────────────────────────────────────────────
/v1/query:
post:
operationId: queryDecisions
tags: [Query]
summary: Query decisions with filters
description: |
Query decisions with flexible filters, ordering, and pagination.
Optionally include alternatives and evidence in the response.
Requires `reader` role or higher.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/QueryRequest"
example:
filters:
decision_type: architecture
confidence_min: 0.7
time_range:
from: "2026-01-01T00:00:00Z"
include:
- alternatives
- evidence
order_by: created_at
order_dir: desc
limit: 10
offset: 0
responses:
"200":
description: Matching decisions.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_QueryResponse"
example:
data:
decisions:
- id: "f9e8d7c6-b5a4-3210-fedc-ba9876543210"
run_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
agent_id: planner
org_id: "00000000-0000-0000-0000-000000000001"
decision_type: architecture
outcome: "Use Redis for session caching"
confidence: 0.85
reasoning: "Redis handles expected QPS with sub-ms latency."
metadata:
sprint: "2026-Q1"
ticket: "ARCH-142"
completeness_score: 0.85
quality_score: 0.85
valid_from: "2026-01-15T10:30:00Z"
transaction_time: "2026-01-15T10:30:00Z"
created_at: "2026-01-15T10:30:00Z"
alternatives:
- id: "11111111-1111-1111-1111-111111111111"
decision_id: "f9e8d7c6-b5a4-3210-fedc-ba9876543210"
label: "Redis"
score: 0.85
selected: true
metadata: {}
created_at: "2026-01-15T10:30:00Z"
- id: "22222222-2222-2222-2222-222222222222"
decision_id: "f9e8d7c6-b5a4-3210-fedc-ba9876543210"
label: "Memcached"
score: 0.6
selected: false
rejection_reason: "No persistence — sessions lost on restart"
metadata: {}
created_at: "2026-01-15T10:30:00Z"
evidence:
- id: "33333333-3333-3333-3333-333333333333"
decision_id: "f9e8d7c6-b5a4-3210-fedc-ba9876543210"
org_id: "00000000-0000-0000-0000-000000000001"
source_type: document
source_uri: "https://redis.io/docs/latest/develop/use/client-side-caching/"
content: "Redis supports client-side caching with server-assisted invalidation via RESP3."
relevance_score: 0.9
metadata: {}
created_at: "2026-01-15T10:30:00Z"
total: 1
count: 1
limit: 10
offset: 0
meta:
request_id: "aabbccdd-eeff-0011-2233-445566778899"
timestamp: "2026-01-15T10:31:00Z"
"400":
$ref: "#/components/responses/BadRequest"
/v1/query/temporal:
post:
operationId: temporalQuery
tags: [Query]
summary: Query decisions as of a point in time
description: |
Bi-temporal query: returns decisions that were valid at the specified
`as_of` timestamp. Uses the valid_from/valid_to temporal columns.
Requires `reader` role or higher.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/TemporalQueryRequest"
responses:
"200":
description: Decisions valid at the specified time.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_TemporalQueryResponse"
"400":
$ref: "#/components/responses/BadRequest"
/v1/agents/{agent_id}/history:
get:
operationId: agentHistory
tags: [Query]
summary: Get decision history for an agent
description: |
Retrieve the decision history for a specific agent with pagination
and optional time range filtering.
Requires `reader` role or higher.
parameters:
- $ref: "#/components/parameters/AgentIDPath"
- name: limit
in: query
schema:
type: integer
default: 50
minimum: 1
maximum: 1000
- name: offset
in: query
schema:
type: integer
default: 0
minimum: 0
- name: from
in: query
description: Start of time range (RFC 3339).
schema:
type: string
format: date-time
- name: to
in: query
description: End of time range (RFC 3339).
schema:
type: string
format: date-time
responses:
"200":
description: Agent decision history.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_AgentHistoryResponse"
"400":
$ref: "#/components/responses/BadRequest"
/v1/decisions/{id}:
get:
operationId: getDecision
tags: [Decisions]
summary: Get a decision by ID
description: |
Retrieve a single decision by its UUID, including alternatives
and evidence. Requires `reader` role or higher. Access is
subject to grant-based filtering.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: Decision UUID.
responses:
"200":
description: The decision with alternatives and evidence.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_Decision"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
/v1/decisions/recent:
get:
operationId: recentDecisions
tags: [Query]
summary: List recent decisions
description: |
Retrieve the most recent decisions, optionally filtered by agent
or decision type.
Requires `reader` role or higher.
parameters:
- name: agent_id
in: query
schema:
type: string
- name: decision_type
in: query
schema:
type: string
- name: limit
in: query
schema:
type: integer
default: 10
minimum: 1
maximum: 1000
responses:
"200":
description: Recent decisions.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_RecentDecisionsResponse"
/v1/decisions/{id}/revisions:
get:
operationId: getDecisionRevisions
tags: [Query]
summary: Get decision revision history
description: |
Retrieve the full revision chain for a decision, including all
prior and subsequent versions linked via `supersedes_id`.
Requires `reader` role or higher.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The decision ID to get revisions for.
responses:
"200":
description: Revision chain for the decision.
content:
application/json:
schema:
$ref: "#/components/schemas/APIResponse_RevisionsResponse"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
/v1/decisions/{id}/conflicts:
get:
operationId: getDecisionConflicts
tags: [Conflicts]
summary: Get conflicts involving a decision
description: |
Returns all detected conflicts where this decision appears as
either side (A or B). Useful for understanding whether a specific
decision contradicts or supersedes other decisions.
Requires `reader` role or higher.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The decision ID to find conflicts for.
- name: status
in: query
required: false
schema:
type: string
enum: [open, acknowledged, resolved, wont_fix]
description: Filter by conflict status.
responses:
"200":
description: Conflicts involving this decision.
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
decision_id:
type: string
format: uuid
conflicts:
type: array
items:
$ref: "#/components/schemas/DecisionConflict"
total:
type: integer
meta:
$ref: "#/components/schemas/ResponseMeta"
"400":
$ref: "#/components/responses/BadRequest"
/v1/decisions/{id}/assess:
post:
operationId: assessDecision
tags: [Decisions]
summary: Submit outcome assessment for a decision
description: |
Records explicit outcome feedback for a prior decision. Append-only:
each call creates a new row. Re-assessing creates a revision record
rather than overwriting, preserving the full assessment history.
The summary counts only the latest assessment per assessor so current
verdicts are accurate even when assessors change their minds.
Requires `agent` role or higher.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The decision ID to assess.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [outcome]
properties:
outcome:
type: string
enum: [correct, incorrect, partially_correct]
description: Whether the decision turned out to be correct.
notes:
type: string
description: Optional explanation of the assessment.
responses:
"200":
description: Assessment recorded.
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/DecisionAssessment"
meta:
$ref: "#/components/schemas/ResponseMeta"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
/v1/decisions/{id}/assessments:
get:
operationId: listDecisionAssessments
tags: [Decisions]
summary: List assessments for a decision
description: |
Returns all outcome assessments for a decision, newest first,
along with an aggregated summary of counts by outcome.
Requires `reader` role or higher.
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The decision ID.
responses:
"200":
description: Assessments and summary.
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
decision_id:
type: string
format: uuid
summary:
$ref: "#/components/schemas/AssessmentSummary"
assessments:
type: array
items:
$ref: "#/components/schemas/DecisionAssessment"
count:
type: integer
meta:
$ref: "#/components/schemas/ResponseMeta"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
/v1/decisions/{id}/erase:
post:
operationId: eraseDecision
tags: [Decisions, GDPR]
summary: GDPR tombstone erasure
description: |
Scrubs PII fields (outcome, reasoning) from a decision in-place
without deleting the row, preserving the audit chain. Also scrubs
associated alternatives (label, rejection_reason) and evidence
(content, source_uri). Recomputes the content hash over the
scrubbed fields and records the original hash in a decision_erasures