@myronsi/messenger-api 2.1.0-alpha.2 → 2.1.0-alpha.20.next.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/openapi.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: Messenger API
4
- version: 2.1.0-alpha.2
4
+ version: 2.1.0-alpha.20
5
5
  summary: REST contract of the Messenger backend (v2).
6
6
  description: |
7
7
  Contract for the Go backend. The WebSocket protocol is described in `websocket/` and
@@ -54,10 +54,14 @@ tags:
54
54
  description: Edit, delete and forward messages
55
55
  - name: attachments
56
56
  description: File and voice uploads
57
+ - name: stickers
58
+ description: Sticker packs, the sticker panel and recently sent stickers
57
59
  - name: requests
58
60
  description: Approval requests (direct messages and group invites)
59
61
  - name: websocket
60
62
  description: Realtime connection (see `websocket.md`)
63
+ - name: calls
64
+ description: Audio calls (see `docs/calls.md` and `docs/calls-e2ee.md`)
61
65
 
62
66
  paths:
63
67
  /meta:
@@ -223,7 +227,7 @@ paths:
223
227
  application/json:
224
228
  schema: { $ref: "#/components/schemas/RegisterResponse" }
225
229
  "400": { $ref: "#/components/responses/BadRequest" }
226
- "401": { $ref: "#/components/responses/Unauthorized" }
230
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
227
231
  "403": { $ref: "#/components/responses/Forbidden" }
228
232
  "409": { $ref: "#/components/responses/Conflict" }
229
233
  "422": { $ref: "#/components/responses/ValidationFailed" }
@@ -266,7 +270,7 @@ paths:
266
270
  application/json:
267
271
  schema: { $ref: "#/components/schemas/RecoveryKeyResult" }
268
272
  "400": { $ref: "#/components/responses/BadRequest" }
269
- "401": { $ref: "#/components/responses/Unauthorized" }
273
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
270
274
  "403": { $ref: "#/components/responses/Forbidden" }
271
275
  "409": { $ref: "#/components/responses/Conflict" }
272
276
  "422": { $ref: "#/components/responses/ValidationFailed" }
@@ -293,56 +297,6 @@ paths:
293
297
  "422": { $ref: "#/components/responses/ValidationFailed" }
294
298
  "426": { $ref: "#/components/responses/ClientOutdated" }
295
299
  "429": { $ref: "#/components/responses/TooManyRequests" }
296
- /auth/recover:
297
- parameters:
298
- - $ref: "#/components/parameters/ClientVersion"
299
- - $ref: "#/components/parameters/ClientApiVersion"
300
- post:
301
- tags: [auth]
302
- operationId: startRecovery
303
- summary: Start account recovery (temporary)
304
- description: Temporary port of the Python recovery flow; it is redesigned in release 1.1.
305
- x-temporary: true
306
- security: []
307
- requestBody:
308
- required: true
309
- content:
310
- application/json:
311
- schema: { $ref: "#/components/schemas/RecoveryRequest" }
312
- responses:
313
- "426": { $ref: "#/components/responses/ClientOutdated" }
314
- "200":
315
- description: Recovery token
316
- content:
317
- application/json:
318
- schema: { $ref: "#/components/schemas/RecoveryResponse" }
319
- "400": { $ref: "#/components/responses/BadRequest" }
320
- "404": { $ref: "#/components/responses/NotFound" }
321
- "429": { $ref: "#/components/responses/TooManyRequests" }
322
- /auth/reset-password:
323
- parameters:
324
- - $ref: "#/components/parameters/ClientVersion"
325
- - $ref: "#/components/parameters/ClientApiVersion"
326
- post:
327
- tags: [auth]
328
- operationId: resetPassword
329
- summary: Set a new password with a recovery token (temporary)
330
- x-temporary: true
331
- security: []
332
- requestBody:
333
- required: true
334
- content:
335
- application/json:
336
- schema: { $ref: "#/components/schemas/ResetPasswordRequest" }
337
- responses:
338
- "426": { $ref: "#/components/responses/ClientOutdated" }
339
- "204":
340
- description: Password changed; all sessions are revoked
341
- "400": { $ref: "#/components/responses/BadRequest" }
342
- "401": { $ref: "#/components/responses/Unauthorized" }
343
- "422": { $ref: "#/components/responses/ValidationFailed" }
344
- "429": { $ref: "#/components/responses/TooManyRequests" }
345
-
346
300
  /ws/ticket:
347
301
  parameters:
348
302
  - $ref: "#/components/parameters/ClientVersion"
@@ -444,6 +398,33 @@ paths:
444
398
  "400": { $ref: "#/components/responses/BadRequest" }
445
399
  "401": { $ref: "#/components/responses/Unauthorized" }
446
400
  "404": { $ref: "#/components/responses/NotFound" }
401
+ /me/avatars/{avatar_id}:
402
+ parameters:
403
+ - $ref: "#/components/parameters/ClientVersion"
404
+ - $ref: "#/components/parameters/ClientApiVersion"
405
+ - name: avatar_id
406
+ in: path
407
+ required: true
408
+ description: "`id` of an `AvatarVersion` of the caller."
409
+ schema: { $ref: "#/components/schemas/Id" }
410
+ delete:
411
+ tags: [me]
412
+ operationId: deleteMyAvatar
413
+ summary: Delete one of your avatars
414
+ description: |
415
+ Removes the avatar from your history. When it is the current one, the newest remaining avatar becomes
416
+ current again; without one you get the default avatar. The image is deleted from storage once nothing
417
+ uses it any more.
418
+ responses:
419
+ "426": { $ref: "#/components/responses/ClientOutdated" }
420
+ "200":
421
+ description: Updated user
422
+ content:
423
+ application/json:
424
+ schema: { $ref: "#/components/schemas/Me" }
425
+ "400": { $ref: "#/components/responses/BadRequest" }
426
+ "401": { $ref: "#/components/responses/Unauthorized" }
427
+ "404": { $ref: "#/components/responses/NotFound" }
447
428
  /me/password:
448
429
  parameters:
449
430
  - $ref: "#/components/parameters/ClientVersion"
@@ -610,7 +591,7 @@ paths:
610
591
  tags: [me]
611
592
  operationId: disableTwoFactor
612
593
  summary: Turn two-factor off
613
- description: "A wrong password or code answers `403` (`invalid_credentials` or `invalid_two_factor_code`); `409` when two-factor is off."
594
+ description: "A wrong password or code answers `403` (`invalid_credentials` or `invalid_two_factor_code`); a correct password without `code` answers `401` with `code: two_factor_required`; `409` when two-factor is off."
614
595
  requestBody:
615
596
  required: true
616
597
  content:
@@ -621,7 +602,7 @@ paths:
621
602
  "204":
622
603
  description: Two-factor authentication disabled
623
604
  "400": { $ref: "#/components/responses/BadRequest" }
624
- "401": { $ref: "#/components/responses/Unauthorized" }
605
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
625
606
  "403": { $ref: "#/components/responses/Forbidden" }
626
607
  "409": { $ref: "#/components/responses/Conflict" }
627
608
  "429": { $ref: "#/components/responses/TooManyRequests" }
@@ -670,7 +651,7 @@ paths:
670
651
  required: true
671
652
  schema:
672
653
  type: string
673
- enum: [avatar_visibility, profile_visibility, presence_visibility, group_invites]
654
+ enum: [avatar_visibility, profile_visibility, presence_visibility, group_invites, direct_messages, search_visibility]
674
655
  - name: effect
675
656
  in: path
676
657
  required: true
@@ -780,6 +761,10 @@ paths:
780
761
  tags: [users]
781
762
  operationId: getUserByUsername
782
763
  summary: Profile by username
764
+ description: |
765
+ Like `GET /users/{user_id}`: a user whose `search_visibility` hides them from the current user (`nobody`
766
+ without an `allow` exception, or a `deny` exception) is `404` unless the two share a chat. Lookups are
767
+ rate limited per user.
783
768
  parameters:
784
769
  - name: username
785
770
  in: path
@@ -795,6 +780,7 @@ paths:
795
780
  schema: { $ref: "#/components/schemas/User" }
796
781
  "401": { $ref: "#/components/responses/Unauthorized" }
797
782
  "404": { $ref: "#/components/responses/NotFound" }
783
+ "429": { $ref: "#/components/responses/TooManyRequests" }
798
784
  /users/{user_id}:
799
785
  parameters:
800
786
  - $ref: "#/components/parameters/ClientVersion"
@@ -804,6 +790,10 @@ paths:
804
790
  tags: [users]
805
791
  operationId: getUser
806
792
  summary: Profile by ID
793
+ description: |
794
+ A user whose `search_visibility` hides them from the current user (`nobody` without an `allow` exception,
795
+ or a `deny` exception) is `404` unless the two share a chat. Your own profile is always found. Lookups are
796
+ rate limited per user.
807
797
  responses:
808
798
  "426": { $ref: "#/components/responses/ClientOutdated" }
809
799
  "400": { $ref: "#/components/responses/BadRequest" }
@@ -814,6 +804,7 @@ paths:
814
804
  schema: { $ref: "#/components/schemas/User" }
815
805
  "401": { $ref: "#/components/responses/Unauthorized" }
816
806
  "404": { $ref: "#/components/responses/NotFound" }
807
+ "429": { $ref: "#/components/responses/TooManyRequests" }
817
808
  /users/{user_id}/avatar:
818
809
  parameters:
819
810
  - $ref: "#/components/parameters/ClientVersion"
@@ -825,12 +816,18 @@ paths:
825
816
  summary: Current avatar image
826
817
  description: |
827
818
  Respects the avatar visibility of the user; falls back to the default avatar. With `version`, an
828
- earlier avatar of the history (`AvatarVersion.url`).
819
+ earlier avatar of the history (`AvatarVersion.url`). `avatar_url` carries `rev`, the revision of the
820
+ current avatar: while it matches, the answer may be cached for a year (`immutable`), because a new
821
+ avatar gets a new `rev` and so a new URL.
829
822
  parameters:
830
823
  - name: version
831
824
  in: query
832
825
  description: "`id` of an `AvatarVersion` of this user."
833
826
  schema: { $ref: "#/components/schemas/Id" }
827
+ - name: rev
828
+ in: query
829
+ description: Revision of the current avatar, as given in `avatar_url`.
830
+ schema: { type: string, maxLength: 64 }
834
831
  responses:
835
832
  "426": { $ref: "#/components/responses/ClientOutdated" }
836
833
  "400": { $ref: "#/components/responses/BadRequest" }
@@ -888,6 +885,9 @@ paths:
888
885
  tags: [users]
889
886
  operationId: setContactName
890
887
  summary: Set your own display name for a user
888
+ description: |
889
+ Follows the rules of `GET /users/{user_id}`: a user whose `search_visibility` hides them from you is `404`
890
+ unless the two of you share a chat, and the calls count against the same per-user limit.
891
891
  requestBody:
892
892
  required: true
893
893
  content:
@@ -904,6 +904,7 @@ paths:
904
904
  "401": { $ref: "#/components/responses/Unauthorized" }
905
905
  "404": { $ref: "#/components/responses/NotFound" }
906
906
  "422": { $ref: "#/components/responses/ValidationFailed" }
907
+ "429": { $ref: "#/components/responses/TooManyRequests" }
907
908
  delete:
908
909
  tags: [users]
909
910
  operationId: removeContactName
@@ -964,10 +965,13 @@ paths:
964
965
  parameters:
965
966
  - name: variant
966
967
  in: query
967
- description: "`thumbnail`: a JPEG of at most 320 px (images only; `thumbnail_url` of the attachment)."
968
+ description: |
969
+ `thumbnail`: a JPEG of at most 320 px (images only; `thumbnail_url` of the attachment).
970
+ `display`: a JPEG of at most 1600 px for viewing a large still image (`display_url` of the attachment);
971
+ the original for any other attachment.
968
972
  schema:
969
973
  type: string
970
- enum: [thumbnail]
974
+ enum: [thumbnail, display]
971
975
  responses:
972
976
  "426": { $ref: "#/components/responses/ClientOutdated" }
973
977
  "400": { $ref: "#/components/responses/BadRequest" }
@@ -1251,7 +1255,7 @@ paths:
1251
1255
  get:
1252
1256
  tags: [chats]
1253
1257
  operationId: listChatMedia
1254
- summary: Photos or audio of a chat
1258
+ summary: Photos, videos or audio of a chat
1255
1259
  description: Replaces `GET /messages/photos/{chat_id}` and `GET /messages/audios/{chat_id}`.
1256
1260
  parameters:
1257
1261
  - name: kind
@@ -1281,7 +1285,8 @@ paths:
1281
1285
  patch:
1282
1286
  tags: [messages]
1283
1287
  operationId: editMessage
1284
- summary: Edit your text message
1288
+ summary: Edit your text message or the caption of your file
1289
+ description: An empty `content` removes the caption of a file message; a text message needs at least one character.
1285
1290
  requestBody:
1286
1291
  required: true
1287
1292
  content:
@@ -1305,7 +1310,8 @@ paths:
1305
1310
  summary: Delete a message
1306
1311
  description: |
1307
1312
  `scope=me` hides it for the current user only (any message). `scope=everyone` removes
1308
- it for all participants (own messages, and any message for group admins).
1313
+ it for all participants: own messages, any message of a direct chat (either side), and any message
1314
+ for group owners, admins and moderators.
1309
1315
  parameters:
1310
1316
  - name: scope
1311
1317
  in: query
@@ -1355,6 +1361,70 @@ paths:
1355
1361
  "404": { $ref: "#/components/responses/NotFound" }
1356
1362
  "422": { $ref: "#/components/responses/ValidationFailed" }
1357
1363
  "429": { $ref: "#/components/responses/TooManyRequests" }
1364
+ /chats/{chat_id}/messages/forward:
1365
+ parameters:
1366
+ - $ref: "#/components/parameters/ClientVersion"
1367
+ - $ref: "#/components/parameters/ClientApiVersion"
1368
+ - $ref: "#/components/parameters/ChatId"
1369
+ post:
1370
+ tags: [messages]
1371
+ operationId: forwardMessages
1372
+ summary: Forward several messages of a chat to other chats
1373
+ description: |
1374
+ Copies up to 20 messages of the chat, oldest first, into every target chat, at most 20 copies in all. Every
1375
+ copy counts against the sender's message rate. Every message and target is checked before anything is
1376
+ written, so a refused one forwards nothing.
1377
+ requestBody:
1378
+ required: true
1379
+ content:
1380
+ application/json:
1381
+ schema: { $ref: "#/components/schemas/ForwardMessagesRequest" }
1382
+ responses:
1383
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1384
+ "400": { $ref: "#/components/responses/BadRequest" }
1385
+ "201":
1386
+ description: The new messages, per target chat oldest first
1387
+ content:
1388
+ application/json:
1389
+ schema:
1390
+ type: object
1391
+ required: [items]
1392
+ properties:
1393
+ items:
1394
+ type: array
1395
+ items: { $ref: "#/components/schemas/Message" }
1396
+ "401": { $ref: "#/components/responses/Unauthorized" }
1397
+ "403": { $ref: "#/components/responses/Forbidden" }
1398
+ "404": { $ref: "#/components/responses/NotFound" }
1399
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1400
+ "429": { $ref: "#/components/responses/TooManyRequests" }
1401
+ /chats/{chat_id}/messages/delete:
1402
+ parameters:
1403
+ - $ref: "#/components/parameters/ClientVersion"
1404
+ - $ref: "#/components/parameters/ClientApiVersion"
1405
+ - $ref: "#/components/parameters/ChatId"
1406
+ post:
1407
+ tags: [messages]
1408
+ operationId: deleteMessages
1409
+ summary: Delete several messages of a chat
1410
+ description: |
1411
+ Deletes up to 100 messages of the chat with the rules of `DELETE /messages/{message_id}`. Every message
1412
+ is checked first: when one may not be deleted, none is. With `scope` everyone, messages that are already
1413
+ deleted for everyone count as done, so a retry after a partial failure finishes the rest.
1414
+ requestBody:
1415
+ required: true
1416
+ content:
1417
+ application/json:
1418
+ schema: { $ref: "#/components/schemas/DeleteMessagesRequest" }
1419
+ responses:
1420
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1421
+ "400": { $ref: "#/components/responses/BadRequest" }
1422
+ "204":
1423
+ description: Deleted
1424
+ "401": { $ref: "#/components/responses/Unauthorized" }
1425
+ "403": { $ref: "#/components/responses/Forbidden" }
1426
+ "404": { $ref: "#/components/responses/NotFound" }
1427
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1358
1428
 
1359
1429
  # -------------------------------------------------------------- search
1360
1430
  /search/messages:
@@ -1388,7 +1458,7 @@ paths:
1388
1458
  in: query
1389
1459
  schema:
1390
1460
  type: string
1391
- enum: [text, file, voice]
1461
+ enum: [text, file, voice, sticker]
1392
1462
  - name: from
1393
1463
  in: query
1394
1464
  description: Messages created at or after this time
@@ -1714,6 +1784,180 @@ paths:
1714
1784
  "401": { $ref: "#/components/responses/Unauthorized" }
1715
1785
  "404": { $ref: "#/components/responses/NotFound" }
1716
1786
  "409": { $ref: "#/components/responses/Conflict" }
