Repository navigation
Expand file tree
/
Copy pathopenapi.json
More file actions
9161 lines (9161 loc) · 396 KB
/
Copy pathopenapi.json
File metadata and controls
9161 lines (9161 loc) · 396 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",
"x-maintenance": "Hand-written and checked in, not generated: Hono registers routes as code and there is no decorator to read them off. That makes this file a promise rather than a derivation, so it has to be updated in the same change set as any route it describes - see CLAUDE.md. The rationale for every route is in resources/design/http-api.md; the operator's version is resources/guide/http-api.md. Where the three disagree, the design doc is the spec and this is the bug.",
"info": {
"title": "silo HTTP API",
"version": "1.6.0",
"summary": "The CRUD, media, transfer, plugin and administration API of a silo instance.",
"description": "JSON everywhere, under `/api`. There is no URL versioning (D13): a breaking\nchange is a release-note event tied to a binary upgrade, and the archive\nformat carries its own `format_version`. CORS is enabled for `/api/*`, and\nfor `GET` and `HEAD` on `/media/*` (D101).\n\n**Environment paths have two spellings.** Every path below written\n`/environments` is also served at `/envs` — one handler registered twice, so\nauthorization cannot land on one spelling and miss the other. Only the\ncanonical `/environments` form is listed here; `/envs` behaves identically.\n\n**Authentication** is a claims-based API key, presented as\n`Authorization: Bearer <key>` or `X-Api-Key: <key>`. There are no users,\nsessions or cookies. Claims are deny-by-default. A collection whose schema\ndoes not set `\"x-silo-auth\": true` is readable anonymously; once a key is\npresented its claims become the visibility boundary, and even a public\ncollection then needs the matching read claim. The claim each operation asks\nfor is named in its description.\n\n**Optimistic concurrency.** `PUT` and `DELETE` on an entry, and every plugin\nmutation that writes a record, require the expected revision as\n`If-Match: \"3\"` or `?rev=3`. A mismatch is `409`.\n\n**Variables.** Every route that answers an entry substitutes `{{NAME}}` from\nthe environment's variables by default. `?variables=raw` answers the stored\ntext instead, for editors. Any other value is `400`.\n",
"license": {
"name": "See LICENSE in the repository"
},
"contact": {
"name": "silo",
"url": "https://github.com/org-quicko/silo"
}
},
"servers": [
{
"url": "http://localhost:8090",
"description": "A local instance on the default listen address."
},
{
"url": "{scheme}://{host}",
"description": "Any self-hosted instance.",
"variables": {
"scheme": {
"default": "https",
"enum": [
"http",
"https"
]
},
"host": {
"default": "silo.example.com"
}
}
}
],
"security": [
{
"bearerAuth": []
},
{
"apiKeyAuth": []
}
],
"tags": [
{
"name": "Health",
"description": "Liveness, and who the presented key is."
},
{
"name": "MCP",
"description": "The Model Context Protocol surface: the HTTP API as a tool set for AI clients (D86)."
},
{
"name": "Projects",
"description": "Projects and the environments inside them."
},
{
"name": "Variables",
"description": "Names declared per project, valued per environment (D57)."
},
{
"name": "Collections",
"description": "Collection definitions and their JSON Schemas."
},
{
"name": "Entries",
"description": "The content itself."
},
{
"name": "Search",
"description": "Full-text and filtered search at three reaches (D30)."
},
{
"name": "Media",
"description": "The instance-global media library (D23)."
},
{
"name": "Media configuration",
"description": "Where the bytes go, where URLs point, what may be uploaded."
},
{
"name": "Keys",
"description": "API keys and their claims."
},
{
"name": "Transfer",
"description": "Export, import, and instance-to-instance copy."
},
{
"name": "Plugins",
"description": "Plugin packages, grants and lifecycle."
},
{
"name": "Plugin routes",
"description": "The routes a plugin declares (D36)."
},
{
"name": "Trash",
"description": "What a delete left behind, and the two ways out of it (D113).\n\nOne receipt per **explicitly** deleted thing: a collection deleted with 300\nentries under it is one item saying \"300 entries\", not 301 items. Listing\ntakes no claim of its own — each receipt is filtered by the read claim its\norigin already required, so two keys see two different trashes. Restoring\nasks for the write claims at the destination. Only purging has a claim, and\nno preset but `root` carries it.\n"
},
{
"name": "Administration",
"description": "The audit trail, operating metrics and server settings."
}
],
"paths": {
"/api/health": {
"get": {
"tags": [
"Health"
],
"summary": "Liveness and version",
"description": "The one route the auth middleware skips entirely. Never authenticated.",
"operationId": "getHealth",
"security": [],
"responses": {
"200": {
"description": "The server is up.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"status",
"version"
],
"properties": {
"status": {
"const": "ok"
},
"version": {
"type": "string",
"examples": [
"1.6.0"
]
}
}
}
}
}
}
}
}
},
"/api/session": {
"get": {
"tags": [
"Health"
],
"summary": "The presented key",
"description": "The label, display prefix and normalized claims of the key on this\nrequest. The admin calls it to verify a key before saving a server.\n",
"operationId": "getSession",
"responses": {
"200": {
"description": "The authenticated key.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"label",
"prefix",
"claims",
"trash"
],
"properties": {
"label": {
"type": "string"
},
"prefix": {
"type": "string",
"description": "The display prefix, e.g. `silo_ab12`. Empty under `--no-auth`."
},
"claims": {
"type": "array",
"items": {
"type": "string"
}
},
"trash": {
"type": "object",
"description": "How this instance treats deletes (D113), so a delete dialog can say whether the delete can be undone.",
"required": [
"enabled",
"retention_days"
],
"properties": {
"enabled": {
"type": "boolean"
},
"retention_days": {
"type": "integer",
"description": "`0` keeps trash items until they are purged."
}
}
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
}
}
},
"/api/mcp": {
"post": {
"tags": [
"MCP"
],
"summary": "MCP over Streamable HTTP",
"description": "The Model Context Protocol endpoint (D86). One JSON-RPC 2.0 message, or a batch of them, in; the reply out as `application/json`. silo answers `initialize`, `ping`, `tools/list` and `tools/call`; a body holding only notifications answers `202` with no body; an unknown method is `-32601`.\n\nEvery `tools/call` is dispatched through this same API with the presented key, so a tool asks for exactly the claim its route asks for, and a route's refusal comes back as a result with `isError: true` rather than as a protocol error. The endpoint is stateless: no `Mcp-Session-Id` is issued and `GET` and `DELETE` are `405`. A key is required even where the equivalent `GET` would be public. The tool catalog and the client configurations are in resources/guide/mcp.md.\n",
"operationId": "postMcp",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/JsonRpcRequest"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/JsonRpcRequest"
}
}
]
}
}
}
},
"responses": {
"200": {
"description": "The reply, or an array of replies for a batch (notifications in the batch get none).",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/JsonRpcResponse"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/JsonRpcResponse"
}
}
]
}
}
}
},
"202": {
"description": "The body held only notifications. No content."
},
"400": {
"description": "The body is not JSON: a JSON-RPC `-32700` with a `null` id.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JsonRpcResponse"
}
}
}
},
"401": {
"description": "No key, or an invalid one. Carries `WWW-Authenticate: Bearer realm=\"silo\"`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
}
}
},
"get": {
"tags": [
"MCP"
],
"summary": "No event stream",
"description": "silo never sends a request of its own, so there is no server-to-client stream to open. Always `405` with `Allow: POST`.",
"operationId": "getMcp",
"responses": {
"405": {
"description": "`method_not_allowed`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"tags": [
"MCP"
],
"summary": "No session to end",
"description": "The endpoint is stateless and issues no `Mcp-Session-Id`, so there is nothing to terminate. Always `405` with `Allow: POST`.",
"operationId": "deleteMcp",
"responses": {
"405": {
"description": "`method_not_allowed`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/projects": {
"get": {
"tags": [
"Projects"
],
"summary": "List projects",
"description": "Visibility is per project: a key sees a project it holds a collection\nclaim for, and nothing else. Fixed claims such as `keys:read` deliberately\ndo not count. With no key, only projects holding a public collection.\n",
"operationId": "listProjects",
"responses": {
"200": {
"description": "The projects this caller may see.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"items"
],
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Project"
}
}
}
}
}
}
}
}
},
"post": {
"tags": [
"Projects"
],
"summary": "Create a project",
"description": "Claim: `collections:{project}/*/*:create`.",
"operationId": "createProject",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "The id under any of three accepted spellings.",
"properties": {
"id": {
"$ref": "#/components/schemas/ScopeName"
},
"name": {
"$ref": "#/components/schemas/ScopeName"
},
"project": {
"$ref": "#/components/schemas/ScopeName"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Created.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Project"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
}
}
}
},
"/api/projects/{project}": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
}
],
"patch": {
"tags": [
"Projects"
],
"summary": "Rename a project",
"description": "Claims are `collections:create` and `collections:delete` at\n`{project}/*/*`, checked at **both** the old and the new name (D51).\nThe response says which claims were rewritten to follow the rename and\nwhich changed reach without being rewritten.\n",
"operationId": "renameProject",
"parameters": [
{
"$ref": "#/components/parameters/ExpectedId"
},
{
"$ref": "#/components/parameters/DryRun"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"$ref": "#/components/schemas/ScopeName"
}
}
}
}
}
},
"responses": {
"200": {
"description": "What the rename did, or would do under `?dry_run=true`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RenamePreview"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
}
}
},
"delete": {
"tags": [
"Projects"
],
"summary": "Delete a project",
"description": "Refuses while content exists. `?force=true` erases every entry\nunderneath and additionally requires `entries:delete` at `{project}/*/*`\n(D37).\n\n**Deletes are recoverable (D113).** Unless `?permanent=true`, this moves the\ncontent to the trash, where `GET /api/trash` lists it and\n`POST /api/trash/{id}/restore` puts it back. `?permanent=true` destroys it now\nand asks for `trash:purge`. An instance with `[trash] enabled = false` deletes\npermanently either way.\n",
"operationId": "deleteProject",
"parameters": [
{
"$ref": "#/components/parameters/Force"
},
{
"$ref": "#/components/parameters/Permanent"
}
],
"responses": {
"204": {
"description": "Deleted."
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
}
}
}
},
"/api/projects/{project}/environments": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
}
],
"get": {
"tags": [
"Projects"
],
"summary": "List environments",
"description": "Filtered by claim, the way the project listing is. Also served at `/envs`.",
"operationId": "listEnvironments",
"responses": {
"200": {
"description": "The environments this caller may see.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"items"
],
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Environment"
}
}
}
}
}
}
}
}
},
"post": {
"tags": [
"Projects"
],
"summary": "Create an environment",
"description": "Claim: `collections:{project}/{env}/*:create`.",
"operationId": "createEnvironment",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/ScopeName"
},
"name": {
"$ref": "#/components/schemas/ScopeName"
},
"env": {
"$ref": "#/components/schemas/ScopeName"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Created.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Environment"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
}
}
}
},
"/api/projects/{project}/environments/{env}": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
},
{
"$ref": "#/components/parameters/Env"
}
],
"patch": {
"tags": [
"Projects"
],
"summary": "Rename an environment",
"description": "Rename permissions at `{project}/{env}/*`, at both names (D51).",
"operationId": "renameEnvironment",
"parameters": [
{
"$ref": "#/components/parameters/ExpectedId"
},
{
"$ref": "#/components/parameters/DryRun"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"$ref": "#/components/schemas/ScopeName"
}
}
}
}
}
},
"responses": {
"200": {
"description": "What the rename did, or would do.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RenamePreview"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
}
}
},
"delete": {
"tags": [
"Projects"
],
"summary": "Delete an environment",
"description": "Refuses while content exists. `?force=true` additionally requires\n`entries:delete` at `{project}/{env}/*`.\n\n**Deletes are recoverable (D113).** Unless `?permanent=true`, this moves the\ncontent to the trash, where `GET /api/trash` lists it and\n`POST /api/trash/{id}/restore` puts it back. `?permanent=true` destroys it now\nand asks for `trash:purge`. An instance with `[trash] enabled = false` deletes\npermanently either way.\n",
"operationId": "deleteEnvironment",
"parameters": [
{
"$ref": "#/components/parameters/Force"
},
{
"$ref": "#/components/parameters/Permanent"
}
],
"responses": {
"204": {
"description": "Deleted."
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
}
}
}
},
"/api/projects/{project}/environments/{env}/copy": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
},
{
"$ref": "#/components/parameters/Env"
}
],
"post": {
"tags": [
"Transfer"
],
"summary": "Copy another environment of this instance into this one",
"description": "Destination-driven: the path names the destination and the body names\nthe source (D22). No `transfer:*` claim, because this reaches no scope\nthe caller could not already read or write one entry at a time. It asks\nfor the read half across the source scope and the write half across the\ndestination; `replace` mode adds `entries:delete` and\n`collections:delete` there. Touches no media.\n",
"operationId": "copyScope",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScopeCopyRequest"
}
}
}
},
"responses": {
"200": {
"description": "What the copy did, or would do under `dry_run`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportResult"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
}
}
}
},
"/api/projects/{project}/environments/{env}/package": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
},
{
"$ref": "#/components/parameters/Env"
}
],
"post": {
"tags": [
"Transfer"
],
"summary": "Stream a transfer package of the named collections and entries",
"description": "The source half of a transfer between instances (D108). The package is\nthe export tree cut to exactly what the body names: the selected\nentries, their collections' schemas, and with `media: referenced` the\nactive assets those entries use, their bytes and the folder records\nabove them. Variables, keys, folder moves and everything else stay\nbehind. Its manifest is `package.json`, so `POST /api/import` refuses\na package.\n\nEvery name and id is checked before the response begins: a malformed\none is a 400, one this environment lacks is a 404. An entry deleted\nwhile the package streams truncates it.\n\nClaims: `transfer:export`, plus `collections:{project}/{env}/{name}:schema:read`\nand `:entries:read` for each named collection.\n",
"operationId": "transferPackage",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TransferPackageRequest"
}
}
}
},
"responses": {
"200": {
"description": "The package.",
"headers": {
"Content-Disposition": {
"schema": {
"type": "string"
},
"description": "attachment; filename=\"silo-package.tar.gz\""
}
},
"content": {
"application/gzip": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
}
},
"/api/projects/{project}/environments/{env}/transfers": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
},
{
"$ref": "#/components/parameters/Env"
}
],
"post": {
"tags": [
"Transfer"
],
"summary": "Prepare a transfer from another instance into this environment",
"description": "The destination half of a transfer between instances (D109). This\nserver asks the source for a package (`POST …/package`, D108) of\nexactly the selection, unpacks it under the `[transfer]` size limits\n(D85), and verifies it exactly: every requested collection and entry\nand nothing else, media rows that are exactly what the packaged\nentries reference, a file for each row and nothing more, each file\nwith its row's size and sha256, and only plain files and folders. A\npackage that fails any check is deleted and the answer is a 400.\n\nThen it plans the package against this environment (D110), reading\nonly. Each entry is decided as an import decides it: in `merge`, the\nlater `updated_at` wins, then the higher `rev`, then the higher\ninstance id, unless `prefer` says which side wins; in `replace`, every\npackaged entry is written and every other row of the collection is\nremoved. Each entry to be written is checked against the schema the\ntransfer leaves in place: the package's where it writes the schema,\nthis environment's where it does not. An entry that fails is\n`rejected` and will not be written. A schema change that the\ncollection's entries freeze (D70) fails the preparation with a 409.\nThe plan records what it read, so Apply can refuse if any of it has\nchanged since.\nMedia is planned with it (D111): an asset this server lacks is added,\none it already holds under the same id is never changed (`unchanged`\nwhen it is the same file and details, `skipped` with the reason when\nnot), folders are matched by path, and every reference a written entry\nholds that will not resolve here is listed.\n\nThe verified package is kept for review for 60 minutes. At most 4\ntransfers may be preparing, prepared or applying at once; a fifth is\na 429. The source key is used for the pull and never stored.\n\nEverything that can be refused is refused before the source is\ncontacted: the claims, a missing environment, a storage adapter that\ncannot commit many writes as one (fs: 409 `atomic_commit_unsupported`),\nand a full server. With `Accept: application/x-ndjson` the answer is a\nprogress stream whose first line names the transfer, so it can be\ncancelled while the pull runs.\n\nThis server fetches from the URL in the body. Any key holding\n`transfer:copy` can make it reach any address it can route to.\n\nClaims: `transfer:copy`; `collections:{project}/{env}/{name}:create`,\n`:schema:update`, `:entries:create` and `:entries:update` for each\nselected collection; `:delete` and `:entries:delete` as well in\n`replace` mode; and `media:create` unless `media` is `none`.\n",
"operationId": "prepareTransfer",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreparedTransferRequest"
}
}
}
},
"responses": {
"201": {
"description": "The prepared transfer, with its review and the first page of its plan, or, when `Accept: application/x-ndjson` asked for one, a progress stream whose last line carries it (status 200).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreparedTransfer"
}
},
"application/x-ndjson": {
"schema": {
"$ref": "#/components/schemas/PreparedTransferProgressLine"
}
}
}
},
"400": {
"description": "The body is malformed, or the source refused, could not be reached, is not silo 1.6.0 or later, or sent a package that failed verification or whose entries cannot be checked against the schemas here. The message says which.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"description": "`atomic_commit_unsupported` on the fs storage adapter; `transfer_cancelled` when a cancel stopped the pull; `conflict` when a merged collection holds entries and the package would change what validates them (D70).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
},
"429": {
"description": "`too_many_transfers`: 4 transfers are already preparing, prepared or applying. Apply or cancel one, or wait for one to expire.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/projects/{project}/environments/{env}/transfers/{id}": {
"parameters": [
{
"$ref": "#/components/parameters/Project"
},
{
"$ref": "#/components/parameters/Env"
},
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The transfer's id, as prepare answered it."
}
],
"get": {
"tags": [
"Transfer"
],
"summary": "Read a prepared transfer and one page of its plan",
"description": "The state, the expiry, the package summary, the review and, while the\npackage is held, one page of the plan in a stable order: each\ncollection's packaged entries by id, then, in `replace`, the rows it\nremoves, then the packaged media assets and folders (D111). An expired,\ncancelled, stale or applied transfer keeps its record for 24 hours,\nwithout its package or plan.\n\nWhat only this environment holds, the id of a row that `replace`\nremoves and the `rev` and time of a row already here, is shown only to\na key holding `collections:{project}/{env}/{name}:schema:read` and\n`:entries:read` on that collection, as the env copy's preview does.\n\nAnswers only the key that prepared the transfer, and only under the\nenvironment it was prepared for; any other caller gets a 404.\n\nClaims: `transfer:copy`.\n",
"operationId": "getTransfer",
"parameters": [
{
"name": "detail_offset",
"in": "query",
"schema": {
"type": "integer",
"minimum": 0,
"default": 0
}
},
{
"name": "detail_limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 25
},
"description": "At most 100."
}
],
"responses": {
"200": {
"description": "The transfer.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreparedTransfer"
}
}
}
},
"400": {
"$ref": "#/components/responses/ValidationFailed"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
},
"delete": {
"tags": [
"Transfer"
],
"summary": "Cancel a prepared transfer",
"description": "Stops a pull that is still running, or drops a prepared package. The\nrecord stays as `cancelled`. A transfer that has already ended is\nanswered as it is.\n\nAnswers only the key that prepared the transfer, and only under the\nenvironment it was prepared for; any other caller gets a 404.\n\nClaims: `transfer:copy`.\n",
"operationId": "cancelTransfer",
"responses": {
"200": {
"description": "The transfer, cancelled.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreparedTransfer"
}
}
}
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"description": "`transfer_in_progress` while it is applying, `transfer_applied` once it has.",
"content": {
"application/json": {
"schema": {