Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
2181 lines (2074 loc) · 82.3 KB
/
Copy pathopenapi.yaml
File metadata and controls
2181 lines (2074 loc) · 82.3 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: vault-sync
version: 1.0.0-draft
summary: Zero-knowledge sync protocol for MorphGate vaults.
description: |
Any server implementing this contract is a valid sync backend for the MorphGate client.
The server only ever stores ciphertext (envelopes) and wrapped keys; it never
receives the master password or any plaintext item data.
Cryptographic formats are defined in docs/sync-crypto-spec.md ("Wire formats").
Conventions:
- All binary values (envelopes, wrapped keys, salts, public keys) are base64url without padding.
- IDs are ULIDs generated by the client unless stated otherwise.
- `rev` is a server-assigned, strictly increasing integer per vault.
- Billing is out of scope. Hosted servers may return 402 on push; self-hosted servers need not.
- Sharing (organizations, members, shared vaults) is optional, behind `features.sharing`;
its crypto (certificates, grant signatures, fingerprints) is in the spec's "Sharing" section.
- Blobs (encrypted session logs and attachments) are optional, behind `features.blobs`; their
format is in the spec's "Blobs and session logs" section.
- Single sign-on per organization is optional, behind `features.sso`. It is layered on top of
the AuthKey proof, never instead of it: vault keys still come from the master password.
- SCIM provisioning is outside vault-sync/v1. Servers may offer SCIM 2.0 (users only) at
`/scim/v2/{org_id}`, with a bearer token per organization.
license:
name: CC0-1.0
identifier: CC0-1.0
servers:
- url: https://morphgate.com/v1
description: Hosted
- url: https://{host}/v1
description: Self-hosted
variables:
host:
default: localhost:8443
security:
- bearer: []
tags:
- name: discovery
- name: auth
- name: account
- name: devices
- name: vaults
- name: sync
- name: organizations
- name: blobs
- name: sso
paths:
/.well-known/vault-sync:
servers:
- url: https://{host}
variables:
host:
default: morphgate.com
get:
tags: [discovery]
operationId: getCapabilities
summary: Server capabilities and limits.
security: []
responses:
'200':
description: Capabilities
content:
application/json:
schema: { $ref: '#/components/schemas/Capabilities' }
/auth/prelogin:
post:
tags: [auth]
operationId: prelogin
summary: Return KDF parameters for an email.
description: |
MUST return deterministic, plausible parameters for unknown emails
(e.g. salt = HMAC(server_secret, email)) to prevent account enumeration.
Clients MUST refuse parameters below the floors in KdfParams.
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email]
properties:
email: { type: string, format: email }
responses:
'200':
description: KDF parameters
content:
application/json:
schema: { $ref: '#/components/schemas/KdfParams' }
'429': { $ref: '#/components/responses/RateLimited' }
/auth/register/start:
post:
tags: [auth]
operationId: startRegistration
summary: Mail a sign-up code. Only if capabilities.features.email_verification.
description: |
Mails a 6-digit code to `email`, which `register` then needs as `email_code`. An address
that already has an account gets a notice instead of a code; the response is the same
either way, so it reveals nothing. Servers SHOULD send at most one mail per address per
minute, let a code live 15 minutes and spend it after 5 wrong guesses.
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email]
properties:
email: { type: string, format: email }
responses:
'202': { description: Accepted; a mail may be on its way. }
'403': { $ref: '#/components/responses/Error' }
'429': { $ref: '#/components/responses/RateLimited' }
'501':
description: The server doesn't verify addresses (`not_supported`).
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
/auth/register:
post:
tags: [auth]
operationId: register
summary: Create an account. Only if capabilities.features.registration_open.
security: []
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/RegisterRequest' }
responses:
'201':
description: Account created; returns session tokens.
content:
application/json:
schema: { $ref: '#/components/schemas/Session' }
'400':
description: |
Malformed, or with `email_verification` a missing (`email_code_required`) or wrong or
expired (`invalid_code`) code.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
'403': { $ref: '#/components/responses/Error' }
'409': { $ref: '#/components/responses/Error' }
/auth/login:
post:
tags: [auth]
operationId: login
summary: Prove knowledge of AuthKey and obtain tokens plus wrapped account keys.
security: []
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/LoginRequest' }
responses:
'200':
description: Logged in
content:
application/json:
schema: { $ref: '#/components/schemas/Session' }
'401':
description: Wrong AuthKey (`invalid_credentials`), or wrong TOTP code (`invalid_totp`).
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
'428':
description: Second factor required (`totp_required`); retry with `totp`.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
'429': { $ref: '#/components/responses/RateLimited' }
/auth/refresh:
post:
tags: [auth]
operationId: refresh
summary: Rotate refresh token. Reuse of an old refresh token MUST revoke the device.
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [refresh_token]
properties:
refresh_token: { type: string }
responses:
'200':
description: New tokens
content:
application/json:
schema: { $ref: '#/components/schemas/Tokens' }
'401':
description: >-
`device_revoked`: the account signed this device out (`DELETE /devices/{device_id}`,
from another device or an account page). Servers MUST answer it for as long as the
device's refresh token would have lasted, so a device that was offline learns it too;
the client then forgets what it keeps from the account (its vaults, keys, settings).
`account_deleted`: the account was deleted (from another of its devices or a website);
servers MUST answer it for its refresh tokens' remaining lifetime (still
`device_revoked` for a device signed out before the deletion). The client turns
sync off, keeps its personal vault (now the only copy) and drops team vaults. Any other
401 (`invalid_credentials`: an expired session, a reused token, a changed password)
only means "sign in again": the client keeps its data.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
/auth/logout:
post:
tags: [auth]
operationId: logout
summary: Revoke the current device's tokens.
responses:
'204': { description: Logged out }
/account:
get:
tags: [account]
operationId: getAccount
responses:
'200':
description: Account
content:
application/json:
schema: { $ref: '#/components/schemas/Account' }
delete:
tags: [account]
operationId: deleteAccount
summary: Permanently delete account, vaults and items.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [auth_key]
properties:
auth_key: { $ref: '#/components/schemas/B64' }
responses:
'204': { description: "Deleted, with every token." }
'401': { $ref: '#/components/responses/Error' }
'409':
description: '`sole_owner`: the account owns an organization; transfer or delete it first.'
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
'503':
description: '`billing_unavailable` (hosted): the subscription could not be cancelled, so nothing was deleted; try again later.'
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
/account/terms:
put:
tags: [account]
operationId: acceptTerms
summary: Accept the current terms (capabilities.features.terms), after they changed.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [accepted_terms]
properties:
accepted_terms: { type: string, description: The version from capabilities.features.terms. }
responses:
'204': { description: Accepted }
'400': { $ref: '#/components/responses/Error' }
'404': { description: The server asks no terms to be accepted. }
/account/export:
get:
tags: [account]
operationId: exportAccount
summary: Everything the server keeps about the account, readable (access and portability).
description: |
Format `morphgate-account-export/1`: `format`, `generated_at`, `about`, then the sections
the server has: `account` (id, email, created_at, two_step_verification, public_keys),
`devices` (signed-out ones included, with `signed_out`), `entitlement`, `organizations`
(memberships), `vaults` (`personal` with item and blob counts; `organization` with
`permission`), `invites` (unexpired, to the account's address), `sso_sessions`,
`activity` (organization events by or about the account) and server-specific ones
(`provisioning`, `billing`). Null values are left out. Never secrets, hashes, wrapped
keys or vault contents: those are end-to-end encrypted, so apps export them. Requires a
full session. Optional: servers without it answer 404.
responses:
'200':
description: The export
content:
application/json:
schema:
type: object
required: [format, generated_at, account]
properties:
format: { type: string, enum: [morphgate-account-export/1] }
generated_at: { type: string, format: date-time }
about: { type: string }
account: { type: object }
devices: { type: array, items: { type: object } }
entitlement: { type: object }
organizations: { type: array, items: { type: object } }
vaults: { type: object }
invites: { type: array, items: { type: object } }
sso_sessions: { type: array, items: { type: object } }
activity: { type: array, items: { type: object } }
additionalProperties: true
'404': { description: The server has no export }
/account/keys:
put:
tags: [account]
operationId: rotateAccountCredentials
summary: Change password or recovery key by re-wrapping account private keys.
description: |
Items are not re-encrypted. When the password changes (`new_auth_key` differs from the
current one), the server MUST end the sessions of every other device; they sign in again
with the new password. Replacing only the recovery key keeps everyone signed in.
With a `recover`-scoped token (see POST /account/recover) no `current_auth_key` is
needed, every session ends, and the token itself is spent.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/RotateCredentialsRequest' }
responses:
'204': { description: Updated }
'401': { $ref: '#/components/responses/Error' }
/account/recover:
post:
tags: [account]
operationId: recover
summary: Fetch account keys wrapped under the recovery key.
description: |
Returns `wrapped_private_keys_rk`. The client unwraps with RK, then calls
PUT /account/keys with the returned access token instead of `current_auth_key`.
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email, recovery_proof]
properties:
email: { type: string, format: email }
recovery_proof:
$ref: '#/components/schemas/B64'
description: HKDF(RK, "morphgate/v1/recovery-auth"); server stores only its hash.
responses:
'200':
description: |
Recovery material and a short-lived access token (no refresh token) that is only
accepted, once, by PUT /account/keys.
content:
application/json:
schema:
type: object
required: [wrapped_private_keys_rk, access_token]
properties:
wrapped_private_keys_rk: { $ref: '#/components/schemas/B64' }
access_token: { type: string }
'401': { $ref: '#/components/responses/Error' }
/account/email/start:
post:
tags: [account]
operationId: startEmailChange
summary: Mail a code to a new address. Only if capabilities.features.email_verification.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [new_email]
properties:
new_email: { type: string, format: email }
responses:
'202': { description: Accepted; a mail may be on its way. }
'409': { $ref: '#/components/responses/Error' }
'501': { $ref: '#/components/responses/Error' }
/account/email:
put:
tags: [account]
operationId: changeEmail
summary: Move the account to the new address with its code.
description: |
The KDF salt is stored per account, not derived from the address, so nothing is
re-derived. Servers SHOULD notify the old address.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [new_email, code, auth_key]
properties:
new_email: { type: string, format: email }
code: { type: string, pattern: '^[0-9]{6}$' }
auth_key: { $ref: '#/components/schemas/B64' }
responses:
'204': { description: Changed }
'400': { $ref: '#/components/responses/Error' }
'401': { $ref: '#/components/responses/Error' }
'409': { $ref: '#/components/responses/Error' }
/account/totp/start:
post:
tags: [account]
operationId: startTotp
summary: A new authenticator secret. Only if capabilities.features.totp.
description: |
Nothing changes until POST /account/totp/enable gets a code from it. While TOTP is on,
this answers `409 totp_enabled`: turn it off first.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [auth_key]
properties:
auth_key: { $ref: '#/components/schemas/B64' }
responses:
'200':
description: The pending secret
content:
application/json:
schema: { $ref: '#/components/schemas/TotpSetup' }
'401': { $ref: '#/components/responses/Error' }
'409': { $ref: '#/components/responses/Error' }
/account/totp/enable:
post:
tags: [account]
operationId: enableTotp
summary: Turn TOTP on with a code from the pending secret.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [code]
properties:
code: { type: string, pattern: '^[0-9]{6}$' }
responses:
'204': { description: Two-step verification is on }
'400': { $ref: '#/components/responses/Error' }
/account/totp:
delete:
tags: [account]
operationId: disableTotp
summary: Turn TOTP off.
description: |
Each code is accepted once, here and at login. Account recovery (POST /account/recover
followed by PUT /account/keys) also turns TOTP off: the recovery key is the way back from
losing the authenticator.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [auth_key, code]
properties:
auth_key: { $ref: '#/components/schemas/B64' }
code: { type: string, pattern: '^[0-9]{6}$' }
responses:
'204': { description: Two-step verification is off }
'401': { $ref: '#/components/responses/Error' }
/account/web-session:
post:
tags: [account]
operationId: webSession
summary: Hosted only (capabilities.features.billing.web_session). A link into the account portal.
description: |
A single-use URL, valid for `expires_in` seconds, that signs the account in to the
server's web portal (plan, billing, devices). The portal never handles vault data.
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
next:
type: string
description: >-
The portal page the link lands on: `/account` (the default),
`/account/two-step`, `/account/team/{org_id}` or `/account/team/{org_id}/{tab}`
(e.g. `billing`). Anything else is `400 bad_request`.
examples: [/account/team/01J0000000000000000000000/billing]
responses:
'200':
description: The link
content:
application/json:
schema: { $ref: '#/components/schemas/WebSession' }
/devices:
get:
tags: [devices]
operationId: listDevices
responses:
'200':
description: Devices
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/Device' }
/devices/{device_id}:
parameters:
- $ref: '#/components/parameters/DeviceId'
patch:
tags: [devices]
operationId: updateDevice
summary: >-
A device says what it is now: its name, platform and client version, which it otherwise
sends only when it signs in (an app update, a renamed computer). Only the calling device's
own: another's is `403 not_permitted`. Clients send it once in a while (once a run, say)
and ignore a `404` or `405` from servers without it.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/DeviceUpdate' }
responses:
'204': { description: Updated }
'400': { $ref: '#/components/responses/Error' }
'403': { $ref: '#/components/responses/Error' }
'404': { $ref: '#/components/responses/Error' }
delete:
tags: [devices]
operationId: revokeDevice
summary: >-
Sign a device out. Its next refresh gets `401 device_revoked` (see `/auth/refresh`), and
it clears itself.
responses:
'204': { description: Revoked }
'404': { $ref: '#/components/responses/Error' }
/vaults:
get:
tags: [vaults]
operationId: listVaults
responses:
'200':
description: Vaults the account can access, with wrapped vault keys.
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/Vault' }
post:
tags: [vaults]
operationId: createVault
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [id, wrapped_vault_key, key_id]
properties:
id: { $ref: '#/components/schemas/Ulid' }
key_id: { $ref: '#/components/schemas/B64' }
wrapped_vault_key:
$ref: '#/components/schemas/B64'
description: Sealed box of VK to the account X25519 public key.
meta:
$ref: '#/components/schemas/B64'
description: |
Vault name and settings: an envelope with item id `vault-meta`, sealed with the
vault key and signed by the creator.
org_id:
$ref: '#/components/schemas/Ulid'
description: |
`sharing`: create the vault in this organization. Owners and admins may; members
when the `members_can_create_vaults` policy allows (they then get `manage`).
keys:
type: array
description: |
`sharing`, organization vaults: the key sealed to every owner and admin, the caller
included (its entry repeats `wrapped_vault_key`). Missing anyone: 400 incomplete_keys.
items: { $ref: '#/components/schemas/SealedFor' }
responses:
'201':
description: Created
content:
application/json:
schema: { $ref: '#/components/schemas/Vault' }
'409': { $ref: '#/components/responses/Error' }
/vaults/{vault_id}:
parameters:
- $ref: '#/components/parameters/VaultId'
get:
tags: [vaults]
operationId: getVault
responses:
'200':
description: Vault
content:
application/json:
schema: { $ref: '#/components/schemas/Vault' }
'404': { $ref: '#/components/responses/Error' }
delete:
tags: [vaults]
operationId: deleteVault
description: The owner of a personal vault; an organization's owners and admins for its vaults.
responses:
'204': { description: Deleted }
'403': { $ref: '#/components/responses/Error' }
/vaults/{vault_id}/changes:
parameters:
- $ref: '#/components/parameters/VaultId'
get:
tags: [sync]
operationId: pullChanges
summary: Items (including tombstones) with rev > since, ordered by rev ascending.
parameters:
- name: since
in: query
required: true
schema: { type: integer, minimum: 0 }
- name: limit
in: query
schema: { type: integer, minimum: 1, maximum: 1000, default: 500 }
responses:
'200':
description: Page of changes
content:
application/json:
schema: { $ref: '#/components/schemas/ChangePage' }
'410':
description: |
`since` predates the oldest retained tombstone. Client MUST discard
local sync state and resync from `since=0`.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
post:
tags: [sync]
operationId: pushChanges
summary: Push a batch. Each item is accepted or rejected independently.
description: |
An item is accepted iff it does not exist on the server or its current
`rev` equals the submitted `base_rev`. Accepted items receive a new `rev`.
Rejected items return the server's current copy for client-side merge.
On `sharing` servers the server records the caller as the revision's `author_id`, and
rejects an item whose envelope header names a key generation other than the vault's
current one (`stale_key`): the client re-encrypts it and pushes again. A member with `read`
access gets 403 not_permitted for the whole request.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PushRequest' }
responses:
'200':
description: Per-item results. Partial acceptance is normal.
content:
application/json:
schema: { $ref: '#/components/schemas/PushResponse' }
'402':
description: >-
Hosted only. The plan doesn't cover pushing here; pulls remain allowed. An organization
vault follows the organization's plan, not the member's.
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
properties:
reason: { enum: [trial_ended, lapsed] }
billing_url: { type: string, format: uri }
'403': { $ref: '#/components/responses/Error' }
'413': { $ref: '#/components/responses/Error' }
/vaults/{vault_id}/members:
parameters:
- $ref: '#/components/parameters/VaultId'
get:
tags: [organizations]
operationId: listVaultMembers
description: Who can open the vault. Needs `manage`.
responses:
'200':
description: Owners and admins (implicit), then granted members.
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/VaultMember' }
/vaults/{vault_id}/members/{account_id}:
parameters:
- $ref: '#/components/parameters/VaultId'
- $ref: '#/components/parameters/AccountId'
put:
tags: [organizations]
operationId: setVaultMember
description: |
Grants a confirmed member access to an organization vault, or changes their permission.
Granting needs `keys`: the current key generation (and any older ones still in use) sealed
to the member. Needs `manage`.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/SetVaultMember' }
responses:
'200':
description: The member's access
content:
application/json:
schema: { $ref: '#/components/schemas/VaultMember' }
'400': { $ref: '#/components/responses/Error' }
'403': { $ref: '#/components/responses/Error' }
delete:
tags: [organizations]
operationId: revokeVaultMember
description: Revokes a granted member. The vault gets `rotation_due`. Needs `manage`.
responses:
'204': { description: Revoked }
/vaults/{vault_id}/keys:
parameters:
- $ref: '#/components/parameters/VaultId'
post:
tags: [organizations]
operationId: rotateVaultKey
description: |
Switches the vault to a new key generation, sealed to every account with access (owners and
admins included). `previous_key_id` must be the current generation (else 409 conflict); a
missing account is 400 incomplete_rotation. Clears `rotation_due`. Older generations stay in
the ring while items use them (`items_on_old_keys`). Needs `manage`.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/RotateVaultKey' }
responses:
'200':
description: The vault after the switch
content:
application/json:
schema: { $ref: '#/components/schemas/Vault' }
'400': { $ref: '#/components/responses/Error' }
'409': { $ref: '#/components/responses/Error' }
/orgs:
get:
tags: [organizations]
operationId: listOrgs
responses:
'200':
description: Organizations the caller belongs to (accepted or confirmed).
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/OrgMembership' }
post:
tags: [organizations]
operationId: createOrg
description: The caller becomes the owner and the root of the ownership chain.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [id, name]
properties:
id: { $ref: '#/components/schemas/Ulid' }
name: { type: string, minLength: 1, maxLength: 100 }
responses:
'201':
description: Created
content:
application/json:
schema: { $ref: '#/components/schemas/Org' }
'402':
description: >-
Hosted only. `team_limit`: the caller owns `limit` organizations without a paid plan
(trials count as unpaid); one needs a plan, or has to go, before another.
`billing_url` is the account page.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
'409': { $ref: '#/components/responses/Error' }
/orgs/{org_id}:
parameters:
- $ref: '#/components/parameters/OrgId'
get:
tags: [organizations]
operationId: getOrg
description: Any member. Non-members get 404.
responses:
'200':
description: Organization
content:
application/json:
schema: { $ref: '#/components/schemas/Org' }
'404': { $ref: '#/components/responses/Error' }
patch:
tags: [organizations]
operationId: updateOrg
description: Name and policies. Owners and admins.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string }
policies: { $ref: '#/components/schemas/Policies' }
responses:
'200':
description: Organization
content:
application/json:
schema: { $ref: '#/components/schemas/Org' }
'501':
description: A policy the server can't enforce (e.g. require_totp without TOTP).
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
delete:
tags: [organizations]
operationId: deleteOrg
description: The owner, proving their AuthKey. Deletes the organization's vaults and items.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [auth_key]
properties:
auth_key: { $ref: '#/components/schemas/B64' }
responses:
'204': { description: Deleted }
'401': { $ref: '#/components/responses/Error' }
/orgs/{org_id}/members:
parameters:
- $ref: '#/components/parameters/OrgId'
get:
tags: [organizations]
operationId: listMembers
description: Confirmed members only. Apps check every member's keys against the certificate chain.
responses:
'200':
description: Members
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/Member' }
'403': { $ref: '#/components/responses/Error' }
/orgs/{org_id}/members/{account_id}:
parameters:
- $ref: '#/components/parameters/OrgId'
- $ref: '#/components/parameters/AccountId'
patch:
tags: [organizations]
operationId: updateMember
description: |
The owner changes a confirmed member's role. Promoting to admin needs `admin_cert` and every
organization vault key the member lacks (400 incomplete_keys). Demoting takes away the keys
of vaults not granted to them and sets `rotation_due` there.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/UpdateMember' }
responses:
'200':
description: Member
content:
application/json:
schema: { $ref: '#/components/schemas/Member' }
delete:
tags: [organizations]
operationId: removeMember
description: |
Admins remove members, the owner removes admins, and anyone may remove themselves (leave).
The owner can't leave (409 sole_owner). Every vault the member could open gets `rotation_due`.
responses:
'204': { description: Removed }
'409': { $ref: '#/components/responses/Error' }
/orgs/{org_id}/members/{account_id}/confirm:
parameters:
- $ref: '#/components/parameters/OrgId'
- $ref: '#/components/parameters/AccountId'
post:
tags: [organizations]
operationId: confirmMember
description: |
An admin confirms an accepted member: a member certificate over their keys (after comparing
fingerprints out of band) and the keys of the vaults the invite granted, sealed to them.
Confirming an admin is the owner's: it also needs `admin_cert` and every organization vault key.
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/ConfirmMember' }
responses:
'200':
description: Member
content:
application/json:
schema: { $ref: '#/components/schemas/Member' }
'400': { $ref: '#/components/responses/Error' }
'402':
description: Hosted only. The confirm would pass the seat count (seats_exceeded).
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
/orgs/{org_id}/invites:
parameters:
- $ref: '#/components/parameters/OrgId'
get:
tags: [organizations]
operationId: listInvites
description: Pending invites (tokens are never shown again). Owners and admins.
responses:
'200':
description: Invites
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/Invite' }
post:
tags: [organizations]
operationId: createInvite
description: |
Owners and admins invite members; only the owner invites admins. Invites are single use,
bound to the address, valid 7 days; a new invite to the same address replaces the old one.
Policy `allowed_email_domains` applies (403 not_permitted).
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/CreateInvite' }
responses:
'201':
description: Created; `token` is present when the server doesn't mail invites.
content:
application/json:
schema: { $ref: '#/components/schemas/Invite' }
'403': { $ref: '#/components/responses/Error' }
'409': { $ref: '#/components/responses/Error' }
/orgs/{org_id}/invites/{invite_id}:
parameters:
- $ref: '#/components/parameters/OrgId'
- $ref: '#/components/parameters/InviteId'
delete:
tags: [organizations]
operationId: cancelInvite
responses:
'204': { description: Cancelled }
/orgs/{org_id}/transfer:
parameters:
- $ref: '#/components/parameters/OrgId'
post: