-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1817 lines (1817 loc) · 71.1 KB
/
Copy pathopenapi.yaml
File metadata and controls
1817 lines (1817 loc) · 71.1 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: Vdoc API
version: 0.1.0
description: Machine-readable contract for the Vdoc v0.1 HTTP API. Projects own typed Documents, including OpenAPI and Markdown. REST handlers return HTTP 200 with the semantic result in the Vdoc envelope body.
servers:
- url: /
security: []
tags:
- name: Open
description: Public health, authentication, docs, and MCP entry points.
- name: Document Shares
description: Admin-managed document share links and minimal anonymous published-content access.
- name: Identity
description: Current user identity.
- name: System Users
description: Super admin user lifecycle and user MCP token oversight.
- name: Teams
description: Team lifecycle.
- name: Projects
description: Project lifecycle and membership.
- name: Documents
description: Project document lifecycle.
- name: Branches
description: Document branch lifecycle.
- name: Drafts
description: Document draft creation, update, review, and promotion.
- name: Versions
description: Published document versions and stored content.
- name: Endpoints
description: Parsed endpoint data from published document versions.
- name: Diffs
description: Document version comparison.
- name: Audit Logs
description: Filtered audit history for super administrators and project administrators.
- name: MCP Tokens
description: User MCP token lifecycle.
- name: AI
description: Built-in Admin AI provider, prompt, summary, and page chat APIs. AI can summarize and explain only; it cannot approve, request changes, reject, publish, or modify drafts or versions. Draft submit and version publish attempt summaries after the state change is saved. Skipped or failed summaries are stored without blocking submit or publish. AI audit metadata may include prompt_tokens, completion_tokens, and total_tokens, but never raw API keys, JWTs, MCP tokens, or Authorization headers.
paths:
/api/v1/open/health:
get:
tags: [Open]
summary: Get health.
operationId: getOpenHealth
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/auth/register:
post:
tags: [Open]
summary: Register a user and issue a JWT when anonymous registration is enabled.
description: Disabled by default. Operators must explicitly set auth.allow_registration=true only for trusted disposable or pilot environments.
operationId: registerAuth
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AuthRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/auth/login:
post:
tags: [Open]
summary: Authenticate a user and issue a JWT.
operationId: loginAuth
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AuthRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/auth/config:
get:
tags: [Open]
summary: Read public authentication capabilities.
description: Returns whether anonymous registration is enabled so clients can hide unavailable registration flows.
operationId: getAuthConfig
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/docs/openapi.yaml:
get:
tags: [Open]
summary: Serve this OpenAPI YAML document.
operationId: getOpenAPISpec
responses:
"200": { $ref: "#/components/responses/OpenAPISpecResponse" }
/api/v1/open/mcp:
post:
tags: [Open]
summary: Call MCP tools through JSON-RPC 2.0.
description: Every authenticated `tools/list` and `tools/call` request records a sanitized `mcp.tool_call` audit event. Successful published-content tools are marked with `evidence_kind=published_content_read` and retain only the tool, adapter, result/reason, MCP token ID, and referenced project/document/branch/draft/version/endpoint/diff IDs. Raw MCP token secrets, request arguments, OpenAPI schemas, and Markdown content are never copied into audit metadata.
operationId: callMCP
security:
- MCPTokenAuth: []
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/MCPCallRequest" }
responses:
"200": { $ref: "#/components/responses/MCPJSONRPCResponse" }
/api/v1/open/document-shares/{share_id}:
parameters:
- { $ref: "#/components/parameters/ShareID" }
get:
tags: [Document Shares]
summary: Read minimal metadata for an authorized public document share.
operationId: getPublicDocumentShare
security: [{ DocumentShareAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/document-shares/{share_id}/unlock:
parameters:
- { $ref: "#/components/parameters/ShareID" }
post:
tags: [Document Shares]
summary: Exchange a valid share password for a short-lived memory-only unlock proof.
operationId: unlockPublicDocumentShare
security: [{ DocumentShareAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DocumentShareUnlockRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/document-shares/{share_id}/versions:
parameters:
- { $ref: "#/components/parameters/ShareID" }
get:
tags: [Document Shares]
summary: List published versions allowed by an all-versions share.
operationId: listPublicDocumentShareVersions
security: [{ DocumentShareAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/open/document-shares/{share_id}/versions/{version_id}/content:
parameters:
- { $ref: "#/components/parameters/ShareID" }
- { $ref: "#/components/parameters/VersionID" }
get:
tags: [Document Shares]
summary: Read an allowed immutable published snapshot.
operationId: getPublicDocumentShareContent
security: [{ DocumentShareAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/open/document-shares/{share_id}/versions/{version_id}/download:
parameters:
- { $ref: "#/components/parameters/ShareID" }
- { $ref: "#/components/parameters/VersionID" }
get:
tags: [Document Shares]
summary: Download an allowed immutable published source file through Vdoc authorization.
operationId: downloadPublicDocumentShareVersion
security: [{ DocumentShareAuth: [] }]
responses:
"200": { $ref: "#/components/responses/PublicDocumentDownloadResponse" }
/api/v1/private/identity/me:
get:
tags: [Identity]
summary: Get current user.
description: Returns the active identity plus can_access_audit, a server-computed capability used by clients without enumerating project memberships.
operationId: getIdentityMe
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/system/users:
get:
tags: [System Users]
summary: List users.
operationId: listSystemUsers
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [System Users]
summary: Create user.
operationId: createSystemUser
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateUserRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/system/users/{user_id}:
parameters:
- { $ref: "#/components/parameters/UserID" }
patch:
tags: [System Users]
summary: Patch user.
operationId: patchSystemUser
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PatchUserRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/system/users/{user_id}/mcp-tokens:
parameters:
- { $ref: "#/components/parameters/UserID" }
get:
tags: [System Users]
summary: List a user's MCP tokens.
operationId: listSystemUserMCPTokens
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/system/users/{user_id}/mcp-tokens/{token_id}/revoke:
parameters:
- { $ref: "#/components/parameters/UserID" }
- { $ref: "#/components/parameters/TokenID" }
post:
tags: [System Users]
summary: Revoke a user's MCP token.
operationId: revokeSystemUserMCPToken
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/teams:
get:
tags: [Teams]
summary: List teams (SuperAdmin only).
operationId: listTeams
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Teams]
summary: Create team.
operationId: createTeam
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/NameDescriptionRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/teams/{team_id}:
parameters:
- { $ref: "#/components/parameters/TeamID" }
get:
tags: [Teams]
summary: Get team (SuperAdmin only).
operationId: getTeam
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
patch:
tags: [Teams]
summary: Update team.
operationId: updateTeam
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PatchNameDescriptionRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/teams/{team_id}/archive:
parameters:
- { $ref: "#/components/parameters/TeamID" }
post:
tags: [Teams]
summary: Archive team.
operationId: archiveTeam
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects:
get:
tags: [Projects]
summary: List projects.
operationId: listProjects
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Projects]
summary: Create project.
operationId: createProject
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateProjectRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
get:
tags: [Projects]
summary: Get project.
operationId: getProject
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
patch:
tags: [Projects]
summary: Update project.
operationId: updateProject
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PatchNameDescriptionRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/archive:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
post:
tags: [Projects]
summary: Archive project.
operationId: archiveProject
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/members:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
get:
tags: [Projects]
summary: List project members.
operationId: listProjectMembers
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Projects]
summary: Add project member.
operationId: addProjectMember
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AddProjectMemberRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/member-candidates:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
get:
tags: [Projects]
summary: List active users eligible to join the project.
description: Project Admin or SuperAdmin only. Existing active project members and disabled users are excluded.
operationId: listProjectMemberCandidates
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/projects/{project_id}/members/{user_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/UserID" }
delete:
tags: [Projects]
summary: Remove project member.
operationId: removeProjectMember
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/members/{user_id}/role:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/UserID" }
patch:
tags: [Projects]
summary: Change project member role.
operationId: patchProjectMemberRole
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema:
{ $ref: "#/components/schemas/PatchProjectMemberRoleRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
get:
tags: [Documents]
summary: List project documents.
operationId: listProjectDocuments
security: [{ JWTAuth: [] }]
parameters:
- name: document_type
in: query
required: false
schema: { type: integer, minimum: 1 }
description: Filter documents by type code (1 OpenAPI, 2 Markdown).
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Documents]
summary: Create project document.
description: Creates a typed Document. document_type 1 is OpenAPI and 2 is Markdown. relative_path is the stored project-local path identity.
operationId: createProjectDocument
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DocumentRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Documents]
summary: Get project document.
operationId: getProjectDocument
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
patch:
tags: [Documents]
summary: Update project document.
description: Updates document metadata only. Lifecycle status cannot be changed here; use the archive action. Invalid lifecycle input is rejected before any metadata is committed.
operationId: updateProjectDocument
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PatchDocumentRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/overview:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Documents]
summary: Read document statistics without downloading bodies or full lists.
description: "Detail contains version_count, endpoint_count, latest_version (public version DTO or null), published_branch_ids (active published branches), has_reviewed_draft (submitted or published draft on an active branch), raw_size_bytes and nullable raw_line_count. Requires document read permission."
operationId: getDocumentOverview
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/mcp-readiness:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Documents]
summary: Read the latest successful Agent document read across all history.
description: "Detail contains nullable last_read_at. Only the current user's active unexpired tokens with the document's matching read scope count. Requires document read permission; archived parents return null."
operationId: getDocumentMCPReadiness
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/archive:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
post:
tags: [Documents]
summary: Archive project document.
operationId: archiveProjectDocument
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/shares:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Document Shares]
summary: List retained public-share history for a document.
operationId: listDocumentShares
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Document Shares]
summary: Create an immutable branch-bound public-share policy and return its capability once.
description: Requires an active Project, Document, and Branch with at least one published version. Archived parents retain list and revoke access but block creation.
operationId: createDocumentShare
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateDocumentShareRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/shares/{share_id}/reveal:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/ShareID" }
post:
tags: [Document Shares]
summary: Reveal an active share capability without returning its password.
description: Requires active parent resources. Archived parents retain list and revoke access but block capability reveal.
operationId: revealDocumentShare
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/shares/{share_id}/revoke:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/ShareID" }
post:
tags: [Document Shares]
summary: Irreversibly revoke an active public document share.
operationId: revokeDocumentShare
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/branches:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Branches]
summary: List document branches.
operationId: listDocumentBranches
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Branches]
summary: Create document branch.
operationId: createDocumentBranch
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateBranchRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/branches/{branch_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/BranchID" }
get:
tags: [Branches]
summary: Get document branch.
operationId: getDocumentBranch
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
patch:
tags: [Branches]
summary: Update document branch.
operationId: updateDocumentBranch
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PatchBranchRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/branches/{branch_id}/archive:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/BranchID" }
post:
tags: [Branches]
summary: Archive document branch.
operationId: archiveDocumentBranch
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Drafts]
summary: List document drafts.
operationId: listDocumentDrafts
security: [{ JWTAuth: [] }]
parameters:
- { $ref: "#/components/parameters/BranchIDQuery" }
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
post:
tags: [Drafts]
summary: Create document draft.
operationId: createDocumentDraft
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/DraftRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/{draft_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DraftID" }
get:
tags: [Drafts]
summary: Get document draft.
operationId: getDocumentDraft
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
patch:
tags: [Drafts]
summary: Update document draft.
operationId: updateDocumentDraft
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PatchDraftRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/{draft_id}/content/{content_kind}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DraftID" }
- { $ref: "#/components/parameters/ContentKind" }
get:
tags: [Drafts]
summary: Get document draft content.
description: Returns content, hash, and a nested draft DTO from the same snapshot. Use detail.draft.revision as expected_revision when saving edits, and detail.draft.review_revision as expected_review_revision when reviewing this content and its diff. Unpublished draft previews use the current branch latest as their baseline.
operationId: getDocumentDraftContent
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/{draft_id}/submit:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DraftID" }
post:
tags: [Drafts]
summary: Submit document draft.
operationId: submitDocumentDraft
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/{draft_id}/approve:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DraftID" }
post:
tags: [Drafts]
summary: Approve document draft.
operationId: approveDocumentDraft
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ReviewRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/{draft_id}/request-changes:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DraftID" }
post:
tags: [Drafts]
summary: Request document draft changes.
operationId: requestDocumentDraftChanges
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ReviewRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/{draft_id}/reject:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DraftID" }
post:
tags: [Drafts]
summary: Reject document draft.
operationId: rejectDocumentDraft
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ReviewRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/drafts/promote:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
post:
tags: [Drafts]
summary: Promote document draft.
operationId: promoteDocumentDraft
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/PromoteDraftRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/versions:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
get:
tags: [Versions]
summary: List published document versions.
operationId: listDocumentVersions
security: [{ JWTAuth: [] }]
parameters:
- { $ref: "#/components/parameters/BranchIDQuery" }
- { $ref: "#/components/parameters/PageSizeQuery" }
- { $ref: "#/components/parameters/OffsetQuery" }
- { $ref: "#/components/parameters/SearchQuery" }
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/versions/{version_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/VersionID" }
get:
tags: [Versions]
summary: Get published document version.
operationId: getDocumentVersion
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/versions/{version_id}/content/{content_kind}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/VersionID" }
- { $ref: "#/components/parameters/ContentKind" }
get:
tags: [Versions]
summary: Get document version content.
operationId: getDocumentVersionContent
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/versions/{version_id}/endpoints:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/VersionID" }
get:
tags: [Endpoints]
summary: List endpoints indexed from a document version.
operationId: listDocumentVersionEndpoints
security: [{ JWTAuth: [] }]
parameters:
- { $ref: "#/components/parameters/PageSizeQuery" }
- { $ref: "#/components/parameters/OffsetQuery" }
- { $ref: "#/components/parameters/SearchQuery" }
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/versions/{version_id}/endpoints/{endpoint_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/VersionID" }
- { $ref: "#/components/parameters/EndpointID" }
get:
tags: [Endpoints]
summary: Get endpoint detail.
operationId: getDocumentVersionEndpoint
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/diffs:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
post:
tags: [Diffs]
summary: Compare document versions.
description: Creates or returns a comparison only when the Project and Document are active and the two version IDs differ. Stored Diff history remains readable after archive.
operationId: createDocumentDiff
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CreateDiffRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
get:
tags: [Diffs]
summary: List stored document diffs.
description: Optional from_version_id and to_version_id query parameters select an exact version pair.
operationId: listDocumentDiffs
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/diffs/{diff_id}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DiffID" }
get:
tags: [Diffs]
summary: Get document diff.
operationId: getDocumentDiff
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/documents/{document_id}/diffs/{diff_id}/summary:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/DocumentID" }
- { $ref: "#/components/parameters/DiffID" }
get:
tags: [Diffs]
summary: Get document diff summary.
operationId: getDocumentDiffSummary
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/audit-logs:
get:
tags: [Audit Logs]
summary: List authorized audit history.
description: Super administrators may query all projects. Project administrators must supply project_id and can query only projects they administer. Reader and writer roles are denied. Results are newest first with at most 200 rows per page. Follow next_cursor to continue; has_more indicates whether a next page exists. A global total is omitted.
operationId: listAuditLogs
security: [{ JWTAuth: [] }]
parameters:
- {
name: project_id,
in: query,
required: false,
schema: { type: string },
}
- { name: action, in: query, required: false, schema: { type: string } }
- {
name: resource_type,
in: query,
required: false,
schema: { type: string },
}
- {
name: resource_id,
in: query,
required: false,
schema: { type: string },
}
- {
name: limit,
in: query,
required: false,
schema: { type: integer, minimum: 1, maximum: 200, default: 100 },
}
- { name: cursor, in: query, schema: { type: string, maxLength: 512 }, description: Opaque next_cursor from the preceding page. Filters and authorization apply on every request. }
- { name: from, in: query, schema: { type: string, format: date-time }, description: Inclusive lower time bound. }
- { name: to, in: query, schema: { type: string, format: date-time }, description: Exclusive upper time bound. }
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/ai/provider:
get:
tags: [AI]
summary: Get system AI provider configuration.
description: SuperAdmin only. Returns provider detail using AIProviderResponse. The response includes tuning fields temperature, timeout_ms, and max_output_tokens, plus redacted key state through api_key_set and api_key_last4.
operationId: getSystemAIProvider
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
put:
tags: [AI]
summary: Upsert system AI provider configuration.
description: SuperAdmin only. Saves an OpenAI-compatible provider. Omitted tuning fields use defaults from AIProviderRequest. The raw api_key is accepted only in the request and is never returned.
operationId: putSystemAIProvider
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AIProviderRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/ai/provider/test:
post:
tags: [AI]
summary: Test the system AI provider without exposing its API key.
description: SuperAdmin only. Tests the saved provider when the body is omitted, or tests the supplied AIProviderRequest without exposing the API key. Audit metadata records token usage when the provider returns usage fields and excludes secrets.
operationId: testSystemAIProvider
security: [{ JWTAuth: [] }]
requestBody:
required: false
content:
application/json:
schema: { $ref: "#/components/schemas/AIProviderRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/ai/provider:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
get:
tags: [AI]
summary: Get project AI provider configuration.
description: Project Admin or SuperAdmin only; Reader and Writer are denied even though they may use page summaries and chat where document permissions allow. Returns the project override using AIProviderResponse when configured. Historical configuration remains readable after project archive. Provider response fields include tuning values and redacted key metadata only.
operationId: getProjectAIProvider
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
put:
tags: [AI]
summary: Upsert project AI provider configuration.
description: Project Admin or SuperAdmin only. Saves a project-level provider override for an active project with the same AIProviderRequest tuning defaults and ranges as the system provider. Archived project configuration cannot be changed.
operationId: putProjectAIProvider
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AIProviderRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/ai/provider/test:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
post:
tags: [AI]
summary: Test the effective project AI provider.
description: Project Admin or SuperAdmin only, and the project must be active. With no request body, tests the effective provider and falls back to the enabled system provider when no enabled project override exists. A request body supplies AIProviderRequest for a one-off project-scoped test. Reader and Writer are denied this configuration operation but may use page summaries and chat where document permissions allow.
operationId: testProjectAIProvider
security: [{ JWTAuth: [] }]
requestBody:
required: false
content:
application/json:
schema: { $ref: "#/components/schemas/AIProviderRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/ai/prompts:
get:
tags: [AI]
summary: List effective system AI prompts.
description: SuperAdmin only. Returns built-in prompts with any effective system overrides and the immutable AI guard appended.
operationId: listSystemAIPrompts
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/ai/prompts/{prompt_key}:
parameters:
- { $ref: "#/components/parameters/AIPromptKey" }
put:
tags: [AI]
summary: Upsert a system AI prompt override.
description: SuperAdmin only. The path supplies prompt_key; the body supplies only editable prompt content. Every user_prompt_template must contain {{context}}, and page_chat must also contain {{message}}.
operationId: putSystemAIPrompt
security: [{ JWTAuth: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AIPromptRequest" }
responses:
"200": { $ref: "#/components/responses/VdocEnvelopeResponse" }
/api/v1/private/projects/{project_id}/ai/prompts:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
get:
tags: [AI]
summary: List effective project AI prompts.
description: Project Admin or SuperAdmin only; Reader and Writer are denied even though they may use page summaries and chat where document permissions allow. Returns project overrides layered over system or built-in prompts. Historical prompt configuration remains readable after project archive.
operationId: listProjectAIPrompts
security: [{ JWTAuth: [] }]
responses:
"200": { $ref: "#/components/responses/VdocListEnvelopeResponse" }
/api/v1/private/projects/{project_id}/ai/prompts/{prompt_key}:
parameters:
- { $ref: "#/components/parameters/ProjectID" }
- { $ref: "#/components/parameters/AIPromptKey" }