{{ message }}
Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
3049 lines (3042 loc) · 111 KB
/
Copy pathopenapi.yaml
File metadata and controls
3049 lines (3042 loc) · 111 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.0.3
info:
title: uMailServer API
description: |
REST API of uMailServer (source of truth: `internal/api/server.go`, `internal/api/admin.go`).
**Base path.** Everything JSON lives under `/api/v1` on the main HTTP listener (`http.port`, default 443; the process itself speaks plain HTTP on that listener and TLS is expected to be provided in front of it, cookies are marked `Secure` when the request arrived over TLS). A second, admin-only listener (default `127.0.0.1:8443`, `admin.*`) serves the admin SPA plus a subset of the admin routes (domains, accounts, queue, rate limits, metrics, stats, vacations list, push stats) and `/health`.
**Authentication.** `POST /api/v1/auth/login` returns a JWT (HS256) in the body (non-browser clients) and sets an HttpOnly `jwt` cookie. Send it as `Authorization: Bearer <token>` or let the browser send the cookie (cookie wins when both are present). Public endpoints are marked `security: []`. Admin-only operations are labelled and answer 403 `{"error":"admin access required"}` to ordinary users. The admin listener accepts Bearer tokens only (no cookie) and reports auth failures as `{"error","message","code"}`.
**Request rules (all unsafe methods under `/api/v1/` except login, logout and `/api/v1/account/*`).** `Content-Type: application/json` is mandatory even for body-less DELETE/POST (400 `Content-Type must be application/json`). Cookie-authenticated requests with an Origin/Referer from another host are 403. JSON bodies reject unknown fields (400). Default body cap 4 MB (26 MB for mail send/draft); oversize bodies surface as 400, not 413.
**Errors.** `{"error": "<message>"}` with the HTTP status. Methods other than those documented answer 405 with an `Allow` header; HEAD is answered for GET routes.
**Rate limiting.** Per client IP, 1-minute window, `security.rate_limit.http_requests_per_minute` (default 120, 0 disables), applied to the protected `/api/v1/` routes and logout; exceeded -> 429 with `Retry-After: 60`. Login has its own failure lockouts (see the operation). `/health`, `/health/ready`, `/api/v1/events`, `/mcp`, `/metrics`, `/api/v1/account/*` and login are outside this limiter.
**Lists** (`/domains`, `/accounts`, `/aliases`) return plain JSON arrays with the unpaginated size in the `X-Total-Count` header; `limit` 1-1000 (default 100) and `offset` are validated (400).
**Message ids.** The REST message id is the blob content hash. When byte-identical copies exist (same mail in two folders or twice in one), list results report each copy as `<hash>_<uid>_<base64url(mailbox)>`, which addresses exactly one (folder, uid) entry for delete/flags/move/get; a hash held once keeps its plain id.
version: 1.0.0
contact: {name: uMailServer, url: 'https://github.com/umailserver/umailserver/issues'}
license: {name: MIT, url: 'https://opensource.org/licenses/MIT'}
servers:
- url: https://{host}
description: Main listener (http.port, default 443)
variables:
host: {default: mail.example.com}
- {url: 'http://127.0.0.1:8443', description: 'Admin-only listener (admin.bind/admin.port); admin routes only, Bearer
auth only'}
security:
- bearerAuth: []
- cookieAuth: []
tags:
- {name: Auth, description: 'Login, logout, token refresh'}
- {name: Account, description: Self-service for the authenticated account}
- {name: Admin, description: 'Administrator operations (domains, accounts, aliases, queue, limits, keys)'}
- {name: Cluster, description: HA cluster operations (admin)}
- {name: Mail, description: Webmail endpoints operating on the caller's own mailboxes}
- {name: Threads, description: Conversation threads}
- {name: Settings, description: 'Vacation, filters, push'}
- {name: Realtime, description: SSE and MCP}
- {name: Operations, description: Health and metrics}
- {name: Client configuration, description: Mail client autoconfiguration}
paths:
/api/v1/auth/login:
post:
tags: [Auth]
summary: Log in
operationId: login
description: Rate limited per IP (failure lockout, default 5 failures, 5 min doubling to 60 min; `security.max_login_attempts`)
and per (IP, account) (5 failures / 5 min). Failed TOTP attempts per account lock after 5 failures for 5
minutes. Sets the `jwt` cookie.
security: []
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/LoginRequest'}
responses:
'200':
description: Logged in
content:
application/json:
schema: {$ref: '#/components/schemas/TokenResponse'}
headers:
Set-Cookie:
description: jwt cookie (HttpOnly, SameSite=Strict)
schema: {type: string}
'400': {$ref: '#/components/responses/BadRequest'}
'401':
description: '`invalid credentials` (bad password, unknown or disabled account), `TOTP code required`,
`invalid TOTP code` or `TOTP code already used`'
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/auth/logout:
post:
tags: [Auth]
summary: Log out
operationId: logout
description: Revokes the presented token(s) and clears the cookie. `DELETE` is accepted as an alias of POST.
responses:
'200':
description: Logged out
content:
application/json:
schema: {$ref: '#/components/schemas/Message'}
'401': {$ref: '#/components/responses/Unauthorized'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
delete:
tags: [Auth]
summary: Log out (DELETE alias)
responses:
'200':
description: Logged out
content:
application/json:
schema: {$ref: '#/components/schemas/Message'}
'401': {$ref: '#/components/responses/Unauthorized'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/auth/refresh:
post:
tags: [Auth]
summary: Refresh token
operationId: refresh
description: 'Revokes the presented token(s) and issues a new one (also replaces the cookie for cookie sessions).
The request must still carry `Content-Type: application/json` (CSRF layer), body is ignored.'
responses:
'200':
description: New token
content:
application/json:
schema: {$ref: '#/components/schemas/TokenResponse'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/account/password:
post:
tags: [Account]
summary: Change own password
operationId: changeOwnPassword
description: Shares the per-(IP, account) failed-password budget with login (5 failures / 5 min). Revokes
all existing sessions of the account and returns a replacement (cookie, plus `token`/`expiresIn` for non-browser
clients).
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
current_password: {type: string}
new_password: {type: string, minLength: 8, maxLength: 128}
required: [current_password, new_password]
responses:
'200':
description: Changed
content:
application/json:
schema:
type: object
properties:
message: {type: string}
token: {type: string}
expiresIn: {type: integer}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403':
description: '`current password is incorrect`'
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/account/totp:
get:
tags: [Account]
summary: Own TOTP state
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
enabled: {type: boolean}
pending_setup: {type: boolean}
'401': {$ref: '#/components/responses/Unauthorized'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
/api/v1/account/totp/setup:
post:
tags: [Account]
summary: Start TOTP enrolment
description: Generates and stores (encrypted) a new secret; not active until verified.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
uri: {type: string, description: 'otpauth:// URI'}
'401': {$ref: '#/components/responses/Unauthorized'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
/api/v1/account/totp/verify:
post:
tags: [Account]
summary: Confirm TOTP enrolment
description: Enables TOTP; each time step can be used once. Revokes sessions and returns a replacement session
like a password change.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
code: {type: string}
required: [code]
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
enabled: {type: boolean}
token: {type: string}
expiresIn: {type: integer}
'400': {$ref: '#/components/responses/BadRequest'}
'401':
description: '`invalid TOTP code` or `TOTP code already used`'
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/account/totp/disable:
post:
tags: [Account]
summary: Disable TOTP
description: When TOTP is enabled the body must carry a current valid `code` (400 `current TOTP code required
to disable 2FA`, 401 invalid/used, 429 after 5 failures).
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
code: {type: string}
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
enabled: {type: boolean}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/account/forwarding:
get:
tags: [Account]
summary: Get own forwarding
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
forward_to: {type: string}
keep_copy: {type: boolean}
forwarding_on: {type: boolean}
'401': {$ref: '#/components/responses/Unauthorized'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
put:
tags: [Account]
summary: Set own forwarding
description: Empty `forward_to` disables forwarding and clears keep_copy. `forward_copy` is accepted as a
legacy alias of `keep_copy`.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
forward_to: {type: string}
keep_copy: {type: boolean}
responses:
'200':
description: Stored configuration
content:
application/json:
schema:
type: object
properties:
forward_to: {type: string}
keep_copy: {type: boolean}
forwarding_on: {type: boolean}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
/api/v1/domains:
get:
tags: [Admin]
summary: List domains
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Sorted by name.'
parameters:
- name: limit
in: query
required: false
schema: {type: integer, minimum: 1, maximum: 1000, default: 100}
- name: offset
in: query
required: false
schema: {type: integer, minimum: 0, default: 0}
responses:
'200':
description: Plain array
content:
application/json:
schema:
type: array
items: {$ref: '#/components/schemas/Domain'}
headers:
X-Total-Count:
description: Unpaginated number of items
schema: {type: integer}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
post:
tags: [Admin]
summary: Create domain
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Generates a 2048-bit DKIM
key (selector `default`).'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/DomainCreate'}
responses:
'201':
description: Created
content:
application/json:
schema: {$ref: '#/components/schemas/Domain'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/domains/{domain}:
parameters:
- name: domain
in: path
required: true
schema: {type: string}
get:
tags: [Admin]
summary: Get domain
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/Domain'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
put:
tags: [Admin]
summary: Update domain
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Deactivating a domain that
still has accounts is a 409.'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/DomainUpdate'}
responses:
'200':
description: Updated
content:
application/json:
schema: {$ref: '#/components/schemas/Domain'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
delete:
tags: [Admin]
summary: Delete domain
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Cascades to the domain''s
accounts and mailbox data. 409 when it holds the last active administrator; 500 if mailbox purge partly
failed (retry DELETE per account).'
responses:
'204': {description: Deleted}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/accounts:
get:
tags: [Admin]
summary: List accounts
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Sorted by address.'
parameters:
- name: domain
in: query
required: false
schema: {type: string}
description: Restrict to a domain
- name: limit
in: query
required: false
schema: {type: integer, minimum: 1, maximum: 1000, default: 100}
- name: offset
in: query
required: false
schema: {type: integer, minimum: 0, default: 0}
responses:
'200':
description: Plain array
content:
application/json:
schema:
type: array
items: {$ref: '#/components/schemas/Account'}
headers:
X-Total-Count:
description: Unpaginated number of items
schema: {type: integer}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
post:
tags: [Admin]
summary: Create account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). 400 for a bad address, weak
password or unknown domain; 409 for a duplicate account or when the domain''s `max_accounts` is reached.'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/AccountCreate'}
responses:
'201':
description: Created
content:
application/json:
schema: {$ref: '#/components/schemas/Account'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/accounts/{email}:
parameters:
- name: email
in: path
required: true
schema: {type: string}
description: Account address (case-insensitive)
get:
tags: [Admin]
summary: Get account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/Account'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
put:
tags: [Admin]
summary: Update account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Partial update. 409 `cannot
demote or deactivate the last active administrator`. A password reset, disable or demotion revokes the account''s
sessions.'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/AccountUpdate'}
responses:
'200':
description: Updated
content:
application/json:
schema: {$ref: '#/components/schemas/Account'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
delete:
tags: [Admin]
summary: Delete account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Removes the account and
purges its mailbox data. 409 `cannot delete the last active administrator` (also when an admin deletes their
own account). Admin callers need no password. The handler also contains a branch for a non-admin deleting
their own account with `{"password": ...}` in the body (400 `password is required...`, 403 `password is
incorrect`, 429 shared password budget), but the route is wrapped in the admin guard, so non-admins always
receive 403 before reaching it.'
requestBody:
required: false
content:
application/json:
schema: {$ref: '#/components/schemas/PasswordDelete'}
description: Only consulted for non-admin callers (unreachable through the router).
responses:
'204': {description: Deleted}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'429': {$ref: '#/components/responses/TooManyRequests'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/accounts/{email}/totp/setup:
parameters:
- name: email
in: path
required: true
schema: {type: string}
description: Account address (case-insensitive)
post:
tags: [Admin]
summary: Start TOTP enrolment for an account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). An admin may act on non-admin
accounts only; acting on an admin account (other than your own) is 403.'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
uri: {type: string}
enabled: {type: boolean}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/accounts/{email}/totp/verify:
parameters:
- name: email
in: path
required: true
schema: {type: string}
description: Account address (case-insensitive)
post:
tags: [Admin]
summary: Confirm TOTP enrolment for an account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). An admin may act on non-admin
accounts only; acting on an admin account (other than your own) is 403.'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
code: {type: string}
required: [code]
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
uri: {type: string}
enabled: {type: boolean}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/accounts/{email}/totp/disable:
parameters:
- name: email
in: path
required: true
schema: {type: string}
description: Account address (case-insensitive)
post:
tags: [Admin]
summary: Disable TOTP for an account
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). An admin may act on non-admin
accounts only; acting on an admin account (other than your own) is 403.'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
uri: {type: string}
enabled: {type: boolean}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'429': {$ref: '#/components/responses/TooManyRequests'}
/api/v1/aliases:
get:
tags: [Admin]
summary: List aliases
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
parameters:
- name: limit
in: query
required: false
schema: {type: integer, minimum: 1, maximum: 1000, default: 100}
- name: offset
in: query
required: false
schema: {type: integer, minimum: 0, default: 0}
responses:
'200':
description: Plain array
content:
application/json:
schema:
type: array
items: {$ref: '#/components/schemas/Alias'}
headers:
X-Total-Count:
description: Unpaginated number of items
schema: {type: integer}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
post:
tags: [Admin]
summary: Create alias
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). 400 for unknown alias domain
or unknown target account; 409 for a duplicate or an alias that clashes with a mailbox.'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/AliasCreate'}
responses:
'201':
description: Created
content:
application/json:
schema: {$ref: '#/components/schemas/Alias'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
/api/v1/aliases/{alias}:
parameters:
- name: alias
in: path
required: true
schema: {type: string}
description: Alias address
get:
tags: [Admin]
summary: Get alias
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/Alias'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
put:
tags: [Admin]
summary: Update alias
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/AliasUpdate'}
responses:
'200':
description: Updated
content:
application/json:
schema: {$ref: '#/components/schemas/Alias'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
delete:
tags: [Admin]
summary: Delete alias
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'204': {description: Deleted}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/admin/queue:
get:
tags: [Admin]
summary: List queue entries
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Oldest first; delivered
and bounced entries are omitted. Equivalent to `/api/v1/queue`.'
parameters:
- name: status
in: query
required: false
schema:
type: string
enum: [pending, sending, failed]
- name: limit
in: query
required: false
schema: {type: integer, minimum: 1, maximum: 1000, default: 100}
- name: offset
in: query
required: false
schema: {type: integer, minimum: 0, default: 0}
responses:
'200':
description: Plain array
content:
application/json:
schema:
type: array
items: {$ref: '#/components/schemas/QueueEntry'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/admin/queue/{id}:
parameters:
- name: id
in: path
required: true
schema: {type: string}
description: Queue entry id
get:
tags: [Admin]
summary: Get queue entry
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/QueueEntry'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
post:
tags: [Admin]
summary: Retry queue entry now
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). POST on the entry itself
(there is no /retry suffix). 409 when the entry is sending, delivered or bounced.'
responses:
'200':
description: Re-queued
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum: [retrying]
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'500': {$ref: '#/components/responses/ServerError'}
delete:
tags: [Admin]
summary: Drop queue entry
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'204': {description: Dropped}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/queue:
get:
tags: [Admin]
summary: List queue entries
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Oldest first; delivered
and bounced entries are omitted. Equivalent to `/api/v1/admin/queue`.'
parameters:
- name: status
in: query
required: false
schema:
type: string
enum: [pending, sending, failed]
- name: limit
in: query
required: false
schema: {type: integer, minimum: 1, maximum: 1000, default: 100}
- name: offset
in: query
required: false
schema: {type: integer, minimum: 0, default: 0}
responses:
'200':
description: Plain array
content:
application/json:
schema:
type: array
items: {$ref: '#/components/schemas/QueueEntry'}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/queue/{id}:
parameters:
- name: id
in: path
required: true
schema: {type: string}
description: Queue entry id
get:
tags: [Admin]
summary: Get queue entry
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/QueueEntry'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
post:
tags: [Admin]
summary: Retry queue entry now
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). POST on the entry itself
(there is no /retry suffix). 409 when the entry is sending, delivered or bounced.'
responses:
'200':
description: Re-queued
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum: [retrying]
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'409': {$ref: '#/components/responses/Conflict'}
'500': {$ref: '#/components/responses/ServerError'}
delete:
tags: [Admin]
summary: Drop queue entry
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'204': {description: Dropped}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/stats:
get:
tags: [Admin]
summary: Server statistics
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/Stats'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'500': {$ref: '#/components/responses/ServerError'}
/api/v1/metrics:
get:
tags: [Admin]
summary: Metrics snapshot (JSON)
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise). Counters grouped by subsystem
(smtp, imap, delivery, spam, api, caches, ...) plus a `queue` object with pending/sending/failed/delivered/bounced/total.
Free-form.'
responses:
'200':
description: OK
content:
application/json:
schema: {type: object, additionalProperties: true}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
/api/v1/admin/ratelimits/config:
get:
tags: [Admin]
summary: Get mail rate-limit config
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema: {$ref: '#/components/schemas/RateLimitConfig'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'503': {$ref: '#/components/responses/Unavailable'}
put:
tags: [Admin]
summary: Replace mail rate-limit config
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/RateLimitConfig'}
responses:
'200':
description: Applied
content:
application/json:
schema:
type: object
properties:
status: {type: string}
message: {type: string}
'400': {$ref: '#/components/responses/BadRequest'}
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'405': {$ref: '#/components/responses/MethodNotAllowed'}
'503': {$ref: '#/components/responses/Unavailable'}
/api/v1/admin/ratelimits/ip/{ip}:
parameters:
- name: ip
in: path
required: true
schema: {type: string}
get:
tags: [Admin]
summary: Rate-limit counters for an IP
description: '**Admin only** (403 `{"error":"admin access required"}` otherwise).'
responses:
'200':
description: OK
content:
application/json:
schema:
You can’t perform that action at this time.