1787
+ /groups/{chat_id}/role-log:
1788
+ parameters:
1789
+ - $ref: "#/components/parameters/ClientVersion"
1790
+ - $ref: "#/components/parameters/ClientApiVersion"
1791
+ - $ref: "#/components/parameters/ChatId"
1792
+ get:
1793
+ tags: [groups]
1794
+ operationId: getGroupRoleLog
1795
+ summary: Role changes of the group's members
1796
+ description: Who made whom an admin or a member, or transferred ownership, and when. Members only.
1797
+ responses:
1798
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1799
+ "400": { $ref: "#/components/responses/BadRequest" }
1800
+ "200":
1801
+ description: Role changes
1802
+ content:
1803
+ application/json:
1804
+ schema: { $ref: "#/components/schemas/GroupRoleLog" }
1805
+ "401": { $ref: "#/components/responses/Unauthorized" }
1806
+ "404": { $ref: "#/components/responses/NotFound" }
1807
+ /stickers/packs:
1808
+ parameters:
1809
+ - $ref: "#/components/parameters/ClientVersion"
1810
+ - $ref: "#/components/parameters/ClientApiVersion"
1811
+ get:
1812
+ tags: [stickers]
1813
+ operationId: listStickerPacks
1814
+ summary: The user's sticker packs
1815
+ description: |
1816
+ The packs of the sticker panel: packs the user added, most recently added first, then the built-in default
1817
+ packs the user has not removed. Each pack lists its stickers in order. At most 200 packs.
1818
+ responses:
1819
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1820
+ "400": { $ref: "#/components/responses/BadRequest" }
1821
+ "200":
1822
+ description: The packs
1823
+ content:
1824
+ application/json:
1825
+ schema: { $ref: "#/components/schemas/StickerPackList" }
1826
+ "401": { $ref: "#/components/responses/Unauthorized" }
1827
+ /stickers/packs/{pack_id}:
1828
+ parameters:
1829
+ - $ref: "#/components/parameters/ClientVersion"
1830
+ - $ref: "#/components/parameters/ClientApiVersion"
1831
+ - $ref: "#/components/parameters/StickerPackId"
1832
+ get:
1833
+ tags: [stickers]
1834
+ operationId: getStickerPack
1835
+ summary: A sticker pack
1836
+ description: |
1837
+ Any pack that is not deleted, whether the user has it or not, for example to preview the pack of a sticker
1838
+ someone sent. `is_installed` tells whether it is in the user's panel.
1839
+ responses:
1840
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1841
+ "400": { $ref: "#/components/responses/BadRequest" }
1842
+ "200":
1843
+ description: The pack
1844
+ content:
1845
+ application/json:
1846
+ schema: { $ref: "#/components/schemas/StickerPack" }
1847
+ "401": { $ref: "#/components/responses/Unauthorized" }
1848
+ "404": { $ref: "#/components/responses/NotFound" }
1849
+ /stickers/packs/{pack_id}/installation:
1850
+ parameters:
1851
+ - $ref: "#/components/parameters/ClientVersion"
1852
+ - $ref: "#/components/parameters/ClientApiVersion"
1853
+ - $ref: "#/components/parameters/StickerPackId"
1854
+ put:
1855
+ tags: [stickers]
1856
+ operationId: addStickerPack
1857
+ summary: Add a sticker pack to the user's panel
1858
+ description: Adding a pack the user has moves it to the top of the panel.
1859
+ responses:
1860
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1861
+ "400": { $ref: "#/components/responses/BadRequest" }
1862
+ "204":
1863
+ description: Added
1864
+ "401": { $ref: "#/components/responses/Unauthorized" }
1865
+ "404": { $ref: "#/components/responses/NotFound" }
1866
+ delete:
1867
+ tags: [stickers]
1868
+ operationId: removeStickerPack
1869
+ summary: Remove a sticker pack from the user's panel
1870
+ description: |
1871
+ Built-in default packs can be removed too and come back only when added again. Stickers already sent from
1872
+ the pack keep showing in chats.
1873
+ responses:
1874
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1875
+ "400": { $ref: "#/components/responses/BadRequest" }
1876
+ "204":
1877
+ description: Removed
1878
+ "401": { $ref: "#/components/responses/Unauthorized" }
1879
+ "404": { $ref: "#/components/responses/NotFound" }
1880
+ /stickers/recent:
1881
+ parameters:
1882
+ - $ref: "#/components/parameters/ClientVersion"
1883
+ - $ref: "#/components/parameters/ClientApiVersion"
1884
+ get:
1885
+ tags: [stickers]
1886
+ operationId: listRecentStickers
1887
+ summary: Stickers the user sent recently
1888
+ description: The last 20 different stickers the user sent, newest first, on every device of the user.
1889
+ responses:
1890
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1891
+ "400": { $ref: "#/components/responses/BadRequest" }
1892
+ "200":
1893
+ description: The stickers
1894
+ content:
1895
+ application/json:
1896
+ schema: { $ref: "#/components/schemas/StickerList" }
1897
+ "401": { $ref: "#/components/responses/Unauthorized" }
1898
+ /link-preview:
1899
+ parameters:
1900
+ - $ref: "#/components/parameters/ClientVersion"
1901
+ - $ref: "#/components/parameters/ClientApiVersion"
1902
+ get:
1903
+ tags: [messages]
1904
+ operationId: getLinkPreview
1905
+ summary: Preview of a web page for a link in a message
1906
+ description: |
1907
+ Reads the page's Open Graph data (`og:title`, `og:description`, `og:site_name`, `og:image`; falling back to
1908
+ `<title>`, `description` and `twitter:image`). Only public `http`/`https` addresses on ports 80 and 443
1909
+ are fetched. Answers are cached for a day (a page without a preview for an hour). `image.url` points to
1910
+ `GET /link-preview/image`, so clients never load third-party images directly. `404` when the page has
1911
+ no preview or cannot be fetched.
1912
+ parameters:
1913
+ - name: url
1914
+ in: query
1915
+ required: true
1916
+ schema: { type: string, minLength: 1, maxLength: 2048 }
1917
+ responses:
1918
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1919
+ "400": { $ref: "#/components/responses/BadRequest" }
1920
+ "200":
1921
+ description: The preview
1922
+ content:
1923
+ application/json:
1924
+ schema: { $ref: "#/components/schemas/LinkPreview" }
1925
+ "401": { $ref: "#/components/responses/Unauthorized" }
1926
+ "404": { $ref: "#/components/responses/NotFound" }
1927
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1928
+ "429": { $ref: "#/components/responses/TooManyRequests" }
1929
+ /link-preview/image:
1930
+ parameters:
1931
+ - $ref: "#/components/parameters/ClientVersion"
1932
+ - $ref: "#/components/parameters/ClientApiVersion"
1933
+ get:
1934
+ tags: [messages]
1935
+ operationId: getLinkPreviewImage
1936
+ summary: The image of a link preview, through the server
1937
+ description: |
1938
+ Use the `image.url` of a link preview as it is; `sig` proves the server made it. PNG, JPEG, GIF and WebP
1939
+ up to 5 MB, sent with `X-Content-Type-Options: nosniff`.
1940
+ parameters:
1941
+ - name: url
1942
+ in: query
1943
+ required: true
1944
+ schema: { type: string, minLength: 1, maxLength: 2048 }
1945
+ - name: sig
1946
+ in: query
1947
+ required: true
1948
+ schema: { type: string, minLength: 1, maxLength: 64 }
1949
+ responses:
1950
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1951
+ "400": { $ref: "#/components/responses/BadRequest" }
1952
+ "200":
1953
+ description: Image content
1954
+ content:
1955
+ image/*:
1956
+ schema: { type: string, format: binary }
1957
+ "401": { $ref: "#/components/responses/Unauthorized" }
1958
+ "403": { $ref: "#/components/responses/Forbidden" }
1959
+ "404": { $ref: "#/components/responses/NotFound" }
1960
+ "429": { $ref: "#/components/responses/TooManyRequests" }
1717
1961
 
1718
1962
  /me/notifications:
1719
1963
  get:
@@ -1758,35 +2002,87 @@ paths:
1758
2002
  $ref: "#/components/responses/NotFound"
1759
2003
  "409":
1760
2004
  $ref: "#/components/responses/Conflict"
1761
- /me/notification-devices:
1762
- post:
1763
- tags:
1764
- - me
1765
- operationId: registerNotificationDevice
1766
- summary: Register a push destination for the current session
1767
- requestBody:
2005
+ /notifications/avatar/{token}:
2006
+ parameters:
2007
+ - name: token
2008
+ in: path
1768
2009
  required: true
1769
- content:
1770
- application/json:
1771
- schema:
1772
- $ref: "#/components/schemas/NotificationDeviceRequest"
2010
+ description: "`avatar_token` of a push notification."
2011
+ schema: { type: string, maxLength: 256 }
2012
+ get:
2013
+ tags: [me]
2014
+ operationId: getNotificationAvatar
2015
+ summary: Sender avatar for a push notification
2016
+ description: |
2017
+ For the service worker, which has no session: the token in the push payload names the recipient
2018
+ and the sender and expires after an hour. Follows the sender's avatar visibility for the recipient.
2019
+ security: []
1773
2020
  responses:
1774
2021
  "200":
1775
- description: Notification settings or registered device
2022
+ description: Image
1776
2023
  content:
1777
- application/json:
1778
- schema:
1779
- $ref: "#/components/schemas/NotificationDeviceRegistered"
1780
- "400":
1781
- $ref: "#/components/responses/BadRequest"
1782
- "401":
1783
- $ref: "#/components/responses/Unauthorized"
1784
- "404":
1785
- $ref: "#/components/responses/NotFound"
1786
- "409":
1787
- $ref: "#/components/responses/Conflict"
1788
- /me/notification-devices/{id}:
1789
- parameters:
2024
+ image/*:
2025
+ schema: { type: string, format: binary }
2026
+ "206":
2027
+ description: The requested byte range (`Range` header)
2028
+ content:
2029
+ image/*:
2030
+ schema: { type: string, format: binary }
2031
+ "302":
2032
+ description: Redirect to a short-lived signed storage URL (with `MEDIA_SIGNED_URLS`)
2033
+ "304":
2034
+ description: Not modified (`If-None-Match` with the `ETag` of an earlier answer)
2035
+ "416":
2036
+ description: The requested range is outside the file
2037
+ "404": { $ref: "#/components/responses/NotFound" }
2038
+ /notifications/read/{token}:
2039
+ parameters:
2040
+ - name: token
2041
+ in: path
2042
+ required: true
2043
+ description: "`read_token` of a push notification."
2044
+ schema: { type: string, maxLength: 256 }
2045
+ post:
2046
+ tags: [me]
2047
+ operationId: markNotificationRead
2048
+ summary: Mark a chat read from a push notification
2049
+ description: |
2050
+ For the notification's "Mark as read" action: marks the chat read up to the notified message for
2051
+ the recipient the token names. The token expires after seven days.
2052
+ security: []
2053
+ responses:
2054
+ "204":
2055
+ description: Marked as read
2056
+ "404": { $ref: "#/components/responses/NotFound" }
2057
+ /me/notification-devices:
2058
+ post:
2059
+ tags:
2060
+ - me
2061
+ operationId: registerNotificationDevice
2062
+ summary: Register a push destination for the current session
2063
+ requestBody:
2064
+ required: true
2065
+ content:
2066
+ application/json:
2067
+ schema:
2068
+ $ref: "#/components/schemas/NotificationDeviceRequest"
2069
+ responses:
2070
+ "200":
2071
+ description: Notification settings or registered device
2072
+ content:
2073
+ application/json:
2074
+ schema:
2075
+ $ref: "#/components/schemas/NotificationDeviceRegistered"
2076
+ "400":
2077
+ $ref: "#/components/responses/BadRequest"
2078
+ "401":
2079
+ $ref: "#/components/responses/Unauthorized"
2080
+ "404":
2081
+ $ref: "#/components/responses/NotFound"
2082
+ "409":
2083
+ $ref: "#/components/responses/Conflict"
2084
+ /me/notification-devices/{id}:
2085
+ parameters:
1790
2086
  - name: id
1791
2087
  in: path
1792
2088
  required: true
@@ -1800,74 +2096,1758 @@ paths:
1800
2096
  summary: Unregister a push destination for the current session
1801
2097
  responses:
1802
2098
  "204":
1803
- description: Saved
1804
- "400":
1805
- $ref: "#/components/responses/BadRequest"
1806
- "401":
1807
- $ref: "#/components/responses/Unauthorized"
1808
- "404":
1809
- $ref: "#/components/responses/NotFound"
1810
- "409":
1811
- $ref: "#/components/responses/Conflict"
1812
- /chats/{chatId}/notification-mute:
2099
+ description: Saved
2100
+ "400":
2101
+ $ref: "#/components/responses/BadRequest"
2102
+ "401":
2103
+ $ref: "#/components/responses/Unauthorized"
2104
+ "404":
2105
+ $ref: "#/components/responses/NotFound"
2106
+ "409":
2107
+ $ref: "#/components/responses/Conflict"
2108
+ /chats/{chatId}/notification-mute:
2109
+ parameters:
2110
+ - name: chatId
2111
+ in: path
2112
+ required: true
2113
+ schema:
2114
+ $ref: "#/components/schemas/Id"
2115
+ put:
2116
+ tags:
2117
+ - me
2118
+ operationId: setNotificationMute
2119
+ summary: Mute or unmute a chat
2120
+ requestBody:
2121
+ required: true
2122
+ content:
2123
+ application/json:
2124
+ schema:
2125
+ $ref: "#/components/schemas/NotificationMuteRequest"
2126
+ responses:
2127
+ "204":
2128
+ description: Saved
2129
+ "400":
2130
+ $ref: "#/components/responses/BadRequest"
2131
+ "401":
2132
+ $ref: "#/components/responses/Unauthorized"
2133
+ "404":
2134
+ $ref: "#/components/responses/NotFound"
2135
+ "409":
2136
+ $ref: "#/components/responses/Conflict"
2137
+ /me/notification-devices/{id}/activity:
2138
+ parameters:
2139
+ - name: id
2140
+ in: path
2141
+ required: true
2142
+ schema:
2143
+ type: string
2144
+ format: uuid
2145
+ put:
2146
+ tags:
2147
+ - me
2148
+ operationId: updateNotificationActivity
2149
+ summary: Report a visible client with a healthy live connection
2150
+ requestBody:
2151
+ required: true
2152
+ content:
2153
+ application/json:
2154
+ schema:
2155
+ $ref: "#/components/schemas/NotificationActivity"
2156
+ responses:
2157
+ "204":
2158
+ description: Saved
2159
+ "400":
2160
+ $ref: "#/components/responses/BadRequest"
2161
+ "401":
2162
+ $ref: "#/components/responses/Unauthorized"
2163
+ "404":
2164
+ $ref: "#/components/responses/NotFound"
2165
+ "409":
2166
+ $ref: "#/components/responses/Conflict"
2167
+
2168
+ /auth/recovery-requests:
2169
+ parameters:
2170
+ - &a1
2171
+ $ref: "#/components/parameters/ClientVersion"
2172
+ - &a2
2173
+ $ref: "#/components/parameters/ClientApiVersion"
2174
+ post:
2175
+ tags:
2176
+ - auth
2177
+ operationId: startDeviceRecovery
2178
+ summary: Request approval from a signed-in device
2179
+ security: []
2180
+ requestBody:
2181
+ required: true
2182
+ content:
2183
+ application/json:
2184
+ schema:
2185
+ $ref: "#/components/schemas/DeviceRecoveryStart"
2186
+ responses:
2187
+ "200":
2188
+ description: Success
2189
+ content:
2190
+ application/json:
2191
+ schema:
2192
+ $ref: "#/components/schemas/DeviceRecoveryResult"
2193
+ "400":
2194
+ $ref: "#/components/responses/BadRequest"
2195
+ "401":
2196
+ $ref: "#/components/responses/Unauthorized"
2197
+ "403":
2198
+ $ref: "#/components/responses/Forbidden"
2199
+ "409":
2200
+ $ref: "#/components/responses/Conflict"
2201
+ "422":
2202
+ $ref: "#/components/responses/ValidationFailed"
2203
+ "426":
2204
+ $ref: "#/components/responses/ClientOutdated"
2205
+ "429":
2206
+ $ref: "#/components/responses/TooManyRequests"
2207
+ /auth/recovery-requests/{requestId}:
2208
+ parameters:
2209
+ - *a1
2210
+ - *a2
2211
+ - &a3
2212
+ name: requestId
2213
+ in: path
2214
+ required: true
2215
+ schema:
2216
+ type: string
2217
+ minLength: 32
2218
+ maxLength: 128
2219
+ pattern: ^[A-Za-z0-9_-]+$
2220
+ description: Secret one-time recovery request capability. Never log or persist
2221
+ it in browser storage.
2222
+ get:
2223
+ tags:
2224
+ - auth
2225
+ operationId: deviceRecoveryStatus
2226
+ summary: Poll the status of a secret recovery request
2227
+ security: []
2228
+ responses:
2229
+ "200":
2230
+ description: Success
2231
+ content:
2232
+ application/json:
2233
+ schema:
2234
+ $ref: "#/components/schemas/DeviceRecoveryStatus"
2235
+ "400":
2236
+ $ref: "#/components/responses/BadRequest"
2237
+ "401":
2238
+ $ref: "#/components/responses/Unauthorized"
2239
+ "403":
2240
+ $ref: "#/components/responses/Forbidden"
2241
+ "409":
2242
+ $ref: "#/components/responses/Conflict"
2243
+ "422":
2244
+ $ref: "#/components/responses/ValidationFailed"
2245
+ "426":
2246
+ $ref: "#/components/responses/ClientOutdated"
2247
+ "429":
2248
+ $ref: "#/components/responses/TooManyRequests"
2249
+ /auth/recovery-requests/{requestId}/approve:
2250
+ parameters:
2251
+ - *a1
2252
+ - *a2
2253
+ - &a4
2254
+ name: requestId
2255
+ in: path
2256
+ required: true
2257
+ schema:
2258
+ type: string
2259
+ minLength: 32
2260
+ maxLength: 128
2261
+ pattern: ^[A-Za-z0-9_-]+$
2262
+ description: Approval handle from the recovery_request event. It is different from the
2263
+ requester's capability and cannot poll or complete the request.
2264
+ post:
2265
+ tags:
2266
+ - auth
2267
+ operationId: approveDeviceRecovery
2268
+ summary: Approve a recovery request using number matching, user verification and the second factor
2269
+ description: |
2270
+ Approval does not need the current password, which the user may have forgotten. The checks run in this
2271
+ order: the request must belong to the caller and `match_number` must match (a wrong number denies the
2272
+ request), then user verification, then the second factor.
2273
+
2274
+ User verification follows `POST /auth/recovery-requests/{requestId}/approve/options`. When the account
2275
+ has passkeys, `passkey` must carry an assertion with user verification for the challenge from that call
2276
+ (`403 user_verification_required` without it, `403 invalid_credentials` for a failed assertion,
2277
+ `400 invalid_request` for an unknown, used or expired challenge). A missing `code` answers
2278
+ `401 two_factor_required` before the challenge is used, so the request can be repeated with the same
2279
+ assertion and the code. A wrong code is checked after the passkey and uses up the challenge.
2280
+ Without passkeys the approving session must be at least as old as the minimum session age
2281
+ (`RECOVERY_APPROVAL_MIN_SESSION_AGE`, 72 hours by default), otherwise `403 session_too_new`.
2282
+
2283
+ `password` is ignored and only accepted so that older clients keep working.
2284
+ requestBody:
2285
+ required: true
2286
+ content:
2287
+ application/json:
2288
+ schema:
2289
+ $ref: "#/components/schemas/DeviceRecoveryApproval"
2290
+ responses:
2291
+ "200":
2292
+ description: Success
2293
+ content:
2294
+ application/json:
2295
+ schema:
2296
+ $ref: "#/components/schemas/DeviceRecoveryStatus"
2297
+ "400":
2298
+ $ref: "#/components/responses/BadRequest"
2299
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
2300
+ "403":
2301
+ $ref: "#/components/responses/Forbidden"
2302
+ "404":
2303
+ $ref: "#/components/responses/NotFound"
2304
+ "409":
2305
+ $ref: "#/components/responses/Conflict"
2306
+ "422":
2307
+ $ref: "#/components/responses/ValidationFailed"
2308
+ "426":
2309
+ $ref: "#/components/responses/ClientOutdated"
2310
+ "429":
2311
+ $ref: "#/components/responses/TooManyRequests"
2312
+ /auth/recovery-requests/{requestId}/approve/options:
2313
+ parameters:
2314
+ - *a1
2315
+ - *a2
2316
+ - *a4
2317
+ post:
2318
+ tags:
2319
+ - auth
2320
+ operationId: deviceRecoveryApprovalOptions
2321
+ summary: Tell the approving device how to verify its user
2322
+ description: |
2323
+ `method: passkey` when the account has passkeys: `challenge_id` and `public_key` (WebAuthn request
2324
+ options with `userVerification: required`) are for `navigator.credentials.get`, and the result goes to
2325
+ the approval as `passkey`. The challenge is bound to this session and request, is single use and expires
2326
+ after 5 minutes or with the request. `method: session` otherwise; `approvable_from` is set while the
2327
+ session is younger than the minimum session age and tells when it may approve.
2328
+ responses:
2329
+ "200":
2330
+ description: Success
2331
+ content:
2332
+ application/json:
2333
+ schema:
2334
+ $ref: "#/components/schemas/DeviceRecoveryApprovalOptions"
2335
+ "400":
2336
+ $ref: "#/components/responses/BadRequest"
2337
+ "401":
2338
+ $ref: "#/components/responses/Unauthorized"
2339
+ "403":
2340
+ $ref: "#/components/responses/Forbidden"
2341
+ "404":
2342
+ $ref: "#/components/responses/NotFound"
2343
+ "426":
2344
+ $ref: "#/components/responses/ClientOutdated"
2345
+ "429":
2346
+ $ref: "#/components/responses/TooManyRequests"
2347
+ /auth/recovery-requests/{requestId}/deny:
2348
+ parameters:
2349
+ - *a1
2350
+ - *a2
2351
+ - *a4
2352
+ post:
2353
+ tags:
2354
+ - auth
2355
+ operationId: denyDeviceRecovery
2356
+ summary: Deny an unexpected recovery request
2357
+ responses:
2358
+ "200":
2359
+ description: Success
2360
+ content:
2361
+ application/json:
2362
+ schema:
2363
+ $ref: "#/components/schemas/DeviceRecoveryStatus"
2364
+ "400":
2365
+ $ref: "#/components/responses/BadRequest"
2366
+ "401":
2367
+ $ref: "#/components/responses/Unauthorized"
2368
+ "403":
2369
+ $ref: "#/components/responses/Forbidden"
2370
+ "404":
2371
+ $ref: "#/components/responses/NotFound"
2372
+ "409":
2373
+ $ref: "#/components/responses/Conflict"
2374
+ "422":
2375
+ $ref: "#/components/responses/ValidationFailed"
2376
+ "426":
2377
+ $ref: "#/components/responses/ClientOutdated"
2378
+ "429":
2379
+ $ref: "#/components/responses/TooManyRequests"
2380
+ /auth/recovery-requests/{requestId}/complete:
2381
+ parameters:
2382
+ - *a1
2383
+ - *a2
2384
+ - *a3
2385
+ post:
2386
+ tags:
2387
+ - auth
2388
+ operationId: completeDeviceRecovery
2389
+ summary: Consume an approved request and reset the password
2390
+ security: []
2391
+ requestBody:
2392
+ required: true
2393
+ content:
2394
+ application/json:
2395
+ schema:
2396
+ $ref: "#/components/schemas/DeviceRecoveryComplete"
2397
+ responses:
2398
+ "200":
2399
+ description: Success
2400
+ content:
2401
+ application/json:
2402
+ schema:
2403
+ $ref: "#/components/schemas/RegisterResponse"
2404
+ "400":
2405
+ $ref: "#/components/responses/BadRequest"
2406
+ "401":
2407
+ $ref: "#/components/responses/Unauthorized"
2408
+ "403":
2409
+ $ref: "#/components/responses/Forbidden"
2410
+ "409":
2411
+ $ref: "#/components/responses/Conflict"
2412
+ "422":
2413
+ $ref: "#/components/responses/ValidationFailed"
2414
+ "426":
2415
+ $ref: "#/components/responses/ClientOutdated"
2416
+ "429":
2417
+ $ref: "#/components/responses/TooManyRequests"
2418
+ /auth/recovery-requests/{requestId}/cancel:
2419
+ parameters:
2420
+ - *a1
2421
+ - *a2
2422
+ - *a3
2423
+ post:
2424
+ tags:
2425
+ - auth
2426
+ operationId: cancelDeviceRecovery
2427
+ summary: Withdraw a pending recovery request from the requesting browser
2428
+ description: Ends a pending request so it no longer counts towards the limit of three active requests. It
2429
+ answers 204 for every capability, including unknown, decided and expired ones.
2430
+ security: []
2431
+ responses:
2432
+ "204":
2433
+ description: Cancelled or nothing to cancel
2434
+ "400":
2435
+ $ref: "#/components/responses/BadRequest"
2436
+ "426":
2437
+ $ref: "#/components/responses/ClientOutdated"
2438
+ "429":
2439
+ $ref: "#/components/responses/TooManyRequests"
2440
+
2441
+ /auth/qr-login:
2442
+ parameters:
2443
+ - $ref: "#/components/parameters/ClientVersion"
2444
+ - $ref: "#/components/parameters/ClientApiVersion"
2445
+ post:
2446
+ tags: [auth]
2447
+ operationId: createQrLogin
2448
+ summary: Start a sign-in with a QR code
2449
+ description: |
2450
+ Called by a device that is not signed in. Show `url` as a QR code and poll
2451
+ `POST /auth/qr-login/{requestId}/poll` with `poll_token` until the status is final. The request expires
2452
+ after 2 minutes. Keep `poll_token` in memory only; it is the secret that receives the session.
2453
+ security: []
2454
+ responses:
2455
+ "201":
2456
+ description: Created
2457
+ content:
2458
+ application/json:
2459
+ schema: { $ref: "#/components/schemas/QrLoginStart" }
2460
+ example:
2461
+ request_id: 3q2-7wEAAAD9W8b0kZ3lYfHk6gF1n9cQmR2pVx4sTtU
2462
+ poll_token: example-poll-token
2463
+ url: https://messenger.example.com/qr/3q2-7wEAAAD9W8b0kZ3lYfHk6gF1n9cQmR2pVx4sTtU
2464
+ expires_at: "2026-11-06T12:02:00Z"
2465
+ "400": { $ref: "#/components/responses/BadRequest" }
2466
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2467
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2468
+ /auth/qr-login/{requestId}:
2469
+ parameters:
2470
+ - $ref: "#/components/parameters/ClientVersion"
2471
+ - $ref: "#/components/parameters/ClientApiVersion"
2472
+ - $ref: "#/components/parameters/QrLoginRequestId"
2473
+ get:
2474
+ tags: [auth]
2475
+ operationId: getQrLogin
2476
+ summary: Show who asks to sign in with a QR code
2477
+ description: |
2478
+ Called by a signed-in device after it opened the link of the QR code. The first call moves the request from
2479
+ `pending` to `scanned` and binds it to the caller: other accounts get `404` from then on. Show `device` and
2480
+ `location` and let the user confirm that the sign-in is their own before approving. Unknown, expired and
2481
+ used requests answer `404`.
2482
+ responses:
2483
+ "200":
2484
+ description: Success
2485
+ content:
2486
+ application/json:
2487
+ schema: { $ref: "#/components/schemas/QrLoginRequest" }
2488
+ example:
2489
+ request_id: 3q2-7wEAAAD9W8b0kZ3lYfHk6gF1n9cQmR2pVx4sTtU
2490
+ status: scanned
2491
+ device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) Firefox/140.0
2492
+ location: { city: Berlin, country_code: DE, country: Germany }
2493
+ created_at: "2026-11-06T12:00:00Z"
2494
+ expires_at: "2026-11-06T12:02:00Z"
2495
+ "400": { $ref: "#/components/responses/BadRequest" }
2496
+ "401": { $ref: "#/components/responses/Unauthorized" }
2497
+ "404": { $ref: "#/components/responses/NotFound" }
2498
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2499
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2500
+ /auth/qr-login/{requestId}/poll:
2501
+ parameters:
2502
+ - $ref: "#/components/parameters/ClientVersion"
2503
+ - $ref: "#/components/parameters/ClientApiVersion"
2504
+ - $ref: "#/components/parameters/QrLoginRequestId"
2505
+ post:
2506
+ tags: [auth]
2507
+ operationId: pollQrLogin
2508
+ summary: Poll a QR sign-in and receive the session once approved
2509
+ description: |
2510
+ Called by the device that created the request, about once per second (at most 120 polls per 2 minutes per
2511
+ client address). While the request is open the answer is `pending` or `scanned`. The first poll after
2512
+ approval signs the device in exactly like a successful `POST /auth/login`: it sets the refresh cookie and
2513
+ returns `status: approved` with the token fields. Later polls, unknown requests, a wrong `poll_token` and
2514
+ expired requests all answer `expired`.
2515
+ security: []
2516
+ requestBody:
2517
+ required: true
2518
+ content:
2519
+ application/json:
2520
+ schema: { $ref: "#/components/schemas/QrLoginPollRequest" }
2521
+ responses:
2522
+ "200":
2523
+ description: The current status, plus the session when it was just approved
2524
+ headers:
2525
+ Set-Cookie: { $ref: "#/components/headers/RefreshCookie" }
2526
+ content:
2527
+ application/json:
2528
+ schema: { $ref: "#/components/schemas/QrLoginPollResult" }
2529
+ examples:
2530
+ waiting:
2531
+ value: { status: scanned }
2532
+ approved:
2533
+ value:
2534
+ status: approved
2535
+ access_token: example-access-token
2536
+ token_type: Bearer
2537
+ expires_in: 900
2538
+ "400": { $ref: "#/components/responses/BadRequest" }
2539
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2540
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2541
+ /auth/qr-login/{requestId}/approve:
2542
+ parameters:
2543
+ - $ref: "#/components/parameters/ClientVersion"
2544
+ - $ref: "#/components/parameters/ClientApiVersion"
2545
+ - $ref: "#/components/parameters/QrLoginRequestId"
2546
+ post:
2547
+ tags: [auth]
2548
+ operationId: approveQrLogin
2549
+ summary: Sign the device of a QR code into this account
2550
+ description: |
2551
+ Single use. The request must be `pending` or `scanned`, not expired and not bound to another account
2552
+ (`404` otherwise; `409` when it was already approved or denied). The calling session must be active and
2553
+ used within `RECOVERY_APPROVAL_MAX_AGE` (`403 forbidden` otherwise). With two-factor on, send `code` (an
2554
+ authenticator code or an unused recovery code); without it the answer is `401 two_factor_required` and the
2555
+ request stays approvable. A wrong code answers `400 invalid_credentials`. The body may be omitted.
2556
+ requestBody:
2557
+ required: false
2558
+ content:
2559
+ application/json:
2560
+ schema: { $ref: "#/components/schemas/QrLoginApproval" }
2561
+ example: { code: "123456" }
2562
+ responses:
2563
+ "204": { description: Approved; the new device receives its session on its next poll }
2564
+ "400": { $ref: "#/components/responses/BadRequest" }
2565
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
2566
+ "403": { $ref: "#/components/responses/Forbidden" }
2567
+ "404": { $ref: "#/components/responses/NotFound" }
2568
+ "409": { $ref: "#/components/responses/Conflict" }
2569
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2570
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2571
+ /auth/qr-login/{requestId}/deny:
2572
+ parameters:
2573
+ - $ref: "#/components/parameters/ClientVersion"
2574
+ - $ref: "#/components/parameters/ClientApiVersion"
2575
+ - $ref: "#/components/parameters/QrLoginRequestId"
2576
+ post:
2577
+ tags: [auth]
2578
+ operationId: denyQrLogin
2579
+ summary: Refuse a QR sign-in
2580
+ description: The new device then polls `denied`. Same `404` and `409` rules as approving.
2581
+ responses:
2582
+ "204": { description: Denied }
2583
+ "400": { $ref: "#/components/responses/BadRequest" }
2584
+ "401": { $ref: "#/components/responses/Unauthorized" }
2585
+ "404": { $ref: "#/components/responses/NotFound" }
2586
+ "409": { $ref: "#/components/responses/Conflict" }
2587
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2588
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2589
+
2590
+ /auth/passkeys/register/options:
2591
+ parameters: &a1
2592
+ - &a2
2593
+ $ref: "#/components/parameters/ClientVersion"
2594
+ - &a3
2595
+ $ref: "#/components/parameters/ClientApiVersion"
2596
+ post:
2597
+ tags:
2598
+ - auth
2599
+ operationId: passkeyRegistrationOptions
2600
+ summary: Begin passkey registration after password and second-factor verification
2601
+ requestBody:
2602
+ required: true
2603
+ content:
2604
+ application/json:
2605
+ schema:
2606
+ $ref: "#/components/schemas/PasskeyRegistration"
2607
+ responses:
2608
+ "200":
2609
+ description: Success
2610
+ content:
2611
+ application/json:
2612
+ schema:
2613
+ $ref: "#/components/schemas/PasskeyOptions"
2614
+ "400":
2615
+ description: Bad request
2616
+ content:
2617
+ application/problem+json:
2618
+ schema:
2619
+ $ref: "#/components/schemas/Problem"
2620
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
2621
+ "403":
2622
+ description: Forbidden
2623
+ content:
2624
+ application/problem+json:
2625
+ schema:
2626
+ $ref: "#/components/schemas/Problem"
2627
+ "404":
2628
+ description: Not found
2629
+ content:
2630
+ application/problem+json:
2631
+ schema:
2632
+ $ref: "#/components/schemas/Problem"
2633
+ "409":
2634
+ description: Conflict
2635
+ content:
2636
+ application/problem+json:
2637
+ schema:
2638
+ $ref: "#/components/schemas/Problem"
2639
+ "422":
2640
+ description: Invalid input
2641
+ content:
2642
+ application/problem+json:
2643
+ schema:
2644
+ $ref: "#/components/schemas/Problem"
2645
+ "426":
2646
+ description: Client outdated
2647
+ content:
2648
+ application/problem+json:
2649
+ schema:
2650
+ $ref: "#/components/schemas/Problem"
2651
+ "429":
2652
+ description: Rate limited
2653
+ content:
2654
+ application/problem+json:
2655
+ schema:
2656
+ $ref: "#/components/schemas/Problem"
2657
+ "503":
2658
+ description: Passkeys are not configured
2659
+ content:
2660
+ application/problem+json:
2661
+ schema:
2662
+ $ref: "#/components/schemas/Problem"
2663
+ /auth/passkeys/register/verify:
2664
+ parameters: *a1
2665
+ post:
2666
+ tags:
2667
+ - auth
2668
+ operationId: verifyPasskeyRegistration
2669
+ summary: Verify and store a passkey
2670
+ requestBody:
2671
+ required: true
2672
+ content:
2673
+ application/json:
2674
+ schema:
2675
+ $ref: "#/components/schemas/PasskeyVerification"
2676
+ responses:
2677
+ "204":
2678
+ description: Success
2679
+ "400":
2680
+ description: Bad request
2681
+ content:
2682
+ application/problem+json:
2683
+ schema:
2684
+ $ref: "#/components/schemas/Problem"
2685
+ "401":
2686
+ description: Unauthorized
2687
+ content:
2688
+ application/problem+json:
2689
+ schema:
2690
+ $ref: "#/components/schemas/Problem"
2691
+ "403":
2692
+ description: Forbidden
2693
+ content:
2694
+ application/problem+json:
2695
+ schema:
2696
+ $ref: "#/components/schemas/Problem"
2697
+ "404":
2698
+ description: Not found
2699
+ content:
2700
+ application/problem+json:
2701
+ schema:
2702
+ $ref: "#/components/schemas/Problem"
2703
+ "409":
2704
+ description: Conflict
2705
+ content:
2706
+ application/problem+json:
2707
+ schema:
2708
+ $ref: "#/components/schemas/Problem"
2709
+ "422":
2710
+ description: Invalid input
2711
+ content:
2712
+ application/problem+json:
2713
+ schema:
2714
+ $ref: "#/components/schemas/Problem"
2715
+ "426":
2716
+ description: Client outdated
2717
+ content:
2718
+ application/problem+json:
2719
+ schema:
2720
+ $ref: "#/components/schemas/Problem"
2721
+ "429":
2722
+ description: Rate limited
2723
+ content:
2724
+ application/problem+json:
2725
+ schema:
2726
+ $ref: "#/components/schemas/Problem"
2727
+ "503":
2728
+ description: Passkeys are not configured
2729
+ content:
2730
+ application/problem+json:
2731
+ schema:
2732
+ $ref: "#/components/schemas/Problem"
2733
+ /auth/passkeys:
2734
+ parameters: *a1
2735
+ get:
2736
+ tags:
2737
+ - auth
2738
+ operationId: listPasskeys
2739
+ summary: List the account passkeys
2740
+ responses:
2741
+ "200":
2742
+ description: Success
2743
+ content:
2744
+ application/json:
2745
+ schema:
2746
+ $ref: "#/components/schemas/PasskeyPage"
2747
+ "400":
2748
+ description: Bad request
2749
+ content:
2750
+ application/problem+json:
2751
+ schema:
2752
+ $ref: "#/components/schemas/Problem"
2753
+ "401":
2754
+ description: Unauthorized
2755
+ content:
2756
+ application/problem+json:
2757
+ schema:
2758
+ $ref: "#/components/schemas/Problem"
2759
+ "403":
2760
+ description: Forbidden
2761
+ content:
2762
+ application/problem+json:
2763
+ schema:
2764
+ $ref: "#/components/schemas/Problem"
2765
+ "404":
2766
+ description: Not found
2767
+ content:
2768
+ application/problem+json:
2769
+ schema:
2770
+ $ref: "#/components/schemas/Problem"
2771
+ "409":
2772
+ description: Conflict
2773
+ content:
2774
+ application/problem+json:
2775
+ schema:
2776
+ $ref: "#/components/schemas/Problem"
2777
+ "422":
2778
+ description: Invalid input
2779
+ content:
2780
+ application/problem+json:
2781
+ schema:
2782
+ $ref: "#/components/schemas/Problem"
2783
+ "426":
2784
+ description: Client outdated
2785
+ content:
2786
+ application/problem+json:
2787
+ schema:
2788
+ $ref: "#/components/schemas/Problem"
2789
+ "429":
2790
+ description: Rate limited
2791
+ content:
2792
+ application/problem+json:
2793
+ schema:
2794
+ $ref: "#/components/schemas/Problem"
2795
+ "503":
2796
+ description: Passkeys are not configured
2797
+ content:
2798
+ application/problem+json:
2799
+ schema:
2800
+ $ref: "#/components/schemas/Problem"
2801
+ /auth/passkeys/{passkeyId}:
2802
+ parameters:
2803
+ - *a2
2804
+ - *a3
2805
+ - name: passkeyId
2806
+ in: path
2807
+ required: true
2808
+ schema:
2809
+ type: string
2810
+ minLength: 1
2811
+ maxLength: 2048
2812
+ pattern: ^[A-Za-z0-9_-]+$
2813
+ patch:
2814
+ tags:
2815
+ - auth
2816
+ operationId: renamePasskey
2817
+ summary: Rename a passkey
2818
+ requestBody:
2819
+ required: true
2820
+ content:
2821
+ application/json:
2822
+ schema:
2823
+ $ref: "#/components/schemas/PasskeyRename"
2824
+ responses:
2825
+ "204":
2826
+ description: Success
2827
+ "400":
2828
+ description: Bad request
2829
+ content:
2830
+ application/problem+json:
2831
+ schema:
2832
+ $ref: "#/components/schemas/Problem"
2833
+ "401":
2834
+ description: Unauthorized
2835
+ content:
2836
+ application/problem+json:
2837
+ schema:
2838
+ $ref: "#/components/schemas/Problem"
2839
+ "403":
2840
+ description: Forbidden
2841
+ content:
2842
+ application/problem+json:
2843
+ schema:
2844
+ $ref: "#/components/schemas/Problem"
2845
+ "404":
2846
+ description: Not found
2847
+ content:
2848
+ application/problem+json:
2849
+ schema:
2850
+ $ref: "#/components/schemas/Problem"
2851
+ "409":
2852
+ description: Conflict
2853
+ content:
2854
+ application/problem+json:
2855
+ schema:
2856
+ $ref: "#/components/schemas/Problem"
2857
+ "422":
2858
+ description: Invalid input
2859
+ content:
2860
+ application/problem+json:
2861
+ schema:
2862
+ $ref: "#/components/schemas/Problem"
2863
+ "426":
2864
+ description: Client outdated
2865
+ content:
2866
+ application/problem+json:
2867
+ schema:
2868
+ $ref: "#/components/schemas/Problem"
2869
+ "429":
2870
+ description: Rate limited
2871
+ content:
2872
+ application/problem+json:
2873
+ schema:
2874
+ $ref: "#/components/schemas/Problem"
2875
+ "503":
2876
+ description: Passkeys are not configured
2877
+ content:
2878
+ application/problem+json:
2879
+ schema:
2880
+ $ref: "#/components/schemas/Problem"
2881
+ delete:
2882
+ tags:
2883
+ - auth
2884
+ operationId: removePasskey
2885
+ summary: Remove a passkey; the last credential requires the password
2886
+ requestBody:
2887
+ required: true
2888
+ content:
2889
+ application/json:
2890
+ schema:
2891
+ $ref: "#/components/schemas/PasskeyRemoval"
2892
+ responses:
2893
+ "204":
2894
+ description: Success
2895
+ "400":
2896
+ description: Bad request
2897
+ content:
2898
+ application/problem+json:
2899
+ schema:
2900
+ $ref: "#/components/schemas/Problem"
2901
+ "401":
2902
+ description: Unauthorized
2903
+ content:
2904
+ application/problem+json:
2905
+ schema:
2906
+ $ref: "#/components/schemas/Problem"
2907
+ "403":
2908
+ description: Forbidden
2909
+ content:
2910
+ application/problem+json:
2911
+ schema:
2912
+ $ref: "#/components/schemas/Problem"
2913
+ "404":
2914
+ description: Not found
2915
+ content:
2916
+ application/problem+json:
2917
+ schema:
2918
+ $ref: "#/components/schemas/Problem"
2919
+ "409":
2920
+ description: Conflict
2921
+ content:
2922
+ application/problem+json:
2923
+ schema:
2924
+ $ref: "#/components/schemas/Problem"
2925
+ "422":
2926
+ description: Invalid input
2927
+ content:
2928
+ application/problem+json:
2929
+ schema:
2930
+ $ref: "#/components/schemas/Problem"
2931
+ "426":
2932
+ description: Client outdated
2933
+ content:
2934
+ application/problem+json:
2935
+ schema:
2936
+ $ref: "#/components/schemas/Problem"
2937
+ "429":
2938
+ description: Rate limited
2939
+ content:
2940
+ application/problem+json:
2941
+ schema:
2942
+ $ref: "#/components/schemas/Problem"
2943
+ "503":
2944
+ description: Passkeys are not configured
2945
+ content:
2946
+ application/problem+json:
2947
+ schema:
2948
+ $ref: "#/components/schemas/Problem"
2949
+ /auth/passkeys/login/options:
2950
+ parameters: *a1
2951
+ post:
2952
+ tags:
2953
+ - auth
2954
+ operationId: passkeyLoginOptions
2955
+ summary: Begin discoverable passkey sign-in
2956
+ security: []
2957
+ requestBody:
2958
+ required: true
2959
+ content:
2960
+ application/json:
2961
+ schema:
2962
+ $ref: "#/components/schemas/PasskeyLoginOptions"
2963
+ responses:
2964
+ "200":
2965
+ description: Success
2966
+ content:
2967
+ application/json:
2968
+ schema:
2969
+ $ref: "#/components/schemas/PasskeyOptions"
2970
+ "400":
2971
+ description: Bad request
2972
+ content:
2973
+ application/problem+json:
2974
+ schema:
2975
+ $ref: "#/components/schemas/Problem"
2976
+ "401":
2977
+ description: Unauthorized
2978
+ content:
2979
+ application/problem+json:
2980
+ schema:
2981
+ $ref: "#/components/schemas/Problem"
2982
+ "403":
2983
+ description: Forbidden
2984
+ content:
2985
+ application/problem+json:
2986
+ schema:
2987
+ $ref: "#/components/schemas/Problem"
2988
+ "404":
2989
+ description: Not found
2990
+ content:
2991
+ application/problem+json:
2992
+ schema:
2993
+ $ref: "#/components/schemas/Problem"
2994
+ "409":
2995
+ description: Conflict
2996
+ content:
2997
+ application/problem+json:
2998
+ schema:
2999
+ $ref: "#/components/schemas/Problem"
3000
+ "422":
3001
+ description: Invalid input
3002
+ content:
3003
+ application/problem+json:
3004
+ schema:
3005
+ $ref: "#/components/schemas/Problem"
3006
+ "426":
3007
+ description: Client outdated
3008
+ content:
3009
+ application/problem+json:
3010
+ schema:
3011
+ $ref: "#/components/schemas/Problem"
3012
+ "429":
3013
+ description: Rate limited
3014
+ content:
3015
+ application/problem+json:
3016
+ schema:
3017
+ $ref: "#/components/schemas/Problem"
3018
+ "503":
3019
+ description: Passkeys are not configured
3020
+ content:
3021
+ application/problem+json:
3022
+ schema:
3023
+ $ref: "#/components/schemas/Problem"
3024
+ /auth/passkeys/login/verify:
3025
+ parameters: *a1
3026
+ post:
3027
+ tags:
3028
+ - auth
3029
+ operationId: verifyPasskeyLogin
3030
+ summary: Verify a passkey and create a session
3031
+ security: []
3032
+ requestBody:
3033
+ required: true
3034
+ content:
3035
+ application/json:
3036
+ schema:
3037
+ $ref: "#/components/schemas/PasskeyVerification"
3038
+ responses:
3039
+ "200":
3040
+ description: Success
3041
+ content:
3042
+ application/json:
3043
+ schema:
3044
+ $ref: "#/components/schemas/TokenResponse"
3045
+ "400":
3046
+ description: Bad request
3047
+ content:
3048
+ application/problem+json:
3049
+ schema:
3050
+ $ref: "#/components/schemas/Problem"
3051
+ "401":
3052
+ description: Unauthorized
3053
+ content:
3054
+ application/problem+json:
3055
+ schema:
3056
+ $ref: "#/components/schemas/Problem"
3057
+ "403":
3058
+ description: Forbidden
3059
+ content:
3060
+ application/problem+json:
3061
+ schema:
3062
+ $ref: "#/components/schemas/Problem"
3063
+ "404":
3064
+ description: Not found
3065
+ content:
3066
+ application/problem+json:
3067
+ schema:
3068
+ $ref: "#/components/schemas/Problem"
3069
+ "409":
3070
+ description: Conflict
3071
+ content:
3072
+ application/problem+json:
3073
+ schema:
3074
+ $ref: "#/components/schemas/Problem"
3075
+ "422":
3076
+ description: Invalid input
3077
+ content:
3078
+ application/problem+json:
3079
+ schema:
3080
+ $ref: "#/components/schemas/Problem"
3081
+ "426":
3082
+ description: Client outdated
3083
+ content:
3084
+ application/problem+json:
3085
+ schema:
3086
+ $ref: "#/components/schemas/Problem"
3087
+ "429":
3088
+ description: Rate limited
3089
+ content:
3090
+ application/problem+json:
3091
+ schema:
3092
+ $ref: "#/components/schemas/Problem"
3093
+ "503":
3094
+ description: Passkeys are not configured
3095
+ content:
3096
+ application/problem+json:
3097
+ schema:
3098
+ $ref: "#/components/schemas/Problem"
3099
+
3100
+ /me/recovery-status:
3101
+ parameters: &a1
3102
+ - $ref: "#/components/parameters/ClientVersion"
3103
+ - $ref: "#/components/parameters/ClientApiVersion"
3104
+ get:
3105
+ tags:
3106
+ - auth
3107
+ operationId: getRecoveryOverview
3108
+ summary: List recovery methods and their current setup status
3109
+ responses:
3110
+ "200":
3111
+ description: Success
3112
+ content:
3113
+ application/json:
3114
+ schema:
3115
+ $ref: "#/components/schemas/RecoveryOverview"
3116
+ "400":
3117
+ description: Invalid recovery credentials
3118
+ content:
3119
+ application/problem+json:
3120
+ schema:
3121
+ $ref: "#/components/schemas/Problem"
3122
+ "401":
3123
+ description: Unauthorized
3124
+ content:
3125
+ application/problem+json:
3126
+ schema:
3127
+ $ref: "#/components/schemas/Problem"
3128
+ "403":
3129
+ description: Forbidden
3130
+ content:
3131
+ application/problem+json:
3132
+ schema:
3133
+ $ref: "#/components/schemas/Problem"
3134
+ "409":
3135
+ description: Security delay or conflicting state
3136
+ content:
3137
+ application/problem+json:
3138
+ schema:
3139
+ $ref: "#/components/schemas/Problem"
3140
+ "422":
3141
+ description: Invalid input
3142
+ content:
3143
+ application/problem+json:
3144
+ schema:
3145
+ $ref: "#/components/schemas/Problem"
3146
+ "426":
3147
+ description: Client outdated
3148
+ content:
3149
+ application/problem+json:
3150
+ schema:
3151
+ $ref: "#/components/schemas/Problem"
3152
+ "429":
3153
+ description: Rate limited
3154
+ content:
3155
+ application/problem+json:
3156
+ schema:
3157
+ $ref: "#/components/schemas/Problem"
3158
+ "503":
3159
+ description: Email recovery is not configured
3160
+ content:
3161
+ application/problem+json:
3162
+ schema:
3163
+ $ref: "#/components/schemas/Problem"
3164
+ /me/email:
3165
+ parameters: *a1
3166
+ get:
3167
+ tags:
3168
+ - auth
3169
+ operationId: getRecoveryEmail
3170
+ summary: Get private recovery email status
3171
+ responses:
3172
+ "200":
3173
+ description: Success
3174
+ content:
3175
+ application/json:
3176
+ schema:
3177
+ $ref: "#/components/schemas/RecoveryEmailStatus"
3178
+ "400":
3179
+ description: Invalid recovery credentials
3180
+ content:
3181
+ application/problem+json:
3182
+ schema:
3183
+ $ref: "#/components/schemas/Problem"
3184
+ "401":
3185
+ description: Unauthorized
3186
+ content:
3187
+ application/problem+json:
3188
+ schema:
3189
+ $ref: "#/components/schemas/Problem"
3190
+ "403":
3191
+ description: Forbidden
3192
+ content:
3193
+ application/problem+json:
3194
+ schema:
3195
+ $ref: "#/components/schemas/Problem"
3196
+ "409":
3197
+ description: Security delay or conflicting state
3198
+ content:
3199
+ application/problem+json:
3200
+ schema:
3201
+ $ref: "#/components/schemas/Problem"
3202
+ "422":
3203
+ description: Invalid input
3204
+ content:
3205
+ application/problem+json:
3206
+ schema:
3207
+ $ref: "#/components/schemas/Problem"
3208
+ "426":
3209
+ description: Client outdated
3210
+ content:
3211
+ application/problem+json:
3212
+ schema:
3213
+ $ref: "#/components/schemas/Problem"
3214
+ "429":
3215
+ description: Rate limited
3216
+ content:
3217
+ application/problem+json:
3218
+ schema:
3219
+ $ref: "#/components/schemas/Problem"
3220
+ "503":
3221
+ description: Email recovery is not configured
3222
+ content:
3223
+ application/problem+json:
3224
+ schema:
3225
+ $ref: "#/components/schemas/Problem"
3226
+ put:
3227
+ tags:
3228
+ - auth
3229
+ operationId: setRecoveryEmail
3230
+ summary: Set or resend a private recovery email for verification
3231
+ requestBody:
3232
+ required: true
3233
+ content:
3234
+ application/json:
3235
+ schema:
3236
+ $ref: "#/components/schemas/SetRecoveryEmail"
3237
+ responses:
3238
+ "204":
3239
+ description: Success
3240
+ "400":
3241
+ description: Invalid recovery credentials
3242
+ content:
3243
+ application/problem+json:
3244
+ schema:
3245
+ $ref: "#/components/schemas/Problem"
3246
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
3247
+ "403":
3248
+ description: Forbidden
3249
+ content:
3250
+ application/problem+json:
3251
+ schema:
3252
+ $ref: "#/components/schemas/Problem"
3253
+ "409":
3254
+ description: Security delay or conflicting state
3255
+ content:
3256
+ application/problem+json:
3257
+ schema:
3258
+ $ref: "#/components/schemas/Problem"
3259
+ "422":
3260
+ description: Invalid input
3261
+ content:
3262
+ application/problem+json:
3263
+ schema:
3264
+ $ref: "#/components/schemas/Problem"
3265
+ "426":
3266
+ description: Client outdated
3267
+ content:
3268
+ application/problem+json:
3269
+ schema:
3270
+ $ref: "#/components/schemas/Problem"
3271
+ "429":
3272
+ description: Rate limited
3273
+ content:
3274
+ application/problem+json:
3275
+ schema:
3276
+ $ref: "#/components/schemas/Problem"
3277
+ "503":
3278
+ description: Email recovery is not configured
3279
+ content:
3280
+ application/problem+json:
3281
+ schema:
3282
+ $ref: "#/components/schemas/Problem"
3283
+ delete:
3284
+ tags:
3285
+ - auth
3286
+ operationId: removeRecoveryEmail
3287
+ summary: Remove the recovery email after password verification
3288
+ requestBody:
3289
+ required: true
3290
+ content:
3291
+ application/json:
3292
+ schema:
3293
+ $ref: "#/components/schemas/RemoveRecoveryEmail"
3294
+ responses:
3295
+ "204":
3296
+ description: Success
3297
+ "400":
3298
+ description: Invalid recovery credentials
3299
+ content:
3300
+ application/problem+json:
3301
+ schema:
3302
+ $ref: "#/components/schemas/Problem"
3303
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
3304
+ "403":
3305
+ description: Forbidden
3306
+ content:
3307
+ application/problem+json:
3308
+ schema:
3309
+ $ref: "#/components/schemas/Problem"
3310
+ "409":
3311
+ description: Security delay or conflicting state
3312
+ content:
3313
+ application/problem+json:
3314
+ schema:
3315
+ $ref: "#/components/schemas/Problem"
3316
+ "422":
3317
+ description: Invalid input
3318
+ content:
3319
+ application/problem+json:
3320
+ schema:
3321
+ $ref: "#/components/schemas/Problem"
3322
+ "426":
3323
+ description: Client outdated
3324
+ content:
3325
+ application/problem+json:
3326
+ schema:
3327
+ $ref: "#/components/schemas/Problem"
3328
+ "429":
3329
+ description: Rate limited
3330
+ content:
3331
+ application/problem+json:
3332
+ schema:
3333
+ $ref: "#/components/schemas/Problem"
3334
+ "503":
3335
+ description: Email recovery is not configured
3336
+ content:
3337
+ application/problem+json:
3338
+ schema:
3339
+ $ref: "#/components/schemas/Problem"
3340
+ /auth/email/verify:
3341
+ parameters: *a1
3342
+ post:
3343
+ tags:
3344
+ - auth
3345
+ operationId: verifyRecoveryEmail
3346
+ summary: Consume a one-time email verification token
3347
+ security: []
3348
+ requestBody:
3349
+ required: true
3350
+ content:
3351
+ application/json:
3352
+ schema:
3353
+ $ref: "#/components/schemas/VerifyRecoveryEmail"
3354
+ responses:
3355
+ "204":
3356
+ description: Success
3357
+ "400":
3358
+ description: Invalid recovery credentials
3359
+ content:
3360
+ application/problem+json:
3361
+ schema:
3362
+ $ref: "#/components/schemas/Problem"
3363
+ "401":
3364
+ description: Unauthorized
3365
+ content:
3366
+ application/problem+json:
3367
+ schema:
3368
+ $ref: "#/components/schemas/Problem"
3369
+ "403":
3370
+ description: Forbidden
3371
+ content:
3372
+ application/problem+json:
3373
+ schema:
3374
+ $ref: "#/components/schemas/Problem"
3375
+ "409":
3376
+ description: Security delay or conflicting state
3377
+ content:
3378
+ application/problem+json:
3379
+ schema:
3380
+ $ref: "#/components/schemas/Problem"
3381
+ "422":
3382
+ description: Invalid input
3383
+ content:
3384
+ application/problem+json:
3385
+ schema:
3386
+ $ref: "#/components/schemas/Problem"
3387
+ "426":
3388
+ description: Client outdated
3389
+ content:
3390
+ application/problem+json:
3391
+ schema:
3392
+ $ref: "#/components/schemas/Problem"
3393
+ "429":
3394
+ description: Rate limited
3395
+ content:
3396
+ application/problem+json:
3397
+ schema:
3398
+ $ref: "#/components/schemas/Problem"
3399
+ "503":
3400
+ description: Email recovery is not configured
3401
+ content:
3402
+ application/problem+json:
3403
+ schema:
3404
+ $ref: "#/components/schemas/Problem"
3405
+ /auth/password-reset/request:
3406
+ parameters: *a1
3407
+ post:
3408
+ tags:
3409
+ - auth
3410
+ operationId: requestEmailReset
3411
+ summary: Queue a recovery email without revealing whether an account exists
3412
+ security: []
3413
+ requestBody:
3414
+ required: true
3415
+ content:
3416
+ application/json:
3417
+ schema:
3418
+ $ref: "#/components/schemas/EmailResetRequest"
3419
+ responses:
3420
+ "202":
3421
+ description: Success
3422
+ content:
3423
+ application/json:
3424
+ schema:
3425
+ $ref: "#/components/schemas/EmailResetAccepted"
3426
+ "400":
3427
+ description: Invalid recovery credentials
3428
+ content:
3429
+ application/problem+json:
3430
+ schema:
3431
+ $ref: "#/components/schemas/Problem"
3432
+ "401":
3433
+ description: Unauthorized
3434
+ content:
3435
+ application/problem+json:
3436
+ schema:
3437
+ $ref: "#/components/schemas/Problem"
3438
+ "403":
3439
+ description: Forbidden
3440
+ content:
3441
+ application/problem+json:
3442
+ schema:
3443
+ $ref: "#/components/schemas/Problem"
3444
+ "409":
3445
+ description: Security delay or conflicting state
3446
+ content:
3447
+ application/problem+json:
3448
+ schema:
3449
+ $ref: "#/components/schemas/Problem"
3450
+ "422":
3451
+ description: Invalid input
3452
+ content:
3453
+ application/problem+json:
3454
+ schema:
3455
+ $ref: "#/components/schemas/Problem"
3456
+ "426":
3457
+ description: Client outdated
3458
+ content:
3459
+ application/problem+json:
3460
+ schema:
3461
+ $ref: "#/components/schemas/Problem"
3462
+ "429":
3463
+ description: Rate limited
3464
+ content:
3465
+ application/problem+json:
3466
+ schema:
3467
+ $ref: "#/components/schemas/Problem"
3468
+ "503":
3469
+ description: Email recovery is not configured
3470
+ content:
3471
+ application/problem+json:
3472
+ schema:
3473
+ $ref: "#/components/schemas/Problem"
3474
+ /auth/password-reset/confirm:
3475
+ parameters: *a1
3476
+ post:
3477
+ tags:
3478
+ - auth
3479
+ operationId: confirmEmailReset
3480
+ summary: Reset a password using a one-time email token and the current second
3481
+ factor
3482
+ security: []
3483
+ requestBody:
3484
+ required: true
3485
+ content:
3486
+ application/json:
3487
+ schema:
3488
+ $ref: "#/components/schemas/EmailResetConfirmation"
3489
+ responses:
3490
+ "200":
3491
+ description: Success
3492
+ content:
3493
+ application/json:
3494
+ schema:
3495
+ $ref: "#/components/schemas/RegisterResponse"
3496
+ "400":
3497
+ description: Invalid recovery credentials
3498
+ content:
3499
+ application/problem+json:
3500
+ schema:
3501
+ $ref: "#/components/schemas/Problem"
3502
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
3503
+ "403":
3504
+ description: Forbidden
3505
+ content:
3506
+ application/problem+json:
3507
+ schema:
3508
+ $ref: "#/components/schemas/Problem"
3509
+ "404":
3510
+ $ref: "#/components/responses/NotFound"
3511
+ "409":
3512
+ description: Security delay or conflicting state
3513
+ content:
3514
+ application/problem+json:
3515
+ schema:
3516
+ $ref: "#/components/schemas/Problem"
3517
+ "422":
3518
+ description: Invalid input
3519
+ content:
3520
+ application/problem+json:
3521
+ schema:
3522
+ $ref: "#/components/schemas/Problem"
3523
+ "426":
3524
+ description: Client outdated
3525
+ content:
3526
+ application/problem+json:
3527
+ schema:
3528
+ $ref: "#/components/schemas/Problem"
3529
+ "429":
3530
+ description: Rate limited
3531
+ content:
3532
+ application/problem+json:
3533
+ schema:
3534
+ $ref: "#/components/schemas/Problem"
3535
+ "503":
3536
+ description: Email recovery is not configured
3537
+ content:
3538
+ application/problem+json:
3539
+ schema:
3540
+ $ref: "#/components/schemas/Problem"
3541
+
3542
+ /calls/config:
3543
+ parameters:
3544
+ - $ref: "#/components/parameters/ClientVersion"
3545
+ - $ref: "#/components/parameters/ClientApiVersion"
3546
+ get:
3547
+ tags: [calls]
3548
+ operationId: getCallConfig
3549
+ summary: Whether audio calls are available and their limits
3550
+ description: |
3551
+ `enabled` is `false` when the server has no media service configured or calls are switched off; clients then
3552
+ hide every call control. Clients must also check that the browser supports call encryption before offering
3553
+ calls.
3554
+ responses:
3555
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3556
+ "400": { $ref: "#/components/responses/BadRequest" }
3557
+ "200":
3558
+ description: Call availability
3559
+ content:
3560
+ application/json:
3561
+ schema: { $ref: "#/components/schemas/CallConfig" }
3562
+ "401": { $ref: "#/components/responses/Unauthorized" }
3563
+ /me/call-identity:
3564
+ parameters:
3565
+ - $ref: "#/components/parameters/ClientVersion"
3566
+ - $ref: "#/components/parameters/ClientApiVersion"
3567
+ put:
3568
+ tags: [calls]
3569
+ operationId: setCallIdentity
3570
+ summary: Register this session's call identity public key
3571
+ description: |
3572
+ One key per session (see `docs/calls-e2ee.md`). Registering a different key replaces the old one; if the
3573
+ session is in a call, the call's epoch increases. The private key never leaves the client.
3574
+ requestBody:
3575
+ required: true
3576
+ content:
3577
+ application/json:
3578
+ schema: { $ref: "#/components/schemas/CallIdentityRequest" }
3579
+ responses:
3580
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3581
+ "400": { $ref: "#/components/responses/BadRequest" }
3582
+ "204":
3583
+ description: Stored
3584
+ "401": { $ref: "#/components/responses/Unauthorized" }
3585
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3586
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3587
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3588
+ /calls:
3589
+ parameters:
3590
+ - $ref: "#/components/parameters/ClientVersion"
3591
+ - $ref: "#/components/parameters/ClientApiVersion"
3592
+ get:
3593
+ tags: [calls]
3594
+ operationId: listMyCalls
3595
+ summary: Calls that are not over and involve the current user
3596
+ description: |
3597
+ Calls ringing the user and calls the user has joined, newest first. Clients load this after every
3598
+ (re)connect, because realtime events are best effort.
3599
+ responses:
3600
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3601
+ "400": { $ref: "#/components/responses/BadRequest" }
3602
+ "200":
3603
+ description: Current calls
3604
+ content:
3605
+ application/json:
3606
+ schema: { $ref: "#/components/schemas/CallList" }
3607
+ "401": { $ref: "#/components/responses/Unauthorized" }
3608
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3609
+ /chats/{chat_id}/call:
3610
+ parameters:
3611
+ - $ref: "#/components/parameters/ClientVersion"
3612
+ - $ref: "#/components/parameters/ClientApiVersion"
3613
+ - $ref: "#/components/parameters/ChatId"
3614
+ get:
3615
+ tags: [calls]
3616
+ operationId: getChatCall
3617
+ summary: The chat's call that is not over
3618
+ responses:
3619
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3620
+ "400": { $ref: "#/components/responses/BadRequest" }
3621
+ "200":
3622
+ description: The current call of the chat
3623
+ content:
3624
+ application/json:
3625
+ schema: { $ref: "#/components/schemas/Call" }
3626
+ "401": { $ref: "#/components/responses/Unauthorized" }
3627
+ "404": { $ref: "#/components/responses/NotFound" }
3628
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3629
+ post:
3630
+ tags: [calls]
3631
+ operationId: startChatCall
3632
+ summary: Start a call in the chat, or get the one already running
3633
+ description: |
3634
+ Starts ringing the other members. A chat has at most one call that is not over: when one exists it is
3635
+ returned with `200` and the client joins it instead. `client_request_id` makes retries idempotent for
3636
+ 24 hours. Starting does not join: the caller then calls `POST /calls/{call_id}/join`.
3637
+
3638
+ Refused with `403` (`calls_not_allowed`) when the peer of a direct chat has calls turned off or one user
3639
+ blocked the other, `503` (`calls_unavailable`) when calls are off on the server.
3640
+ requestBody:
3641
+ required: true
3642
+ content:
3643
+ application/json:
3644
+ schema: { $ref: "#/components/schemas/StartCallRequest" }
3645
+ responses:
3646
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3647
+ "400": { $ref: "#/components/responses/BadRequest" }
3648
+ "200":
3649
+ description: A call was already running in the chat
3650
+ content:
3651
+ application/json:
3652
+ schema: { $ref: "#/components/schemas/Call" }
3653
+ "201":
3654
+ description: The new call, ringing
3655
+ content:
3656
+ application/json:
3657
+ schema: { $ref: "#/components/schemas/Call" }
3658
+ "401": { $ref: "#/components/responses/Unauthorized" }
3659
+ "403": { $ref: "#/components/responses/Forbidden" }
3660
+ "404": { $ref: "#/components/responses/NotFound" }
3661
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3662
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3663
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3664
+ /calls/{call_id}:
3665
+ parameters:
3666
+ - $ref: "#/components/parameters/ClientVersion"
3667
+ - $ref: "#/components/parameters/ClientApiVersion"
3668
+ - $ref: "#/components/parameters/CallId"
3669
+ get:
3670
+ tags: [calls]
3671
+ operationId: getCall
3672
+ summary: A call of one of the user's chats
3673
+ description: Ended calls stay readable for 90 days.
3674
+ responses:
3675
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3676
+ "400": { $ref: "#/components/responses/BadRequest" }
3677
+ "200":
3678
+ description: The call
3679
+ content:
3680
+ application/json:
3681
+ schema: { $ref: "#/components/schemas/Call" }
3682
+ "401": { $ref: "#/components/responses/Unauthorized" }
3683
+ "404": { $ref: "#/components/responses/NotFound" }
3684
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3685
+ /calls/{call_id}/join:
3686
+ parameters:
3687
+ - $ref: "#/components/parameters/ClientVersion"
3688
+ - $ref: "#/components/parameters/ClientApiVersion"
3689
+ - $ref: "#/components/parameters/CallId"
3690
+ post:
3691
+ tags: [calls]
3692
+ operationId: joinCall
3693
+ summary: Answer or join a call with this session
3694
+ description: |
3695
+ Answers a ringing call or joins a running group call, and returns a short-lived media grant for this
3696
+ session. The session must have a call identity (`422`, `call_identity_required`). A user is in at most one
3697
+ call with one session: `409` (`already_in_call`) unless `takeover` is `true`, which moves the user's
3698
+ participation to this session (the other session is removed from the media room). Other `409` codes:
3699
+ `call_ended`, `call_full`. The epoch of the call increases. The body is optional: no body, an empty body
3700
+ and `{}` all join without takeover.
3701
+ requestBody:
3702
+ required: false
3703
+ content:
3704
+ application/json:
3705
+ schema: { $ref: "#/components/schemas/JoinCallRequest" }
3706
+ responses:
3707
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3708
+ "400": { $ref: "#/components/responses/BadRequest" }
3709
+ "200":
3710
+ description: Joined
3711
+ content:
3712
+ application/json:
3713
+ schema: { $ref: "#/components/schemas/CallJoin" }
3714
+ "401": { $ref: "#/components/responses/Unauthorized" }
3715
+ "403": { $ref: "#/components/responses/Forbidden" }
3716
+ "404": { $ref: "#/components/responses/NotFound" }
3717
+ "409": { $ref: "#/components/responses/Conflict" }
3718
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3719
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3720
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3721
+ /calls/{call_id}/grant:
3722
+ parameters:
3723
+ - $ref: "#/components/parameters/ClientVersion"
3724
+ - $ref: "#/components/parameters/ClientApiVersion"
3725
+ - $ref: "#/components/parameters/CallId"
3726
+ post:
3727
+ tags: [calls]
3728
+ operationId: renewCallGrant
3729
+ summary: A fresh media grant for the session that joined
3730
+ description: For reconnecting to the media server. Only the session that joined gets one (`409` otherwise).
3731
+ responses:
3732
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3733
+ "400": { $ref: "#/components/responses/BadRequest" }
3734
+ "200":
3735
+ description: The grant
3736
+ content:
3737
+ application/json:
3738
+ schema: { $ref: "#/components/schemas/CallGrant" }
3739
+ "401": { $ref: "#/components/responses/Unauthorized" }
3740
+ "404": { $ref: "#/components/responses/NotFound" }
3741
+ "409": { $ref: "#/components/responses/Conflict" }
3742
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3743
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3744
+ /calls/{call_id}/decline:
3745
+ parameters:
3746
+ - $ref: "#/components/parameters/ClientVersion"
3747
+ - $ref: "#/components/parameters/ClientApiVersion"
3748
+ - $ref: "#/components/parameters/CallId"
3749
+ post:
3750
+ tags: [calls]
3751
+ operationId: declineCall
3752
+ summary: Decline a ringing call
3753
+ description: |
3754
+ Stops the ringing on all of the user's devices. In a direct call this ends the call (`declined`); in a group
3755
+ call only this user's invitation ends. Declining a call that no longer rings changes nothing.
3756
+ responses:
3757
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3758
+ "400": { $ref: "#/components/responses/BadRequest" }
3759
+ "204":
3760
+ description: Declined
3761
+ "401": { $ref: "#/components/responses/Unauthorized" }
3762
+ "404": { $ref: "#/components/responses/NotFound" }
3763
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3764
+ /calls/{call_id}/leave:
3765
+ parameters:
3766
+ - $ref: "#/components/parameters/ClientVersion"
3767
+ - $ref: "#/components/parameters/ClientApiVersion"
3768
+ - $ref: "#/components/parameters/CallId"
3769
+ post:
3770
+ tags: [calls]
3771
+ operationId: leaveCall
3772
+ summary: Leave the call
3773
+ description: |
3774
+ A direct call ends when either side leaves. A group call ends when the last participant has left and the
3775
+ short reconnect grace has passed. The caller leaving a call nobody answered cancels it (`cancelled`).
3776
+ responses:
3777
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3778
+ "400": { $ref: "#/components/responses/BadRequest" }
3779
+ "204":
3780
+ description: Left
3781
+ "401": { $ref: "#/components/responses/Unauthorized" }
3782
+ "404": { $ref: "#/components/responses/NotFound" }
3783
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3784
+ /calls/{call_id}/end:
1813
3785
  parameters:
1814
- - name: chatId
1815
- in: path
1816
- required: true
1817
- schema:
1818
- $ref: "#/components/schemas/Id"
1819
- put:
1820
- tags:
1821
- - me
1822
- operationId: setNotificationMute
1823
- summary: Mute or unmute a chat
1824
- requestBody:
1825
- required: true
1826
- content:
1827
- application/json:
1828
- schema:
1829
- $ref: "#/components/schemas/NotificationMuteRequest"
3786
+ - $ref: "#/components/parameters/ClientVersion"
3787
+ - $ref: "#/components/parameters/ClientApiVersion"
3788
+ - $ref: "#/components/parameters/CallId"
3789
+ post:
3790
+ tags: [calls]
3791
+ operationId: endCall
3792
+ summary: End the call for everyone
3793
+ description: |
3794
+ Allowed for the initiator, for both members of a direct call, and for the owner, admins and moderators of a
3795
+ group (`403` otherwise). Everyone is removed from the media room.
1830
3796
  responses:
3797
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3798
+ "400": { $ref: "#/components/responses/BadRequest" }
1831
3799
  "204":
1832
- description: Saved
1833
- "400":
1834
- $ref: "#/components/responses/BadRequest"
1835
- "401":
1836
- $ref: "#/components/responses/Unauthorized"
1837
- "404":
1838
- $ref: "#/components/responses/NotFound"
1839
- "409":
1840
- $ref: "#/components/responses/Conflict"
1841
- /me/notification-devices/{id}/activity:
3800
+ description: Ended
3801
+ "401": { $ref: "#/components/responses/Unauthorized" }
3802
+ "403": { $ref: "#/components/responses/Forbidden" }
3803
+ "404": { $ref: "#/components/responses/NotFound" }
3804
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3805
+ /calls/{call_id}/keys:
1842
3806
  parameters:
1843
- - name: id
1844
- in: path
1845
- required: true
1846
- schema:
1847
- type: string
1848
- format: uuid
1849
- put:
1850
- tags:
1851
- - me
1852
- operationId: updateNotificationActivity
1853
- summary: Report a visible client with a healthy live connection
3807
+ - $ref: "#/components/parameters/ClientVersion"
3808
+ - $ref: "#/components/parameters/ClientApiVersion"
3809
+ - $ref: "#/components/parameters/CallId"
3810
+ get:
3811
+ tags: [calls]
3812
+ operationId: getCallKeys
3813
+ summary: Key envelopes addressed to this session in the current epoch
3814
+ description: For catching up after a reconnect; the same envelopes also arrive as `call_keys` events.
3815
+ responses:
3816
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3817
+ "400": { $ref: "#/components/responses/BadRequest" }
3818
+ "200":
3819
+ description: The envelopes
3820
+ content:
3821
+ application/json:
3822
+ schema: { $ref: "#/components/schemas/CallKeyEnvelopeList" }
3823
+ "401": { $ref: "#/components/responses/Unauthorized" }
3824
+ "404": { $ref: "#/components/responses/NotFound" }
3825
+ "409": { $ref: "#/components/responses/Conflict" }
3826
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3827
+ post:
3828
+ tags: [calls]
3829
+ operationId: sendCallKeys
3830
+ summary: Send this session's sealed sender key to the other participants
3831
+ description: |
3832
+ Relays opaque HPKE envelopes (see `docs/calls-e2ee.md`). Only the session that joined may send, only for the
3833
+ current epoch (`409`, `stale_epoch`), and only to sessions on the roster of that epoch (`422`). The server
3834
+ never sees a plaintext key.
1854
3835
  requestBody:
1855
3836
  required: true
1856
3837
  content:
1857
3838
  application/json:
1858
- schema:
1859
- $ref: "#/components/schemas/NotificationActivity"
3839
+ schema: { $ref: "#/components/schemas/SendCallKeysRequest" }
1860
3840
  responses:
3841
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3842
+ "400": { $ref: "#/components/responses/BadRequest" }
1861
3843
  "204":
1862
- description: Saved
1863
- "400":
1864
- $ref: "#/components/responses/BadRequest"
1865
- "401":
1866
- $ref: "#/components/responses/Unauthorized"
1867
- "404":
1868
- $ref: "#/components/responses/NotFound"
1869
- "409":
1870
- $ref: "#/components/responses/Conflict"
3844
+ description: Relayed
3845
+ "401": { $ref: "#/components/responses/Unauthorized" }
3846
+ "404": { $ref: "#/components/responses/NotFound" }
3847
+ "409": { $ref: "#/components/responses/Conflict" }
3848
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3849
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3850
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
1871
3851
 
1872
3852
  components:
1873
3853
  securitySchemes:
@@ -1888,6 +3868,12 @@ components:
1888
3868
  schema: { type: string }
1889
3869
 
1890
3870
  parameters:
3871
+ QrLoginRequestId:
3872
+ name: requestId
3873
+ in: path
3874
+ required: true
3875
+ description: ID of a QR sign-in request, from the QR code link `/qr/<request_id>`.
3876
+ schema: { type: string, minLength: 32, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" }
1891
3877
  Limit:
1892
3878
  name: limit
1893
3879
  in: query
@@ -1923,11 +3909,21 @@ components:
1923
3909
  in: path
1924
3910
  required: true
1925
3911
  schema: { $ref: "#/components/schemas/AttachmentRef" }
3912
+ StickerPackId:
3913
+ name: pack_id
3914
+ in: path
3915
+ required: true
3916
+ schema: { $ref: "#/components/schemas/Id" }
1926
3917
  SessionId:
1927
3918
  name: session_id
1928
3919
  in: path
1929
3920
  required: true
1930
3921
  schema: { type: string, format: uuid }
3922
+ CallId:
3923
+ name: call_id
3924
+ in: path
3925
+ required: true
3926
+ schema: { $ref: "#/components/schemas/Id" }
1931
3927
 
1932
3928
  ClientVersion:
1933
3929
  name: X-Client-Version
@@ -1958,6 +3954,17 @@ components:
1958
3954
  content:
1959
3955
  application/problem+json:
1960
3956
  schema: { $ref: "#/components/schemas/Problem" }
3957
+ TwoFactorRequired:
3958
+ description: |
3959
+ Missing, invalid or expired credentials, or `code: two_factor_required`. `two_factor_required` means every
3960
+ other credential in the request was valid, the account has two-factor on, and no `code` was sent. Nothing
3961
+ single-use (recovery key, email token, recovery request) was consumed: send the same request again with
3962
+ `code`. Invalid other credentials get the usual error of the operation instead, whatever the two-factor
3963
+ state, and a wrong `code` keeps its usual error. On operations that need an access token this 401 does not
3964
+ mean the session is lost; tell the two apart by `code`.
3965
+ content:
3966
+ application/problem+json:
3967
+ schema: { $ref: "#/components/schemas/Problem" }
1961
3968
  Forbidden:
1962
3969
  description: Authenticated but not allowed
1963
3970
  content:
@@ -1997,6 +4004,18 @@ components:
1997
4004
  content:
1998
4005
  application/problem+json:
1999
4006
  schema: { $ref: "#/components/schemas/Problem" }
4007
+ CallsUnavailable:
4008
+ description: |
4009
+ Calls are switched off on the server, or the server is at its call capacity (both `calls_unavailable`), or
4010
+ the media service or a store is away for a moment (`internal_error`). Retry after `Retry-After` when it is
4011
+ present; without it calls stay off until `GET /calls/config` reports them enabled.
4012
+ headers:
4013
+ Retry-After:
4014
+ description: Seconds until a retry may succeed
4015
+ schema: { type: integer, minimum: 0 }
4016
+ content:
4017
+ application/problem+json:
4018
+ schema: { $ref: "#/components/schemas/Problem" }
2000
4019
 
2001
4020
  schemas:
2002
4021
  NotificationPreferences:
@@ -2149,6 +4168,15 @@ components:
2149
4168
  - invalid_client_version
2150
4169
  - blocked_by_user
2151
4170
  - approval_required
4171
+ - user_verification_required
4172
+ - session_too_new
4173
+ - calls_unavailable
4174
+ - calls_not_allowed
4175
+ - call_identity_required
4176
+ - call_full
4177
+ - call_ended
4178
+ - already_in_call
4179
+ - stale_epoch
2152
4180
  - internal_error
2153
4181
  Problem:
2154
4182
  type: object
@@ -2259,20 +4287,25 @@ components:
2259
4287
  type: array
2260
4288
  items:
2261
4289
  type: object
2262
- required: [id, type, created_at]
4290
+ required: [id, type, created_at, location]
2263
4291
  properties:
2264
4292
  id: { $ref: "#/components/schemas/Id" }
2265
4293
  type: { type: string }
2266
4294
  created_at: { type: string, format: date-time }
4295
+ user_agent: { type: [string, "null"], maxLength: 512 }
4296
+ location:
4297
+ description: Approximate location of the client when the event happened; `null` when unknown.
4298
+ oneOf:
4299
+ - $ref: "#/components/schemas/Location"
4300
+ - type: "null"
2267
4301
  RegisterResponse:
2268
4302
  allOf:
2269
4303
  - $ref: "#/components/schemas/TokenResponse"
2270
4304
  - type: object
2271
- description: Recovery parts of the temporary recovery flow (redesigned in release 1.1).
4305
+ description: The one-time recovery key shown after registration.
2272
4306
  properties:
2273
4307
  recovery_key: { type: string, description: Shown once; only a keyed hash is stored }
2274
- device_part: { type: string }
2275
- qr_part: { type: string }
4308
+ username: { $ref: "#/components/schemas/Username" }
2276
4309
  TwoFactorChallenge:
2277
4310
  type: object
2278
4311
  required: [two_factor_required, login_challenge]
@@ -2283,24 +4316,6 @@ components:
2283
4316
  oneOf:
2284
4317
  - $ref: "#/components/schemas/TokenResponse"
2285
4318
  - $ref: "#/components/schemas/TwoFactorChallenge"
2286
- RecoveryRequest:
2287
- type: object
2288
- required: [username]
2289
- properties:
2290
- username: { $ref: "#/components/schemas/Username" }
2291
- device_part: { type: string }
2292
- qr_part: { type: string }
2293
- RecoveryResponse:
2294
- type: object
2295
- required: [recovery_token]
2296
- properties:
2297
- recovery_token: { type: string }
2298
- ResetPasswordRequest:
2299
- type: object
2300
- required: [recovery_token, new_password]
2301
- properties:
2302
- recovery_token: { type: string }
2303
- new_password: { type: string, minLength: 8, maxLength: 128, writeOnly: true }
2304
4319
  WebSocketTicket:
2305
4320
  type: object
2306
4321
  required: [ticket, expires_in]
@@ -2347,7 +4362,7 @@ components:
2347
4362
  session_duration_days: { type: integer, minimum: 1, maximum: 365 }
2348
4363
  Session:
2349
4364
  type: object
2350
- required: [id, created_at, last_used_at, is_current]
4365
+ required: [id, created_at, last_used_at, is_current, location]
2351
4366
  properties:
2352
4367
  id: { type: string, format: uuid }
2353
4368
  device:
@@ -2357,6 +4372,25 @@ components:
2357
4372
  last_used_at: { $ref: "#/components/schemas/Timestamp" }
2358
4373
  expires_at: { $ref: "#/components/schemas/Timestamp" }
2359
4374
  is_current: { type: boolean }
4375
+ location:
4376
+ description: Approximate location of the device when it signed in or last refreshed its token; `null` when unknown.
4377
+ oneOf:
4378
+ - $ref: "#/components/schemas/Location"
4379
+ - type: "null"
4380
+ Location:
4381
+ type: object
4382
+ description: |
4383
+ Approximate location of a client address, looked up in an offline GeoIP database (IP geolocation by
4384
+ DB-IP, https://db-ip.com, CC BY 4.0). The address itself is never exposed. Each field is `null` when the
4385
+ database does not know it; clients localise the country name from `country_code`.
4386
+ required: [city, country_code, country]
4387
+ properties:
4388
+ city: { type: [string, "null"], description: City name in English }
4389
+ country_code:
4390
+ type: [string, "null"]
4391
+ pattern: "^[A-Z]{2}$"
4392
+ description: ISO 3166-1 alpha-2 country code
4393
+ country: { type: [string, "null"], description: Country name in English }
2360
4394
  TwoFactorSetup:
2361
4395
  type: object
2362
4396
  required: [secret, otpauth_uri]
@@ -2378,7 +4412,7 @@ components:
2378
4412
  description: One-time codes for signing in without the authenticator app. Shown only once.
2379
4413
  DisableTwoFactorRequest:
2380
4414
  type: object
2381
- required: [password, code]
4415
+ required: [password]
2382
4416
  properties:
2383
4417
  password: { type: string, maxLength: 128, writeOnly: true }
2384
4418
  code:
@@ -2387,7 +4421,9 @@ components:
2387
4421
  description: A code of the authenticator app, or an unused recovery code.
2388
4422
  Visibility:
2389
4423
  type: string
2390
- description: Who may see the item. `*_except` scopes use the exception lists.
4424
+ description: |
4425
+ Who may see the item. The exception lists apply to every value; `*_except` behave like `everyone` and `nobody`.
4426
+ `contacts` are the users you share a group with, or a direct chat that you opened or read in.
2391
4427
  enum: [everyone, contacts, everyone_except, nobody_except, nobody]
2392
4428
  DirectMessagePolicy:
2393
4429
  type: string
@@ -2400,7 +4436,7 @@ components:
2400
4436
  enum: [everyone, nobody]
2401
4437
  PrivacyExceptions:
2402
4438
  type: object
2403
- description: User IDs per setting; `allow` applies to `nobody_except`, `deny` to `everyone_except`.
4439
+ description: User IDs per setting. An exception wins over the setting whatever its value; `allow` always lets the user in, `deny` always keeps them out.
2404
4440
  additionalProperties:
2405
4441
  type: object
2406
4442
  required: [allow, deny]
@@ -2421,6 +4457,8 @@ components:
2421
4457
  - direct_messages
2422
4458
  - group_invites
2423
4459
  - search_visibility
4460
+ - calls_enabled
4461
+ - typing_indicators_enabled
2424
4462
  - exceptions
2425
4463
  properties:
2426
4464
  avatar_visibility: { $ref: "#/components/schemas/Visibility" }
@@ -2430,6 +4468,12 @@ components:
2430
4468
  direct_messages: { $ref: "#/components/schemas/DirectMessagePolicy" }
2431
4469
  group_invites: { $ref: "#/components/schemas/GroupInvitePolicy" }
2432
4470
  search_visibility: { $ref: "#/components/schemas/SearchVisibility" }
4471
+ calls_enabled:
4472
+ type: boolean
4473
+ description: Whether others may ring this user. Calls are only possible from an existing direct chat or a shared group.
4474
+ typing_indicators_enabled:
4475
+ type: boolean
4476
+ description: Whether other members see that this user is typing or recording a voice message. The user still sees theirs.
2433
4477
  exceptions: { $ref: "#/components/schemas/PrivacyExceptions" }
2434
4478
  UpdatePrivacySettingsRequest:
2435
4479
  type: object
@@ -2442,6 +4486,8 @@ components:
2442
4486
  direct_messages: { $ref: "#/components/schemas/DirectMessagePolicy" }
2443
4487
  group_invites: { $ref: "#/components/schemas/GroupInvitePolicy" }
2444
4488
  search_visibility: { $ref: "#/components/schemas/SearchVisibility" }
4489
+ calls_enabled: { type: boolean }
4490
+ typing_indicators_enabled: { type: boolean }
2445
4491
  PrivacyExceptionsRequest:
2446
4492
  type: object
2447
4493
  required: [user_ids]
@@ -2465,7 +4511,7 @@ components:
2465
4511
  description: The requesting user's own name for this user, if set.
2466
4512
  avatar_url:
2467
4513
  type: [string, "null"]
2468
- description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
4514
+ description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
2469
4515
  bio: { type: [string, "null"] }
2470
4516
  is_online: { type: boolean }
2471
4517
  last_seen:
@@ -2548,18 +4594,151 @@ components:
2548
4594
  width: { type: [integer, "null"], minimum: 1 }
2549
4595
  height: { type: [integer, "null"], minimum: 1 }
2550
4596
  thumbnail_url: { type: [string, "null"], readOnly: true }
4597
+ display_url:
4598
+ type: [string, "null"]
4599
+ readOnly: true
4600
+ description: A JPEG of at most 1600 px to show in an image viewer instead of the original; `null` for small images and GIFs, which are shown as they are.
2551
4601
  duration_ms: { type: [integer, "null"], minimum: 0 }
2552
4602
  waveform:
2553
4603
  type: [array, "null"]
2554
4604
  items: { type: integer, minimum: 0, maximum: 255 }
4605
+ drawing:
4606
+ description: |
4607
+ What the sender drew on this image of this message. Clients show the image with the drawing on top
4608
+ and never without it. Absent when the image has no drawing. The same image can carry another drawing
4609
+ in another message.
4610
+ $ref: "#/components/schemas/Drawing"
4611
+ Drawing:
4612
+ type: object
4613
+ description: |
4614
+ Strokes and text labels on an image. Coordinates, widths and sizes are fractions of the image as it is
4615
+ shown (0 is the left or top edge, 1 the right or bottom edge), so the drawing fits any display size.
4616
+ Items are drawn in order. The server rounds numbers to four decimals.
4617
+ required: [version, items]
4618
+ additionalProperties: false
4619
+ properties:
4620
+ version: { type: integer, minimum: 1, maximum: 1 }
4621
+ items:
4622
+ type: array
4623
+ minItems: 1
4624
+ maxItems: 200
4625
+ items: { $ref: "#/components/schemas/DrawingItem" }
4626
+ DrawingItem:
4627
+ type: object
4628
+ required: [type, color]
4629
+ additionalProperties: false
4630
+ properties:
4631
+ type:
4632
+ type: string
4633
+ enum: [stroke, text]
4634
+ color:
4635
+ type: string
4636
+ pattern: "^#[0-9a-fA-F]{6}$"
4637
+ width:
4638
+ type: number
4639
+ format: double
4640
+ minimum: 0.001
4641
+ maximum: 0.2
4642
+ description: Stroke only. Line width as a fraction of the image width.
4643
+ points:
4644
+ type: array
4645
+ minItems: 2
4646
+ maxItems: 10000
4647
+ description: Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes.
4648
+ items: { type: number, format: double, minimum: 0, maximum: 1 }
4649
+ x: { type: number, format: double, minimum: 0, maximum: 1, description: Text only. Left edge of the label. }
4650
+ y: { type: number, format: double, minimum: 0, maximum: 1, description: Text only. Top edge of the label. }
4651
+ size:
4652
+ type: number
4653
+ format: double
4654
+ minimum: 0.01
4655
+ maximum: 0.5
4656
+ description: Text only. Font height as a fraction of the image height.
4657
+ text: { type: string, minLength: 1, maxLength: 200, description: Text only. }
4658
+ if:
4659
+ properties:
4660
+ type: { const: stroke }
4661
+ then:
4662
+ required: [width, points]
4663
+ properties:
4664
+ width: { type: number }
4665
+ points: { type: array }
4666
+ x: { not: {} }
4667
+ y: { not: {} }
4668
+ size: { not: {} }
4669
+ text: { not: {} }
4670
+ else:
4671
+ required: [x, y, size, text]
4672
+ properties:
4673
+ x: { type: number }
4674
+ y: { type: number }
4675
+ size: { type: number }
4676
+ text: { type: string }
4677
+ width: { not: {} }
4678
+ points: { not: {} }
4679
+ AttachmentDrawing:
4680
+ type: object
4681
+ required: [attachment_id, drawing]
4682
+ additionalProperties: false
4683
+ properties:
4684
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
4685
+ drawing: { $ref: "#/components/schemas/Drawing" }
2555
4686
  MediaKind:
2556
4687
  type: string
2557
- enum: [image, audio]
4688
+ enum: [image, audio, visual]
2558
4689
 
2559
4690
  # -------------------------------------------------------- messages
2560
4691
  MessageType:
2561
4692
  type: string
2562
- enum: [text, file, voice, system]
4693
+ enum: [text, file, voice, system, sticker]
4694
+ Sticker:
4695
+ type: object
4696
+ description: |
4697
+ One sticker of a pack. `image` is a WebP or PNG of at most 512 x 512 px with transparency, animated when
4698
+ `is_animated` is true; any signed-in user can load it. Clients show it without a bubble.
4699
+ required: [id, pack_id, emoji, is_animated, image]
4700
+ properties:
4701
+ id: { $ref: "#/components/schemas/Id" }
4702
+ pack_id: { $ref: "#/components/schemas/Id" }
4703
+ emoji:
4704
+ type: string
4705
+ minLength: 1
4706
+ maxLength: 32
4707
+ description: The emoji the sticker stands for, for previews, notifications and search.
4708
+ is_animated: { type: boolean }
4709
+ image: { $ref: "#/components/schemas/Attachment" }
4710
+ StickerPack:
4711
+ type: object
4712
+ required: [id, title, is_official, is_installed, stickers]
4713
+ properties:
4714
+ id: { $ref: "#/components/schemas/Id" }
4715
+ title: { type: string, minLength: 1, maxLength: 64 }
4716
+ is_official:
4717
+ type: boolean
4718
+ description: A built-in pack of the messenger, not made by a user.
4719
+ is_installed:
4720
+ type: boolean
4721
+ description: The pack is in the user's sticker panel.
4722
+ stickers:
4723
+ type: array
4724
+ maxItems: 120
4725
+ items: { $ref: "#/components/schemas/Sticker" }
4726
+ StickerPackList:
4727
+ type: object
4728
+ required: [items]
4729
+ properties:
4730
+ items:
4731
+ type: array
4732
+ maxItems: 200
4733
+ items: { $ref: "#/components/schemas/StickerPack" }
4734
+ StickerList:
4735
+ type: object
4736
+ required: [items]
4737
+ properties:
4738
+ items:
4739
+ type: array
4740
+ maxItems: 20
4741
+ items: { $ref: "#/components/schemas/Sticker" }
2563
4742
  Reaction:
2564
4743
  type: object
2565
4744
  required: [emoji, user_id]
@@ -2582,6 +4761,29 @@ components:
2582
4761
  - $ref: "#/components/schemas/Id"
2583
4762
  - type: "null"
2584
4763
  sender_name: { type: string }
4764
+ ReplyPreview:
4765
+ type: object
4766
+ description: |
4767
+ What a reply shows of the message it answers, so a client can draw the quote without loading that
4768
+ message. Set on messages of history pages and `message` events when the recipient can see the answered
4769
+ message; absent when it is gone or hidden for them, and on chat-list previews and search results.
4770
+ required: [id, type, sender, content, attachment, is_deleted]
4771
+ properties:
4772
+ id: { $ref: "#/components/schemas/Id" }
4773
+ type: { $ref: "#/components/schemas/MessageType" }
4774
+ sender:
4775
+ oneOf:
4776
+ - $ref: "#/components/schemas/User"
4777
+ - type: "null"
4778
+ content:
4779
+ type: [string, "null"]
4780
+ maxLength: 100
4781
+ description: The first 100 characters of the text or caption; `null` when deleted or empty.
4782
+ attachment:
4783
+ oneOf:
4784
+ - $ref: "#/components/schemas/Attachment"
4785
+ - type: "null"
4786
+ is_deleted: { type: boolean }
2585
4787
  Message:
2586
4788
  type: object
2587
4789
  required:
@@ -2610,7 +4812,7 @@ components:
2610
4812
  content:
2611
4813
  type: [string, "null"]
2612
4814
  maxLength: 4096
2613
- description: Text, or the caption of a file; `null` when deleted.
4815
+ description: Text, the caption of a file, or the emoji of a sticker; `null` when deleted.
2614
4816
  attachment:
2615
4817
  oneOf:
2616
4818
  - $ref: "#/components/schemas/Attachment"
@@ -2619,10 +4821,23 @@ components:
2619
4821
  oneOf:
2620
4822
  - $ref: "#/components/schemas/Id"
2621
4823
  - type: "null"
4824
+ reply_preview:
4825
+ $ref: "#/components/schemas/ReplyPreview"
2622
4826
  forwarded_from:
2623
4827
  oneOf:
2624
4828
  - $ref: "#/components/schemas/ForwardedFrom"
2625
4829
  - type: "null"
4830
+ sticker:
4831
+ description: |
4832
+ The sticker of a `sticker` message; absent for other types and when deleted. `attachment` carries the
4833
+ same image, so older clients show a sticker as a picture.
4834
+ $ref: "#/components/schemas/Sticker"
4835
+ attachments:
4836
+ type: array
4837
+ description: Ordered images and videos of an album. The first item is also returned as attachment for older clients.
4838
+ minItems: 2
4839
+ maxItems: 10
4840
+ items: { $ref: "#/components/schemas/Attachment" }
2626
4841
  reactions:
2627
4842
  type: array
2628
4843
  items: { $ref: "#/components/schemas/Reaction" }
@@ -2635,7 +4850,53 @@ components:
2635
4850
  - $ref: "#/components/schemas/Timestamp"
2636
4851
  - type: "null"
2637
4852
  is_deleted: { type: boolean }
4853
+ system_event:
4854
+ $ref: "#/components/schemas/SystemEvent"
2638
4855
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
4856
+ LinkPreview:
4857
+ type: object
4858
+ required: [url, title, description, site_name, image]
4859
+ properties:
4860
+ url:
4861
+ type: string
4862
+ description: The page after redirects
4863
+ title: { type: [string, "null"], maxLength: 300 }
4864
+ description: { type: [string, "null"], maxLength: 500 }
4865
+ site_name: { type: [string, "null"], maxLength: 100 }
4866
+ image:
4867
+ oneOf:
4868
+ - $ref: "#/components/schemas/LinkPreviewImage"
4869
+ - type: "null"
4870
+ LinkPreviewImage:
4871
+ type: object
4872
+ required: [url, width, height]
4873
+ properties:
4874
+ url:
4875
+ type: string
4876
+ description: "`GET /link-preview/image` with the signed address of the page's image"
4877
+ width: { type: [integer, "null"], minimum: 1 }
4878
+ height: { type: [integer, "null"], minimum: 1 }
4879
+ SystemEventKind:
4880
+ type: string
4881
+ enum: [group_created, member_added, member_joined, member_removed, member_left, call]
4882
+ SystemEvent:
4883
+ type: object
4884
+ description: |
4885
+ What a `system` message records; set on system messages only, whose `content` is then `null`. The names
4886
+ are the display names at the time of the event. `target` fields are set for `member_added` and
4887
+ `member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the
4888
+ initiator.
4889
+ required: [kind, actor_id, actor_name]
4890
+ properties:
4891
+ kind: { $ref: "#/components/schemas/SystemEventKind" }
4892
+ actor_id:
4893
+ oneOf:
4894
+ - $ref: "#/components/schemas/Id"
4895
+ - type: "null"
4896
+ actor_name: { type: string }
4897
+ target_id: { $ref: "#/components/schemas/Id" }
4898
+ target_name: { type: string }
4899
+ call: { $ref: "#/components/schemas/CallSummary" }
2639
4900
  MessagePage:
2640
4901
  type: object
2641
4902
  required: [items, next_cursor, prev_cursor]
@@ -2683,36 +4944,84 @@ components:
2683
4944
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
2684
4945
  type:
2685
4946
  type: string
2686
- enum: [text, file, voice]
4947
+ enum: [text, file, voice, sticker]
2687
4948
  content:
2688
4949
  type: [string, "null"]
2689
4950
  maxLength: 4096
4951
+ sticker_id:
4952
+ description: |
4953
+ The sticker of a `sticker` message, from any pack that is not deleted. Sticker messages have no content,
4954
+ attachment or drawings; the server sets `content` to the sticker's emoji. Send stickers with this
4955
+ operation; the WebSocket `message` event does not take them.
4956
+ $ref: "#/components/schemas/Id"
2690
4957
  attachment_id:
2691
- description: Required and not null for `file` and `voice`; never a URL.
4958
+ description: Single upload ID for a file or voice message. Omit for albums.
2692
4959
  oneOf:
2693
4960
  - $ref: "#/components/schemas/AttachmentRef"
2694
4961
  - type: "null"
4962
+ attachment_ids:
4963
+ type: array
4964
+ description: Ordered IDs of two to ten image or video uploads for one file message.
4965
+ minItems: 2
4966
+ maxItems: 10
4967
+ uniqueItems: true
4968
+ items: { $ref: "#/components/schemas/AttachmentRef" }
2695
4969
  reply_to:
2696
4970
  oneOf:
2697
4971
  - $ref: "#/components/schemas/Id"
2698
4972
  - type: "null"
4973
+ drawings:
4974
+ type: array
4975
+ description: |
4976
+ Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the
4977
+ message's attachments. An image with a drawing may also be an image of the message in `reply_to`
4978
+ instead of the sender's own upload: that is how a member draws on an image someone sent.
4979
+ maxItems: 10
4980
+ items: { $ref: "#/components/schemas/AttachmentDrawing" }
2699
4981
  if:
2700
4982
  properties:
2701
4983
  type: { enum: [file, voice] }
2702
4984
  then:
2703
- required: [attachment_id]
2704
4985
  properties:
2705
- attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
4986
+ sticker_id: { not: {} }
4987
+ oneOf:
4988
+ - required: [attachment_id]
4989
+ properties:
4990
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
4991
+ attachment_ids: { not: {} }
4992
+ - required: [attachment_ids]
4993
+ properties:
4994
+ type: { const: file }
4995
+ attachment_id: { not: {} }
4996
+ attachment_ids: { type: array }
2706
4997
  else:
2707
- required: [content]
2708
- properties:
2709
- content: { type: string, minLength: 1, maxLength: 4096 }
2710
- attachment_id: { not: {} }
4998
+ if:
4999
+ properties:
5000
+ type: { const: sticker }
5001
+ then:
5002
+ required: [sticker_id]
5003
+ properties:
5004
+ sticker_id: { $ref: "#/components/schemas/Id" }
5005
+ content: { not: {} }
5006
+ attachment_id: { not: {} }
5007
+ attachment_ids: { not: {} }
5008
+ drawings: { not: {} }
5009
+ else:
5010
+ required: [content]
5011
+ properties:
5012
+ content: { type: string, minLength: 1, maxLength: 4096 }
5013
+ attachment_id: { not: {} }
5014
+ attachment_ids: { not: {} }
5015
+ drawings: { not: {} }
5016
+ sticker_id: { not: {} }
2711
5017
  EditMessageRequest:
2712
5018
  type: object
2713
5019
  required: [content]
2714
5020
  properties:
2715
- content: { type: string, minLength: 1, maxLength: 4096 }
5021
+ content:
5022
+ type: string
5023
+ maxLength: 4096
5024
+ description: New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it.
2716
5025
  ForwardMessageRequest:
2717
5026
  type: object
2718
5027
  required: [chat_ids]
@@ -2723,6 +5032,35 @@ components:
2723
5032
  maxItems: 20
2724
5033
  uniqueItems: true
2725
5034
  items: { $ref: "#/components/schemas/Id" }
5035
+ ForwardMessagesRequest:
5036
+ type: object
5037
+ required: [message_ids, chat_ids]
5038
+ properties:
5039
+ message_ids:
5040
+ type: array
5041
+ minItems: 1
5042
+ maxItems: 20
5043
+ uniqueItems: true
5044
+ items: { $ref: "#/components/schemas/Id" }
5045
+ chat_ids:
5046
+ type: array
5047
+ minItems: 1
5048
+ maxItems: 20
5049
+ uniqueItems: true
5050
+ items: { $ref: "#/components/schemas/Id" }
5051
+ DeleteMessagesRequest:
5052
+ type: object
5053
+ required: [message_ids, scope]
5054
+ properties:
5055
+ message_ids:
5056
+ type: array
5057
+ minItems: 1
5058
+ maxItems: 100
5059
+ uniqueItems: true
5060
+ items: { $ref: "#/components/schemas/Id" }
5061
+ scope:
5062
+ type: string
5063
+ enum: [me, everyone]
2726
5064
  MarkReadRequest:
2727
5065
  type: object
2728
5066
  required: [message_id]
@@ -2737,7 +5075,30 @@ components:
2737
5075
  enum: [direct, group]
2738
5076
  GroupRole:
2739
5077
  type: string
2740
- enum: [owner, admin, member]
5078
+ description: A moderator may delete other members' messages; owners and admins also manage the group.
5079
+ enum: [owner, admin, moderator, member]
5080
+ GroupRoleEvent:
5081
+ type: object
5082
+ description: A member got a new role; `owner` means the actor transferred ownership to them.
5083
+ required: [id, actor, target, role, created_at]
5084
+ properties:
5085
+ id: { $ref: "#/components/schemas/Id" }
5086
+ actor:
5087
+ description: "`null` when the account is gone."
5088
+ oneOf:
5089
+ - $ref: "#/components/schemas/User"
5090
+ - type: "null"
5091
+ target: { $ref: "#/components/schemas/User" }
5092
+ role: { $ref: "#/components/schemas/GroupRole" }
5093
+ created_at: { $ref: "#/components/schemas/Timestamp" }
5094
+ GroupRoleLog:
5095
+ type: object
5096
+ required: [items]
5097
+ properties:
5098
+ items:
5099
+ type: array
5100
+ description: Newest first, at most 100
5101
+ items: { $ref: "#/components/schemas/GroupRoleEvent" }
2741
5102
  Chat:
2742
5103
  type: object
2743
5104
  required:
@@ -2839,7 +5200,7 @@ components:
2839
5200
  properties:
2840
5201
  role:
2841
5202
  type: string
2842
- enum: [admin, member]
5203
+ enum: [admin, moderator, member]
2843
5204
  TransferOwnerRequest:
2844
5205
  type: object
2845
5206
  required: [user_id]
@@ -2868,3 +5229,569 @@ components:
2868
5229
  type: [string, "null"]
2869
5230
  description: First message of a direct-message request
2870
5231
  created_at: { $ref: "#/components/schemas/Timestamp" }
5232
+
5233
+ DeviceRecoveryStart:
5234
+ type: object
5235
+ required:
5236
+ - username
5237
+ properties:
5238
+ username:
5239
+ $ref: "#/components/schemas/Username"
5240
+ DeviceRecoveryResult:
5241
+ type: object
5242
+ required:
5243
+ - request_id
5244
+ - match_number
5245
+ - expires_at
5246
+ properties:
5247
+ request_id:
5248
+ type: string
5249
+ minLength: 32
5250
+ maxLength: 128
5251
+ pattern: ^[A-Za-z0-9_-]+$
5252
+ match_number:
5253
+ type: integer
5254
+ minimum: 10
5255
+ maximum: 99
5256
+ expires_at:
5257
+ type: string
5258
+ format: date-time
5259
+ DeviceRecoveryStatus:
5260
+ type: object
5261
+ required:
5262
+ - status
5263
+ properties:
5264
+ status:
5265
+ type: string
5266
+ enum:
5267
+ - pending
5268
+ - approved
5269
+ - denied
5270
+ - used
5271
+ - expired
5272
+ DeviceRecoveryApproval:
5273
+ type: object
5274
+ required:
5275
+ - match_number
5276
+ properties:
5277
+ match_number:
5278
+ type: integer
5279
+ minimum: 10
5280
+ maximum: 99
5281
+ passkey:
5282
+ $ref: "#/components/schemas/PasskeyVerification"
5283
+ code:
5284
+ type: string
5285
+ maxLength: 128
5286
+ password:
5287
+ type: string
5288
+ maxLength: 1024
5289
+ deprecated: true
5290
+ description: Ignored. Older clients still send it.
5291
+ DeviceRecoveryApprovalOptions:
5292
+ type: object
5293
+ required:
5294
+ - method
5295
+ properties:
5296
+ method:
5297
+ type: string
5298
+ enum: [passkey, session]
5299
+ challenge_id:
5300
+ type: string
5301
+ minLength: 32
5302
+ maxLength: 128
5303
+ description: "Present with `method: passkey`."
5304
+ public_key:
5305
+ type: object
5306
+ additionalProperties: true
5307
+ description: "WebAuthn request options, present with `method: passkey`."
5308
+ approvable_from:
5309
+ type: string
5310
+ format: date-time
5311
+ description: "Present with `method: session` while the session is too new to approve."
5312
+ DeviceRecoveryComplete:
5313
+ type: object
5314
+ required:
5315
+ - new_password
5316
+ properties:
5317
+ new_password:
5318
+ type: string
5319
+ minLength: 8
5320
+ maxLength: 128
5321
+ writeOnly: true
5322
+
5323
+ QrLoginStatus:
5324
+ type: string
5325
+ description: |
5326
+ `pending` until a signed-in device opens the request, `scanned` once it did, then `approved` or `denied`.
5327
+ `expired` when the request timed out or was used (only in poll answers).
5328
+ enum: [pending, scanned, approved, denied, expired]
5329
+ QrLoginStart:
5330
+ type: object
5331
+ required: [request_id, poll_token, url, expires_at]
5332
+ properties:
5333
+ request_id:
5334
+ type: string
5335
+ minLength: 32
5336
+ maxLength: 128
5337
+ pattern: ^[A-Za-z0-9_-]+$
5338
+ poll_token:
5339
+ type: string
5340
+ minLength: 32
5341
+ maxLength: 128
5342
+ pattern: ^[A-Za-z0-9_-]+$
5343
+ description: Secret of the requesting device; only a keyed hash is stored.
5344
+ url:
5345
+ type: string
5346
+ description: "`<RECOVERY_WEB_URL>/qr/<request_id>`, the content of the QR code."
5347
+ expires_at: { $ref: "#/components/schemas/Timestamp" }
5348
+ QrLoginRequest:
5349
+ type: object
5350
+ required: [request_id, status, device, location, created_at, expires_at]
5351
+ properties:
5352
+ request_id: { type: string }
5353
+ status: { $ref: "#/components/schemas/QrLoginStatus" }
5354
+ device:
5355
+ type: [string, "null"]
5356
+ maxLength: 512
5357
+ description: User agent of the device that asks to sign in; `null` when it sent none.
5358
+ location:
5359
+ description: Approximate location of the device that asks to sign in; `null` when unknown.
5360
+ oneOf:
5361
+ - $ref: "#/components/schemas/Location"
5362
+ - type: "null"
5363
+ created_at: { $ref: "#/components/schemas/Timestamp" }
5364
+ expires_at: { $ref: "#/components/schemas/Timestamp" }
5365
+ QrLoginPollRequest:
5366
+ type: object
5367
+ required: [poll_token]
5368
+ properties:
5369
+ poll_token: { type: string, maxLength: 128, writeOnly: true }
5370
+ QrLoginPollResult:
5371
+ oneOf:
5372
+ - type: object
5373
+ required: [status]
5374
+ properties:
5375
+ status:
5376
+ type: string
5377
+ enum: [pending, scanned, denied, expired]
5378
+ - allOf:
5379
+ - $ref: "#/components/schemas/TokenResponse"
5380
+ - type: object
5381
+ required: [status]
5382
+ properties:
5383
+ status: { type: string, const: approved }
5384
+ QrLoginApproval:
5385
+ type: object
5386
+ properties:
5387
+ code:
5388
+ type: string
5389
+ maxLength: 128
5390
+ description: An authenticator code or an unused recovery code; required when two-factor is on.
5391
+
5392
+ PasskeyOptions:
5393
+ type: object
5394
+ required:
5395
+ - challenge_id
5396
+ - public_key
5397
+ properties:
5398
+ challenge_id: &a1
5399
+ type: string
5400
+ minLength: 32
5401
+ maxLength: 128
5402
+ public_key: &a2
5403
+ type: object
5404
+ additionalProperties: true
5405
+ PasskeyRegistration:
5406
+ type: object
5407
+ required:
5408
+ - password
5409
+ - name
5410
+ properties:
5411
+ password: &a4
5412
+ type: string
5413
+ maxLength: 128
5414
+ writeOnly: true
5415
+ code:
5416
+ type: string
5417
+ maxLength: 128
5418
+ name: &a3
5419
+ type: string
5420
+ minLength: 1
5421
+ maxLength: 64
5422
+ PasskeyVerification:
5423
+ type: object
5424
+ required:
5425
+ - challenge_id
5426
+ - credential
5427
+ properties:
5428
+ challenge_id: *a1
5429
+ credential: *a2
5430
+ PasskeyLoginOptions:
5431
+ type: object
5432
+ required: []
5433
+ properties:
5434
+ username:
5435
+ $ref: "#/components/schemas/Username"
5436
+ PasskeyRename:
5437
+ type: object
5438
+ required:
5439
+ - name
5440
+ properties:
5441
+ name: *a3
5442
+ PasskeyRemoval:
5443
+ type: object
5444
+ required: []
5445
+ properties:
5446
+ password: *a4
5447
+ Passkey:
5448
+ type: object
5449
+ required:
5450
+ - id
5451
+ - name
5452
+ - created_at
5453
+ - last_used_at
5454
+ properties:
5455
+ id:
5456
+ type: string
5457
+ name: *a3
5458
+ created_at:
5459
+ type: string
5460
+ format: date-time
5461
+ last_used_at:
5462
+ type:
5463
+ - string
5464
+ - "null"
5465
+ format: date-time
5466
+ PasskeyPage:
5467
+ type: object
5468
+ required:
5469
+ - items
5470
+ properties:
5471
+ items:
5472
+ type: array
5473
+ items:
5474
+ $ref: "#/components/schemas/Passkey"
5475
+
5476
+ RecoveryEmailStatus:
5477
+ type: object
5478
+ required:
5479
+ - address
5480
+ - state
5481
+ - enabled
5482
+ properties:
5483
+ address:
5484
+ type: string
5485
+ state:
5486
+ type: string
5487
+ enum:
5488
+ - not_added
5489
+ - pending
5490
+ - verified
5491
+ enabled:
5492
+ type: boolean
5493
+ RecoveryOverview:
5494
+ type: object
5495
+ required:
5496
+ - recovery_key
5497
+ - other_devices
5498
+ - passkeys
5499
+ - passkeys_enabled
5500
+ - email
5501
+ properties:
5502
+ recovery_key:
5503
+ $ref: "#/components/schemas/RecoveryKeyStatus"
5504
+ other_devices:
5505
+ type: integer
5506
+ minimum: 0
5507
+ passkeys:
5508
+ type: integer
5509
+ minimum: 0
5510
+ passkeys_enabled:
5511
+ type: boolean
5512
+ email:
5513
+ $ref: "#/components/schemas/RecoveryEmailStatus"
5514
+ SetRecoveryEmail:
5515
+ type: object
5516
+ required:
5517
+ - email
5518
+ - password
5519
+ properties:
5520
+ email:
5521
+ type: string
5522
+ format: email
5523
+ maxLength: 254
5524
+ password: &a1
5525
+ type: string
5526
+ minLength: 8
5527
+ maxLength: 128
5528
+ writeOnly: true
5529
+ code: &a2
5530
+ type: string
5531
+ maxLength: 128
5532
+ RemoveRecoveryEmail:
5533
+ type: object
5534
+ required:
5535
+ - password
5536
+ properties:
5537
+ password: *a1
5538
+ code: *a2
5539
+ VerifyRecoveryEmail:
5540
+ type: object
5541
+ required:
5542
+ - token
5543
+ properties:
5544
+ token: &a3
5545
+ type: string
5546
+ minLength: 32
5547
+ maxLength: 128
5548
+ EmailResetRequest:
5549
+ type: object
5550
+ required:
5551
+ - username_or_email
5552
+ properties:
5553
+ username_or_email:
5554
+ type: string
5555
+ maxLength: 254
5556
+ EmailResetConfirmation:
5557
+ type: object
5558
+ required:
5559
+ - token
5560
+ - new_password
5561
+ properties:
5562
+ token: *a3
5563
+ new_password: *a1
5564
+ code: *a2
5565
+ EmailResetAccepted:
5566
+ type: object
5567
+ required:
5568
+ - message
5569
+ properties:
5570
+ message:
5571
+ type: string
5572
+
5573
+ # ----------------------------------------------------------- calls
5574
+ CallConfig:
5575
+ type: object
5576
+ required: [enabled, max_participants, ring_timeout_seconds]
5577
+ properties:
5578
+ enabled: { type: boolean }
5579
+ max_participants:
5580
+ type: integer
5581
+ minimum: 2
5582
+ description: Most sessions joined to one call at the same time.
5583
+ ring_timeout_seconds:
5584
+ type: integer
5585
+ minimum: 1
5586
+ description: How long an invitation rings before it counts as missed.
5587
+ CallIdentityRequest:
5588
+ type: object
5589
+ required: [public_key]
5590
+ properties:
5591
+ public_key: { $ref: "#/components/schemas/CallIdentityKey" }
5592
+ CallIdentityKey:
5593
+ type: string
5594
+ description: |
5595
+ P-256 public key as an uncompressed point (65 bytes, first byte `0x04`), base64url without padding.
5596
+ minLength: 87
5597
+ maxLength: 87
5598
+ pattern: "^[A-Za-z0-9_-]+$"
5599
+ CallState:
5600
+ type: string
5601
+ description: "`ringing` until someone answers, `active` while people are in it, `ended` afterwards."
5602
+ enum: [ringing, active, ended]
5603
+ CallEndReason:
5604
+ type: string
5605
+ description: |
5606
+ Why the call ended: `completed` (people talked), `missed` (nobody answered in time), `declined` (the peer of a
5607
+ direct call declined), `cancelled` (the caller hung up before an answer), `failed` (the media service lost
5608
+ the call).
5609
+ enum: [completed, missed, declined, cancelled, failed]
5610
+ CallParticipantState:
5611
+ type: string
5612
+ description: "`left` and `declined` can become `joined` again in a group call."
5613
+ enum: [ringing, joined, declined, missed, left]
5614
+ CallParticipant:
5615
+ type: object
5616
+ required: [user_id, state, session_id, identity_key, joined_at]
5617
+ properties:
5618
+ user_id: { $ref: "#/components/schemas/Id" }
5619
+ state: { $ref: "#/components/schemas/CallParticipantState" }
5620
+ session_id:
5621
+ description: The session that joined; `null` unless `state` is `joined`.
5622
+ oneOf:
5623
+ - { type: string, format: uuid }
5624
+ - type: "null"
5625
+ identity_key:
5626
+ description: Call identity of the joined session; `null` unless `state` is `joined`.
5627
+ oneOf:
5628
+ - $ref: "#/components/schemas/CallIdentityKey"
5629
+ - type: "null"
5630
+ joined_at:
5631
+ description: When the participant last joined; `null` if never.
5632
+ oneOf:
5633
+ - $ref: "#/components/schemas/Timestamp"
5634
+ - type: "null"
5635
+ Call:
5636
+ type: object
5637
+ required:
5638
+ - id
5639
+ - chat_id
5640
+ - kind
5641
+ - state
5642
+ - end_reason
5643
+ - initiator_id
5644
+ - created_at
5645
+ - started_at
5646
+ - ended_at
5647
+ - ring_expires_at
5648
+ - epoch
5649
+ - version
5650
+ - max_participants
5651
+ - participants
5652
+ properties:
5653
+ id: { $ref: "#/components/schemas/Id" }
5654
+ chat_id: { $ref: "#/components/schemas/Id" }
5655
+ kind:
5656
+ type: string
5657
+ enum: [direct, group]
5658
+ state: { $ref: "#/components/schemas/CallState" }
5659
+ end_reason:
5660
+ oneOf:
5661
+ - $ref: "#/components/schemas/CallEndReason"
5662
+ - type: "null"
5663
+ initiator_id: { $ref: "#/components/schemas/Id" }
5664
+ created_at: { $ref: "#/components/schemas/Timestamp" }
5665
+ started_at:
5666
+ description: First answer; `null` while nobody answered.
5667
+ oneOf:
5668
+ - $ref: "#/components/schemas/Timestamp"
5669
+ - type: "null"
5670
+ ended_at:
5671
+ oneOf:
5672
+ - $ref: "#/components/schemas/Timestamp"
5673
+ - type: "null"
5674
+ ring_expires_at:
5675
+ description: When ringing invitations of this call turn into `missed`.
5676
+ $ref: "#/components/schemas/Timestamp"
5677
+ epoch:
5678
+ type: integer
5679
+ minimum: 0
5680
+ description: Key epoch; increases whenever the set of joined sessions or their identity keys change.
5681
+ version:
5682
+ type: integer
5683
+ minimum: 1
5684
+ description: Increases with every change of the call; ignore events with a lower version than one already seen.
5685
+ max_participants: { type: integer, minimum: 2 }
5686
+ participants:
5687
+ type: array
5688
+ description: Everyone invited or joined, the initiator first.
5689
+ items: { $ref: "#/components/schemas/CallParticipant" }
5690
+ CallList:
5691
+ type: object
5692
+ required: [items]
5693
+ properties:
5694
+ items:
5695
+ type: array
5696
+ items: { $ref: "#/components/schemas/Call" }
5697
+ StartCallRequest:
5698
+ type: object
5699
+ required: [client_request_id]
5700
+ properties:
5701
+ client_request_id:
5702
+ type: string
5703
+ format: uuid
5704
+ description: Idempotency key chosen by the client.
5705
+ JoinCallRequest:
5706
+ type: object
5707
+ properties:
5708
+ takeover:
5709
+ type: boolean
5710
+ default: false
5711
+ description: Move the user's participation from another session to this one.
5712
+ CallGrant:
5713
+ type: object
5714
+ required: [url, token, identity, expires_at]
5715
+ properties:
5716
+ url:
5717
+ type: string
5718
+ description: WebSocket URL of the media server (`wss://`).
5719
+ token:
5720
+ type: string
5721
+ description: Media access token for this call and session only; microphone audio only.
5722
+ identity:
5723
+ type: string
5724
+ description: The participant identity inside the media room (`<user_id>:<session_id>`).
5725
+ expires_at: { $ref: "#/components/schemas/Timestamp" }
5726
+ CallJoin:
5727
+ type: object
5728
+ required: [call, grant]
5729
+ properties:
5730
+ call: { $ref: "#/components/schemas/Call" }
5731
+ grant: { $ref: "#/components/schemas/CallGrant" }
5732
+ CallKeyEnvelope:
5733
+ type: object
5734
+ description: An HPKE Auth-mode envelope carrying one sender key (see `docs/calls-e2ee.md`).
5735
+ required: [epoch, sender_user_id, sender_session_id, recipient_session_id, enc, ciphertext]
5736
+ properties:
5737
+ epoch: { type: integer, minimum: 0 }
5738
+ sender_user_id: { $ref: "#/components/schemas/Id" }
5739
+ sender_session_id: { type: string, format: uuid }
5740
+ recipient_session_id: { type: string, format: uuid }
5741
+ enc:
5742
+ type: string
5743
+ description: HPKE encapsulated key, base64url without padding.
5744
+ maxLength: 128
5745
+ pattern: "^[A-Za-z0-9_-]+$"
5746
+ ciphertext:
5747
+ type: string
5748
+ description: Sealed sender key, base64url without padding.
5749
+ maxLength: 256
5750
+ pattern: "^[A-Za-z0-9_-]+$"
5751
+ CallKeyEnvelopeList:
5752
+ type: object
5753
+ required: [call_id, epoch, items]
5754
+ properties:
5755
+ call_id: { $ref: "#/components/schemas/Id" }
5756
+ epoch: { type: integer, minimum: 0 }
5757
+ items:
5758
+ type: array
5759
+ items: { $ref: "#/components/schemas/CallKeyEnvelope" }
5760
+ SendCallKeysRequest:
5761
+ type: object
5762
+ required: [epoch, envelopes]
5763
+ properties:
5764
+ epoch: { type: integer, minimum: 0 }
5765
+ envelopes:
5766
+ type: array
5767
+ minItems: 1
5768
+ maxItems: 64
5769
+ items: { $ref: "#/components/schemas/OutgoingCallKeyEnvelope" }
5770
+ OutgoingCallKeyEnvelope:
5771
+ type: object
5772
+ required: [recipient_session_id, enc, ciphertext]
5773
+ properties:
5774
+ recipient_session_id: { type: string, format: uuid }
5775
+ enc:
5776
+ type: string
5777
+ maxLength: 128
5778
+ pattern: "^[A-Za-z0-9_-]+$"
5779
+ ciphertext:
5780
+ type: string
5781
+ maxLength: 256
5782
+ pattern: "^[A-Za-z0-9_-]+$"
5783
+ CallSummary:
5784
+ type: object
5785
+ description: The call a `call` system message records.
5786
+ required: [call_id, kind, outcome, duration_seconds]
5787
+ properties:
5788
+ call_id: { $ref: "#/components/schemas/Id" }
5789
+ kind:
5790
+ type: string
5791
+ enum: [direct, group]
5792
+ outcome: { $ref: "#/components/schemas/CallEndReason" }
5793
+ duration_seconds:
5794
+ description: From the first answer to the end; `null` if nobody answered.
5795
+ oneOf:
5796
+ - { type: integer, minimum: 0 }
5797
+ - type: "null"