@myronsi/messenger-api 2.1.0-alpha.2.next.63 → 2.1.0-alpha.21

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.21
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,160 +1784,2290 @@ paths:
1714
1784
  "401": { $ref: "#/components/responses/Unauthorized" }
1715
1785
  "404": { $ref: "#/components/responses/NotFound" }
1716
1786
  "409": { $ref: "#/components/responses/Conflict" }
1717
-
1718
- /me/notifications:
1787
+ /groups/{chat_id}/role-log:
1788
+ parameters:
1789
+ - $ref: "#/components/parameters/ClientVersion"
1790
+ - $ref: "#/components/parameters/ClientApiVersion"
1791
+ - $ref: "#/components/parameters/ChatId"
1719
1792
  get:
1720
- tags:
1721
- - me
1722
- operationId: getNotificationSettings
1723
- summary: Notification preferences and supported push platforms
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.
1724
1797
  responses:
1798
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1799
+ "400": { $ref: "#/components/responses/BadRequest" }
1725
1800
  "200":
1726
- description: Notification settings or registered device
1801
+ description: Role changes
1727
1802
  content:
1728
1803
  application/json:
1729
- schema:
1730
- $ref: "#/components/schemas/NotificationSettings"
1731
- "400":
1732
- $ref: "#/components/responses/BadRequest"
1733
- "401":
1734
- $ref: "#/components/responses/Unauthorized"
1735
- "404":
1736
- $ref: "#/components/responses/NotFound"
1737
- "409":
1738
- $ref: "#/components/responses/Conflict"
1739
- put:
1740
- tags:
1741
- - me
1742
- operationId: updateNotificationSettings
1743
- summary: Replace notification preferences
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. With
1818
+ `owned=true`, the packs the user made instead, newest first, whether in the panel or not.
1819
+ parameters:
1820
+ - name: owned
1821
+ in: query
1822
+ required: false
1823
+ schema: { type: boolean, default: false }
1824
+ responses:
1825
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1826
+ "400": { $ref: "#/components/responses/BadRequest" }
1827
+ "200":
1828
+ description: The packs
1829
+ content:
1830
+ application/json:
1831
+ schema: { $ref: "#/components/schemas/StickerPackList" }
1832
+ "401": { $ref: "#/components/responses/Unauthorized" }
1833
+ post:
1834
+ tags: [stickers]
1835
+ operationId: createStickerPack
1836
+ summary: Create a sticker pack
1837
+ description: |
1838
+ A new, empty pack owned by the user, added to the top of their panel. Its `slug` is the share link
1839
+ (`/stickers/links/{slug}`). At most 50 packs per user (`409 limit_reached`).
1744
1840
  requestBody:
1745
1841
  required: true
1746
1842
  content:
1747
1843
  application/json:
1748
- schema:
1749
- $ref: "#/components/schemas/NotificationPreferences"
1844
+ schema: { $ref: "#/components/schemas/CreateStickerPackRequest" }
1750
1845
  responses:
1751
- "204":
1752
- description: Saved
1753
- "400":
1754
- $ref: "#/components/responses/BadRequest"
1755
- "401":
1756
- $ref: "#/components/responses/Unauthorized"
1757
- "404":
1758
- $ref: "#/components/responses/NotFound"
1759
- "409":
1760
- $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
1846
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1847
+ "400": { $ref: "#/components/responses/BadRequest" }
1848
+ "201":
1849
+ description: The new pack
1850
+ content:
1851
+ application/json:
1852
+ schema: { $ref: "#/components/schemas/StickerPack" }
1853
+ "401": { $ref: "#/components/responses/Unauthorized" }
1854
+ "409": { $ref: "#/components/responses/Conflict" }
1855
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1856
+ /stickers/packs/{pack_id}:
1857
+ parameters:
1858
+ - $ref: "#/components/parameters/ClientVersion"
1859
+ - $ref: "#/components/parameters/ClientApiVersion"
1860
+ - $ref: "#/components/parameters/StickerPackId"
1861
+ get:
1862
+ tags: [stickers]
1863
+ operationId: getStickerPack
1864
+ summary: A sticker pack
1865
+ description: |
1866
+ A built-in pack, the user's own pack, or a user pack the user opened by its link before (`404` otherwise,
1867
+ so packs cannot be found by guessing IDs). To preview the pack of a sticker someone sent, open
1868
+ `Sticker.pack_slug` with `GET /stickers/links/{slug}` instead. `is_installed` tells whether it is in the
1869
+ user's panel. A hidden pack is found only by its owner.
1870
+ responses:
1871
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1872
+ "400": { $ref: "#/components/responses/BadRequest" }
1873
+ "200":
1874
+ description: The pack
1875
+ content:
1876
+ application/json:
1877
+ schema: { $ref: "#/components/schemas/StickerPack" }
1878
+ "401": { $ref: "#/components/responses/Unauthorized" }
1879
+ "404": { $ref: "#/components/responses/NotFound" }
1880
+ patch:
1881
+ tags: [stickers]
1882
+ operationId: updateStickerPack
1883
+ summary: Rename a sticker pack
1884
+ description: Only the owner of the pack (`403` otherwise). Built-in packs cannot be changed.
1767
1885
  requestBody:
1768
1886
  required: true
1769
1887
  content:
1770
1888
  application/json:
1771
- schema:
1772
- $ref: "#/components/schemas/NotificationDeviceRequest"
1889
+ schema: { $ref: "#/components/schemas/UpdateStickerPackRequest" }
1773
1890
  responses:
1891
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1892
+ "400": { $ref: "#/components/responses/BadRequest" }
1774
1893
  "200":
1775
- description: Notification settings or registered device
1894
+ description: The pack
1776
1895
  content:
1777
1896
  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:
1790
- - name: id
1791
- in: path
1792
- required: true
1793
- schema:
1794
- type: string
1795
- format: uuid
1897
+ schema: { $ref: "#/components/schemas/StickerPack" }
1898
+ "401": { $ref: "#/components/responses/Unauthorized" }
1899
+ "403": { $ref: "#/components/responses/Forbidden" }
1900
+ "404": { $ref: "#/components/responses/NotFound" }
1901
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1796
1902
  delete:
1797
- tags:
1798
- - me
1799
- operationId: deleteNotificationDevice
1800
- summary: Unregister a push destination for the current session
1903
+ tags: [stickers]
1904
+ operationId: deleteStickerPack
1905
+ summary: Delete a sticker pack
1906
+ description: |
1907
+ Only the owner. The pack leaves every panel and its link stops working; stickers already sent from it keep
1908
+ showing in chats.
1801
1909
  responses:
1910
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1911
+ "400": { $ref: "#/components/responses/BadRequest" }
1802
1912
  "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:
1913
+ description: Deleted
1914
+ "401": { $ref: "#/components/responses/Unauthorized" }
1915
+ "403": { $ref: "#/components/responses/Forbidden" }
1916
+ "404": { $ref: "#/components/responses/NotFound" }
1917
+ /stickers/packs/{pack_id}/installation:
1813
1918
  parameters:
1814
- - name: chatId
1815
- in: path
1816
- required: true
1817
- schema:
1818
- $ref: "#/components/schemas/Id"
1919
+ - $ref: "#/components/parameters/ClientVersion"
1920
+ - $ref: "#/components/parameters/ClientApiVersion"
1921
+ - $ref: "#/components/parameters/StickerPackId"
1819
1922
  put:
1923
+ tags: [stickers]
1924
+ operationId: addStickerPack
1925
+ summary: Add a sticker pack to the user's panel
1926
+ description: |
1927
+ Adding a pack the user has moves it to the top of the panel. User packs can be added only after opening
1928
+ them by their link (`404` otherwise).
1929
+ responses:
1930
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1931
+ "400": { $ref: "#/components/responses/BadRequest" }
1932
+ "204":
1933
+ description: Added
1934
+ "401": { $ref: "#/components/responses/Unauthorized" }
1935
+ "404": { $ref: "#/components/responses/NotFound" }
1936
+ delete:
1937
+ tags: [stickers]
1938
+ operationId: removeStickerPack
1939
+ summary: Remove a sticker pack from the user's panel
1940
+ description: |
1941
+ Built-in default packs can be removed too and come back only when added again. Stickers already sent from
1942
+ the pack keep showing in chats.
1943
+ responses:
1944
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1945
+ "400": { $ref: "#/components/responses/BadRequest" }
1946
+ "204":
1947
+ description: Removed
1948
+ "401": { $ref: "#/components/responses/Unauthorized" }
1949
+ "404": { $ref: "#/components/responses/NotFound" }
1950
+ /stickers/packs/{pack_id}/stickers:
1951
+ parameters:
1952
+ - $ref: "#/components/parameters/ClientVersion"
1953
+ - $ref: "#/components/parameters/ClientApiVersion"
1954
+ - $ref: "#/components/parameters/StickerPackId"
1955
+ post:
1956
+ tags: [stickers]
1957
+ operationId: addSticker
1958
+ summary: Add a sticker to a pack
1959
+ description: |
1960
+ Only the owner. Upload the image with `POST /attachments` (`purpose: sticker`) first; the server has already
1961
+ fitted it into 512 x 512 px. The sticker goes to the end of the pack. At most 120 stickers per pack
1962
+ (`409 limit_reached`). `422` when the image is not a sticker upload of the caller.
1963
+ requestBody:
1964
+ required: true
1965
+ content:
1966
+ application/json:
1967
+ schema: { $ref: "#/components/schemas/AddStickerRequest" }
1968
+ responses:
1969
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1970
+ "400": { $ref: "#/components/responses/BadRequest" }
1971
+ "201":
1972
+ description: The new sticker
1973
+ content:
1974
+ application/json:
1975
+ schema: { $ref: "#/components/schemas/Sticker" }
1976
+ "401": { $ref: "#/components/responses/Unauthorized" }
1977
+ "403": { $ref: "#/components/responses/Forbidden" }
1978
+ "404": { $ref: "#/components/responses/NotFound" }
1979
+ "409": { $ref: "#/components/responses/Conflict" }
1980
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1981
+ /stickers/packs/{pack_id}/stickers/{sticker_id}:
1982
+ parameters:
1983
+ - $ref: "#/components/parameters/ClientVersion"
1984
+ - $ref: "#/components/parameters/ClientApiVersion"
1985
+ - $ref: "#/components/parameters/StickerPackId"
1986
+ - $ref: "#/components/parameters/StickerId"
1987
+ patch:
1988
+ tags: [stickers]
1989
+ operationId: updateSticker
1990
+ summary: Change the emoji of a sticker
1991
+ description: Only the owner of the pack.
1992
+ requestBody:
1993
+ required: true
1994
+ content:
1995
+ application/json:
1996
+ schema: { $ref: "#/components/schemas/UpdateStickerRequest" }
1997
+ responses:
1998
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1999
+ "400": { $ref: "#/components/responses/BadRequest" }
2000
+ "200":
2001
+ description: The sticker
2002
+ content:
2003
+ application/json:
2004
+ schema: { $ref: "#/components/schemas/Sticker" }
2005
+ "401": { $ref: "#/components/responses/Unauthorized" }
2006
+ "403": { $ref: "#/components/responses/Forbidden" }
2007
+ "404": { $ref: "#/components/responses/NotFound" }
2008
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2009
+ delete:
2010
+ tags: [stickers]
2011
+ operationId: deleteSticker
2012
+ summary: Remove a sticker from a pack
2013
+ description: Only the owner of the pack. Messages that sent the sticker keep showing it.
2014
+ responses:
2015
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2016
+ "400": { $ref: "#/components/responses/BadRequest" }
2017
+ "204":
2018
+ description: Removed
2019
+ "401": { $ref: "#/components/responses/Unauthorized" }
2020
+ "403": { $ref: "#/components/responses/Forbidden" }
2021
+ "404": { $ref: "#/components/responses/NotFound" }
2022
+ /stickers/packs/{pack_id}/order:
2023
+ parameters:
2024
+ - $ref: "#/components/parameters/ClientVersion"
2025
+ - $ref: "#/components/parameters/ClientApiVersion"
2026
+ - $ref: "#/components/parameters/StickerPackId"
2027
+ put:
2028
+ tags: [stickers]
2029
+ operationId: reorderStickers
2030
+ summary: Reorder the stickers of a pack
2031
+ description: |
2032
+ Only the owner of the pack. `sticker_ids` lists every sticker of the pack exactly once, in the new order
2033
+ (`422` otherwise).
2034
+ requestBody:
2035
+ required: true
2036
+ content:
2037
+ application/json:
2038
+ schema: { $ref: "#/components/schemas/ReorderStickersRequest" }
2039
+ responses:
2040
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2041
+ "400": { $ref: "#/components/responses/BadRequest" }
2042
+ "204":
2043
+ description: Reordered
2044
+ "401": { $ref: "#/components/responses/Unauthorized" }
2045
+ "403": { $ref: "#/components/responses/Forbidden" }
2046
+ "404": { $ref: "#/components/responses/NotFound" }
2047
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2048
+ /stickers/packs/{pack_id}/report:
2049
+ parameters:
2050
+ - $ref: "#/components/parameters/ClientVersion"
2051
+ - $ref: "#/components/parameters/ClientApiVersion"
2052
+ - $ref: "#/components/parameters/StickerPackId"
2053
+ post:
2054
+ tags: [stickers]
2055
+ operationId: reportStickerPack
2056
+ summary: Report a sticker pack
2057
+ description: |
2058
+ One report per user and pack; reporting again changes nothing. After 5 reports from different users the
2059
+ pack is hidden until a moderator restores it: it leaves every panel, cannot be added or sent from, and only
2060
+ its owner still sees it (`is_hidden`). Stickers already sent keep showing. Built-in packs and the user's own
2061
+ packs cannot be reported (`403`). User packs can be reported only after opening them by their link (`404`
2062
+ otherwise). At most 20 new reports per user a day (`429`); reporting a pack again changes nothing.
2063
+ requestBody:
2064
+ required: true
2065
+ content:
2066
+ application/json:
2067
+ schema: { $ref: "#/components/schemas/ReportStickerPackRequest" }
2068
+ responses:
2069
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2070
+ "400": { $ref: "#/components/responses/BadRequest" }
2071
+ "204":
2072
+ description: Reported
2073
+ "401": { $ref: "#/components/responses/Unauthorized" }
2074
+ "403": { $ref: "#/components/responses/Forbidden" }
2075
+ "404": { $ref: "#/components/responses/NotFound" }
2076
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2077
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2078
+ /stickers/links/{slug}:
2079
+ parameters:
2080
+ - $ref: "#/components/parameters/ClientVersion"
2081
+ - $ref: "#/components/parameters/ClientApiVersion"
2082
+ - $ref: "#/components/parameters/StickerPackSlug"
2083
+ get:
2084
+ tags: [stickers]
2085
+ operationId: getStickerPackByLink
2086
+ summary: A sticker pack by its share link
2087
+ description: |
2088
+ The same as `GET /stickers/packs/{pack_id}`, found by the pack's `slug`. Opening a link lets the user use
2089
+ the pack by its ID from then on: add it, report it and send its stickers.
2090
+ responses:
2091
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2092
+ "400": { $ref: "#/components/responses/BadRequest" }
2093
+ "200":
2094
+ description: The pack
2095
+ content:
2096
+ application/json:
2097
+ schema: { $ref: "#/components/schemas/StickerPack" }
2098
+ "401": { $ref: "#/components/responses/Unauthorized" }
2099
+ "404": { $ref: "#/components/responses/NotFound" }
2100
+ /stickers/recent:
2101
+ parameters:
2102
+ - $ref: "#/components/parameters/ClientVersion"
2103
+ - $ref: "#/components/parameters/ClientApiVersion"
2104
+ get:
2105
+ tags: [stickers]
2106
+ operationId: listRecentStickers
2107
+ summary: Stickers the user sent recently
2108
+ description: The last 20 different stickers the user sent, newest first, on every device of the user.
2109
+ responses:
2110
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2111
+ "400": { $ref: "#/components/responses/BadRequest" }
2112
+ "200":
2113
+ description: The stickers
2114
+ content:
2115
+ application/json:
2116
+ schema: { $ref: "#/components/schemas/StickerList" }
2117
+ "401": { $ref: "#/components/responses/Unauthorized" }
2118
+ /link-preview:
2119
+ parameters:
2120
+ - $ref: "#/components/parameters/ClientVersion"
2121
+ - $ref: "#/components/parameters/ClientApiVersion"
2122
+ get:
2123
+ tags: [messages]
2124
+ operationId: getLinkPreview
2125
+ summary: Preview of a web page for a link in a message
2126
+ description: |
2127
+ Reads the page's Open Graph data (`og:title`, `og:description`, `og:site_name`, `og:image`; falling back to
2128
+ `<title>`, `description` and `twitter:image`). Only public `http`/`https` addresses on ports 80 and 443
2129
+ are fetched. Answers are cached for a day (a page without a preview for an hour). `image.url` points to
2130
+ `GET /link-preview/image`, so clients never load third-party images directly. `404` when the page has
2131
+ no preview or cannot be fetched.
2132
+ parameters:
2133
+ - name: url
2134
+ in: query
2135
+ required: true
2136
+ schema: { type: string, minLength: 1, maxLength: 2048 }
2137
+ responses:
2138
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2139
+ "400": { $ref: "#/components/responses/BadRequest" }
2140
+ "200":
2141
+ description: The preview
2142
+ content:
2143
+ application/json:
2144
+ schema: { $ref: "#/components/schemas/LinkPreview" }
2145
+ "401": { $ref: "#/components/responses/Unauthorized" }
2146
+ "404": { $ref: "#/components/responses/NotFound" }
2147
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2148
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2149
+ /link-preview/image:
2150
+ parameters:
2151
+ - $ref: "#/components/parameters/ClientVersion"
2152
+ - $ref: "#/components/parameters/ClientApiVersion"
2153
+ get:
2154
+ tags: [messages]
2155
+ operationId: getLinkPreviewImage
2156
+ summary: The image of a link preview, through the server
2157
+ description: |
2158
+ Use the `image.url` of a link preview as it is; `sig` proves the server made it. PNG, JPEG, GIF and WebP
2159
+ up to 5 MB, sent with `X-Content-Type-Options: nosniff`.
2160
+ parameters:
2161
+ - name: url
2162
+ in: query
2163
+ required: true
2164
+ schema: { type: string, minLength: 1, maxLength: 2048 }
2165
+ - name: sig
2166
+ in: query
2167
+ required: true
2168
+ schema: { type: string, minLength: 1, maxLength: 64 }
2169
+ responses:
2170
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2171
+ "400": { $ref: "#/components/responses/BadRequest" }
2172
+ "200":
2173
+ description: Image content
2174
+ content:
2175
+ image/*:
2176
+ schema: { type: string, format: binary }
2177
+ "401": { $ref: "#/components/responses/Unauthorized" }
2178
+ "403": { $ref: "#/components/responses/Forbidden" }
2179
+ "404": { $ref: "#/components/responses/NotFound" }
2180
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2181
+
2182
+ /me/notifications:
2183
+ get:
1820
2184
  tags:
1821
2185
  - me
1822
- operationId: setNotificationMute
1823
- summary: Mute or unmute a chat
2186
+ operationId: getNotificationSettings
2187
+ summary: Notification preferences and supported push platforms
2188
+ responses:
2189
+ "200":
2190
+ description: Notification settings or registered device
2191
+ content:
2192
+ application/json:
2193
+ schema:
2194
+ $ref: "#/components/schemas/NotificationSettings"
2195
+ "400":
2196
+ $ref: "#/components/responses/BadRequest"
2197
+ "401":
2198
+ $ref: "#/components/responses/Unauthorized"
2199
+ "404":
2200
+ $ref: "#/components/responses/NotFound"
2201
+ "409":
2202
+ $ref: "#/components/responses/Conflict"
2203
+ put:
2204
+ tags:
2205
+ - me
2206
+ operationId: updateNotificationSettings
2207
+ summary: Replace notification preferences
1824
2208
  requestBody:
1825
2209
  required: true
1826
2210
  content:
1827
2211
  application/json:
1828
2212
  schema:
1829
- $ref: "#/components/schemas/NotificationMuteRequest"
2213
+ $ref: "#/components/schemas/NotificationPreferences"
2214
+ responses:
2215
+ "204":
2216
+ description: Saved
2217
+ "400":
2218
+ $ref: "#/components/responses/BadRequest"
2219
+ "401":
2220
+ $ref: "#/components/responses/Unauthorized"
2221
+ "404":
2222
+ $ref: "#/components/responses/NotFound"
2223
+ "409":
2224
+ $ref: "#/components/responses/Conflict"
2225
+ /notifications/avatar/{token}:
2226
+ parameters:
2227
+ - name: token
2228
+ in: path
2229
+ required: true
2230
+ description: "`avatar_token` of a push notification."
2231
+ schema: { type: string, maxLength: 256 }
2232
+ get:
2233
+ tags: [me]
2234
+ operationId: getNotificationAvatar
2235
+ summary: Sender avatar for a push notification
2236
+ description: |
2237
+ For the service worker, which has no session: the token in the push payload names the recipient
2238
+ and the sender and expires after an hour. Follows the sender's avatar visibility for the recipient.
2239
+ security: []
2240
+ responses:
2241
+ "200":
2242
+ description: Image
2243
+ content:
2244
+ image/*:
2245
+ schema: { type: string, format: binary }
2246
+ "206":
2247
+ description: The requested byte range (`Range` header)
2248
+ content:
2249
+ image/*:
2250
+ schema: { type: string, format: binary }
2251
+ "302":
2252
+ description: Redirect to a short-lived signed storage URL (with `MEDIA_SIGNED_URLS`)
2253
+ "304":
2254
+ description: Not modified (`If-None-Match` with the `ETag` of an earlier answer)
2255
+ "416":
2256
+ description: The requested range is outside the file
2257
+ "404": { $ref: "#/components/responses/NotFound" }
2258
+ /notifications/read/{token}:
2259
+ parameters:
2260
+ - name: token
2261
+ in: path
2262
+ required: true
2263
+ description: "`read_token` of a push notification."
2264
+ schema: { type: string, maxLength: 256 }
2265
+ post:
2266
+ tags: [me]
2267
+ operationId: markNotificationRead
2268
+ summary: Mark a chat read from a push notification
2269
+ description: |
2270
+ For the notification's "Mark as read" action: marks the chat read up to the notified message for
2271
+ the recipient the token names. The token expires after seven days.
2272
+ security: []
2273
+ responses:
2274
+ "204":
2275
+ description: Marked as read
2276
+ "404": { $ref: "#/components/responses/NotFound" }
2277
+ /me/notification-devices:
2278
+ post:
2279
+ tags:
2280
+ - me
2281
+ operationId: registerNotificationDevice
2282
+ summary: Register a push destination for the current session
2283
+ requestBody:
2284
+ required: true
2285
+ content:
2286
+ application/json:
2287
+ schema:
2288
+ $ref: "#/components/schemas/NotificationDeviceRequest"
2289
+ responses:
2290
+ "200":
2291
+ description: Notification settings or registered device
2292
+ content:
2293
+ application/json:
2294
+ schema:
2295
+ $ref: "#/components/schemas/NotificationDeviceRegistered"
2296
+ "400":
2297
+ $ref: "#/components/responses/BadRequest"
2298
+ "401":
2299
+ $ref: "#/components/responses/Unauthorized"
2300
+ "404":
2301
+ $ref: "#/components/responses/NotFound"
2302
+ "409":
2303
+ $ref: "#/components/responses/Conflict"
2304
+ /me/notification-devices/{id}:
2305
+ parameters:
2306
+ - name: id
2307
+ in: path
2308
+ required: true
2309
+ schema:
2310
+ type: string
2311
+ format: uuid
2312
+ delete:
2313
+ tags:
2314
+ - me
2315
+ operationId: deleteNotificationDevice
2316
+ summary: Unregister a push destination for the current session
2317
+ responses:
2318
+ "204":
2319
+ description: Saved
2320
+ "400":
2321
+ $ref: "#/components/responses/BadRequest"
2322
+ "401":
2323
+ $ref: "#/components/responses/Unauthorized"
2324
+ "404":
2325
+ $ref: "#/components/responses/NotFound"
2326
+ "409":
2327
+ $ref: "#/components/responses/Conflict"
2328
+ /chats/{chatId}/notification-mute:
2329
+ parameters:
2330
+ - name: chatId
2331
+ in: path
2332
+ required: true
2333
+ schema:
2334
+ $ref: "#/components/schemas/Id"
2335
+ put:
2336
+ tags:
2337
+ - me
2338
+ operationId: setNotificationMute
2339
+ summary: Mute or unmute a chat
2340
+ requestBody:
2341
+ required: true
2342
+ content:
2343
+ application/json:
2344
+ schema:
2345
+ $ref: "#/components/schemas/NotificationMuteRequest"
2346
+ responses:
2347
+ "204":
2348
+ description: Saved
2349
+ "400":
2350
+ $ref: "#/components/responses/BadRequest"
2351
+ "401":
2352
+ $ref: "#/components/responses/Unauthorized"
2353
+ "404":
2354
+ $ref: "#/components/responses/NotFound"
2355
+ "409":
2356
+ $ref: "#/components/responses/Conflict"
2357
+ /me/notification-devices/{id}/activity:
2358
+ parameters:
2359
+ - name: id
2360
+ in: path
2361
+ required: true
2362
+ schema:
2363
+ type: string
2364
+ format: uuid
2365
+ put:
2366
+ tags:
2367
+ - me
2368
+ operationId: updateNotificationActivity
2369
+ summary: Report a visible client with a healthy live connection
2370
+ requestBody:
2371
+ required: true
2372
+ content:
2373
+ application/json:
2374
+ schema:
2375
+ $ref: "#/components/schemas/NotificationActivity"
2376
+ responses:
2377
+ "204":
2378
+ description: Saved
2379
+ "400":
2380
+ $ref: "#/components/responses/BadRequest"
2381
+ "401":
2382
+ $ref: "#/components/responses/Unauthorized"
2383
+ "404":
2384
+ $ref: "#/components/responses/NotFound"
2385
+ "409":
2386
+ $ref: "#/components/responses/Conflict"
2387
+
2388
+ /auth/recovery-requests:
2389
+ parameters:
2390
+ - &a1
2391
+ $ref: "#/components/parameters/ClientVersion"
2392
+ - &a2
2393
+ $ref: "#/components/parameters/ClientApiVersion"
2394
+ post:
2395
+ tags:
2396
+ - auth
2397
+ operationId: startDeviceRecovery
2398
+ summary: Request approval from a signed-in device
2399
+ security: []
2400
+ requestBody:
2401
+ required: true
2402
+ content:
2403
+ application/json:
2404
+ schema:
2405
+ $ref: "#/components/schemas/DeviceRecoveryStart"
2406
+ responses:
2407
+ "200":
2408
+ description: Success
2409
+ content:
2410
+ application/json:
2411
+ schema:
2412
+ $ref: "#/components/schemas/DeviceRecoveryResult"
2413
+ "400":
2414
+ $ref: "#/components/responses/BadRequest"
2415
+ "401":
2416
+ $ref: "#/components/responses/Unauthorized"
2417
+ "403":
2418
+ $ref: "#/components/responses/Forbidden"
2419
+ "409":
2420
+ $ref: "#/components/responses/Conflict"
2421
+ "422":
2422
+ $ref: "#/components/responses/ValidationFailed"
2423
+ "426":
2424
+ $ref: "#/components/responses/ClientOutdated"
2425
+ "429":
2426
+ $ref: "#/components/responses/TooManyRequests"
2427
+ /auth/recovery-requests/{requestId}:
2428
+ parameters:
2429
+ - *a1
2430
+ - *a2
2431
+ - &a3
2432
+ name: requestId
2433
+ in: path
2434
+ required: true
2435
+ schema:
2436
+ type: string
2437
+ minLength: 32
2438
+ maxLength: 128
2439
+ pattern: ^[A-Za-z0-9_-]+$
2440
+ description: Secret one-time recovery request capability. Never log or persist
2441
+ it in browser storage.
2442
+ get:
2443
+ tags:
2444
+ - auth
2445
+ operationId: deviceRecoveryStatus
2446
+ summary: Poll the status of a secret recovery request
2447
+ security: []
2448
+ responses:
2449
+ "200":
2450
+ description: Success
2451
+ content:
2452
+ application/json:
2453
+ schema:
2454
+ $ref: "#/components/schemas/DeviceRecoveryStatus"
2455
+ "400":
2456
+ $ref: "#/components/responses/BadRequest"
2457
+ "401":
2458
+ $ref: "#/components/responses/Unauthorized"
2459
+ "403":
2460
+ $ref: "#/components/responses/Forbidden"
2461
+ "409":
2462
+ $ref: "#/components/responses/Conflict"
2463
+ "422":
2464
+ $ref: "#/components/responses/ValidationFailed"
2465
+ "426":
2466
+ $ref: "#/components/responses/ClientOutdated"
2467
+ "429":
2468
+ $ref: "#/components/responses/TooManyRequests"
2469
+ /auth/recovery-requests/{requestId}/approve:
2470
+ parameters:
2471
+ - *a1
2472
+ - *a2
2473
+ - &a4
2474
+ name: requestId
2475
+ in: path
2476
+ required: true
2477
+ schema:
2478
+ type: string
2479
+ minLength: 32
2480
+ maxLength: 128
2481
+ pattern: ^[A-Za-z0-9_-]+$
2482
+ description: Approval handle from the recovery_request event. It is different from the
2483
+ requester's capability and cannot poll or complete the request.
2484
+ post:
2485
+ tags:
2486
+ - auth
2487
+ operationId: approveDeviceRecovery
2488
+ summary: Approve a recovery request using number matching, user verification and the second factor
2489
+ description: |
2490
+ Approval does not need the current password, which the user may have forgotten. The checks run in this
2491
+ order: the request must belong to the caller and `match_number` must match (a wrong number denies the
2492
+ request), then user verification, then the second factor.
2493
+
2494
+ User verification follows `POST /auth/recovery-requests/{requestId}/approve/options`. When the account
2495
+ has passkeys, `passkey` must carry an assertion with user verification for the challenge from that call
2496
+ (`403 user_verification_required` without it, `403 invalid_credentials` for a failed assertion,
2497
+ `400 invalid_request` for an unknown, used or expired challenge). A missing `code` answers
2498
+ `401 two_factor_required` before the challenge is used, so the request can be repeated with the same
2499
+ assertion and the code. A wrong code is checked after the passkey and uses up the challenge.
2500
+ Without passkeys the approving session must be at least as old as the minimum session age
2501
+ (`RECOVERY_APPROVAL_MIN_SESSION_AGE`, 72 hours by default), otherwise `403 session_too_new`.
2502
+
2503
+ `password` is ignored and only accepted so that older clients keep working.
2504
+ requestBody:
2505
+ required: true
2506
+ content:
2507
+ application/json:
2508
+ schema:
2509
+ $ref: "#/components/schemas/DeviceRecoveryApproval"
2510
+ responses:
2511
+ "200":
2512
+ description: Success
2513
+ content:
2514
+ application/json:
2515
+ schema:
2516
+ $ref: "#/components/schemas/DeviceRecoveryStatus"
2517
+ "400":
2518
+ $ref: "#/components/responses/BadRequest"
2519
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
2520
+ "403":
2521
+ $ref: "#/components/responses/Forbidden"
2522
+ "404":
2523
+ $ref: "#/components/responses/NotFound"
2524
+ "409":
2525
+ $ref: "#/components/responses/Conflict"
2526
+ "422":
2527
+ $ref: "#/components/responses/ValidationFailed"
2528
+ "426":
2529
+ $ref: "#/components/responses/ClientOutdated"
2530
+ "429":
2531
+ $ref: "#/components/responses/TooManyRequests"
2532
+ /auth/recovery-requests/{requestId}/approve/options:
2533
+ parameters:
2534
+ - *a1
2535
+ - *a2
2536
+ - *a4
2537
+ post:
2538
+ tags:
2539
+ - auth
2540
+ operationId: deviceRecoveryApprovalOptions
2541
+ summary: Tell the approving device how to verify its user
2542
+ description: |
2543
+ `method: passkey` when the account has passkeys: `challenge_id` and `public_key` (WebAuthn request
2544
+ options with `userVerification: required`) are for `navigator.credentials.get`, and the result goes to
2545
+ the approval as `passkey`. The challenge is bound to this session and request, is single use and expires
2546
+ after 5 minutes or with the request. `method: session` otherwise; `approvable_from` is set while the
2547
+ session is younger than the minimum session age and tells when it may approve.
2548
+ responses:
2549
+ "200":
2550
+ description: Success
2551
+ content:
2552
+ application/json:
2553
+ schema:
2554
+ $ref: "#/components/schemas/DeviceRecoveryApprovalOptions"
2555
+ "400":
2556
+ $ref: "#/components/responses/BadRequest"
2557
+ "401":
2558
+ $ref: "#/components/responses/Unauthorized"
2559
+ "403":
2560
+ $ref: "#/components/responses/Forbidden"
2561
+ "404":
2562
+ $ref: "#/components/responses/NotFound"
2563
+ "426":
2564
+ $ref: "#/components/responses/ClientOutdated"
2565
+ "429":
2566
+ $ref: "#/components/responses/TooManyRequests"
2567
+ /auth/recovery-requests/{requestId}/deny:
2568
+ parameters:
2569
+ - *a1
2570
+ - *a2
2571
+ - *a4
2572
+ post:
2573
+ tags:
2574
+ - auth
2575
+ operationId: denyDeviceRecovery
2576
+ summary: Deny an unexpected recovery request
2577
+ responses:
2578
+ "200":
2579
+ description: Success
2580
+ content:
2581
+ application/json:
2582
+ schema:
2583
+ $ref: "#/components/schemas/DeviceRecoveryStatus"
2584
+ "400":
2585
+ $ref: "#/components/responses/BadRequest"
2586
+ "401":
2587
+ $ref: "#/components/responses/Unauthorized"
2588
+ "403":
2589
+ $ref: "#/components/responses/Forbidden"
2590
+ "404":
2591
+ $ref: "#/components/responses/NotFound"
2592
+ "409":
2593
+ $ref: "#/components/responses/Conflict"
2594
+ "422":
2595
+ $ref: "#/components/responses/ValidationFailed"
2596
+ "426":
2597
+ $ref: "#/components/responses/ClientOutdated"
2598
+ "429":
2599
+ $ref: "#/components/responses/TooManyRequests"
2600
+ /auth/recovery-requests/{requestId}/complete:
2601
+ parameters:
2602
+ - *a1
2603
+ - *a2
2604
+ - *a3
2605
+ post:
2606
+ tags:
2607
+ - auth
2608
+ operationId: completeDeviceRecovery
2609
+ summary: Consume an approved request and reset the password
2610
+ security: []
2611
+ requestBody:
2612
+ required: true
2613
+ content:
2614
+ application/json:
2615
+ schema:
2616
+ $ref: "#/components/schemas/DeviceRecoveryComplete"
2617
+ responses:
2618
+ "200":
2619
+ description: Success
2620
+ content:
2621
+ application/json:
2622
+ schema:
2623
+ $ref: "#/components/schemas/RegisterResponse"
2624
+ "400":
2625
+ $ref: "#/components/responses/BadRequest"
2626
+ "401":
2627
+ $ref: "#/components/responses/Unauthorized"
2628
+ "403":
2629
+ $ref: "#/components/responses/Forbidden"
2630
+ "409":
2631
+ $ref: "#/components/responses/Conflict"
2632
+ "422":
2633
+ $ref: "#/components/responses/ValidationFailed"
2634
+ "426":
2635
+ $ref: "#/components/responses/ClientOutdated"
2636
+ "429":
2637
+ $ref: "#/components/responses/TooManyRequests"
2638
+ /auth/recovery-requests/{requestId}/cancel:
2639
+ parameters:
2640
+ - *a1
2641
+ - *a2
2642
+ - *a3
2643
+ post:
2644
+ tags:
2645
+ - auth
2646
+ operationId: cancelDeviceRecovery
2647
+ summary: Withdraw a pending recovery request from the requesting browser
2648
+ description: Ends a pending request so it no longer counts towards the limit of three active requests. It
2649
+ answers 204 for every capability, including unknown, decided and expired ones.
2650
+ security: []
2651
+ responses:
2652
+ "204":
2653
+ description: Cancelled or nothing to cancel
2654
+ "400":
2655
+ $ref: "#/components/responses/BadRequest"
2656
+ "426":
2657
+ $ref: "#/components/responses/ClientOutdated"
2658
+ "429":
2659
+ $ref: "#/components/responses/TooManyRequests"
2660
+
2661
+ /auth/qr-login:
2662
+ parameters:
2663
+ - $ref: "#/components/parameters/ClientVersion"
2664
+ - $ref: "#/components/parameters/ClientApiVersion"
2665
+ post:
2666
+ tags: [auth]
2667
+ operationId: createQrLogin
2668
+ summary: Start a sign-in with a QR code
2669
+ description: |
2670
+ Called by a device that is not signed in. Show `url` as a QR code and poll
2671
+ `POST /auth/qr-login/{requestId}/poll` with `poll_token` until the status is final. The request expires
2672
+ after 2 minutes. Keep `poll_token` in memory only; it is the secret that receives the session.
2673
+ security: []
2674
+ responses:
2675
+ "201":
2676
+ description: Created
2677
+ content:
2678
+ application/json:
2679
+ schema: { $ref: "#/components/schemas/QrLoginStart" }
2680
+ example:
2681
+ request_id: 3q2-7wEAAAD9W8b0kZ3lYfHk6gF1n9cQmR2pVx4sTtU
2682
+ poll_token: example-poll-token
2683
+ url: https://messenger.example.com/qr/3q2-7wEAAAD9W8b0kZ3lYfHk6gF1n9cQmR2pVx4sTtU
2684
+ expires_at: "2026-11-06T12:02:00Z"
2685
+ "400": { $ref: "#/components/responses/BadRequest" }
2686
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2687
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2688
+ /auth/qr-login/{requestId}:
2689
+ parameters:
2690
+ - $ref: "#/components/parameters/ClientVersion"
2691
+ - $ref: "#/components/parameters/ClientApiVersion"
2692
+ - $ref: "#/components/parameters/QrLoginRequestId"
2693
+ get:
2694
+ tags: [auth]
2695
+ operationId: getQrLogin
2696
+ summary: Show who asks to sign in with a QR code
2697
+ description: |
2698
+ Called by a signed-in device after it opened the link of the QR code. The first call moves the request from
2699
+ `pending` to `scanned` and binds it to the caller: other accounts get `404` from then on. Show `device` and
2700
+ `location` and let the user confirm that the sign-in is their own before approving. Unknown, expired and
2701
+ used requests answer `404`.
2702
+ responses:
2703
+ "200":
2704
+ description: Success
2705
+ content:
2706
+ application/json:
2707
+ schema: { $ref: "#/components/schemas/QrLoginRequest" }
2708
+ example:
2709
+ request_id: 3q2-7wEAAAD9W8b0kZ3lYfHk6gF1n9cQmR2pVx4sTtU
2710
+ status: scanned
2711
+ device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) Firefox/140.0
2712
+ location: { city: Berlin, country_code: DE, country: Germany }
2713
+ created_at: "2026-11-06T12:00:00Z"
2714
+ expires_at: "2026-11-06T12:02:00Z"
2715
+ "400": { $ref: "#/components/responses/BadRequest" }
2716
+ "401": { $ref: "#/components/responses/Unauthorized" }
2717
+ "404": { $ref: "#/components/responses/NotFound" }
2718
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2719
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2720
+ /auth/qr-login/{requestId}/poll:
2721
+ parameters:
2722
+ - $ref: "#/components/parameters/ClientVersion"
2723
+ - $ref: "#/components/parameters/ClientApiVersion"
2724
+ - $ref: "#/components/parameters/QrLoginRequestId"
2725
+ post:
2726
+ tags: [auth]
2727
+ operationId: pollQrLogin
2728
+ summary: Poll a QR sign-in and receive the session once approved
2729
+ description: |
2730
+ Called by the device that created the request, about once per second (at most 120 polls per 2 minutes per
2731
+ client address). While the request is open the answer is `pending` or `scanned`. The first poll after
2732
+ approval signs the device in exactly like a successful `POST /auth/login`: it sets the refresh cookie and
2733
+ returns `status: approved` with the token fields. Later polls, unknown requests, a wrong `poll_token` and
2734
+ expired requests all answer `expired`.
2735
+ security: []
2736
+ requestBody:
2737
+ required: true
2738
+ content:
2739
+ application/json:
2740
+ schema: { $ref: "#/components/schemas/QrLoginPollRequest" }
2741
+ responses:
2742
+ "200":
2743
+ description: The current status, plus the session when it was just approved
2744
+ headers:
2745
+ Set-Cookie: { $ref: "#/components/headers/RefreshCookie" }
2746
+ content:
2747
+ application/json:
2748
+ schema: { $ref: "#/components/schemas/QrLoginPollResult" }
2749
+ examples:
2750
+ waiting:
2751
+ value: { status: scanned }
2752
+ approved:
2753
+ value:
2754
+ status: approved
2755
+ access_token: example-access-token
2756
+ token_type: Bearer
2757
+ expires_in: 900
2758
+ "400": { $ref: "#/components/responses/BadRequest" }
2759
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2760
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2761
+ /auth/qr-login/{requestId}/approve:
2762
+ parameters:
2763
+ - $ref: "#/components/parameters/ClientVersion"
2764
+ - $ref: "#/components/parameters/ClientApiVersion"
2765
+ - $ref: "#/components/parameters/QrLoginRequestId"
2766
+ post:
2767
+ tags: [auth]
2768
+ operationId: approveQrLogin
2769
+ summary: Sign the device of a QR code into this account
2770
+ description: |
2771
+ Single use. The request must be `pending` or `scanned`, not expired and not bound to another account
2772
+ (`404` otherwise; `409` when it was already approved or denied). The calling session must be active and
2773
+ used within `RECOVERY_APPROVAL_MAX_AGE` (`403 forbidden` otherwise). With two-factor on, send `code` (an
2774
+ authenticator code or an unused recovery code); without it the answer is `401 two_factor_required` and the
2775
+ request stays approvable. A wrong code answers `400 invalid_credentials`. The body may be omitted.
2776
+ requestBody:
2777
+ required: false
2778
+ content:
2779
+ application/json:
2780
+ schema: { $ref: "#/components/schemas/QrLoginApproval" }
2781
+ example: { code: "123456" }
2782
+ responses:
2783
+ "204": { description: Approved; the new device receives its session on its next poll }
2784
+ "400": { $ref: "#/components/responses/BadRequest" }
2785
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
2786
+ "403": { $ref: "#/components/responses/Forbidden" }
2787
+ "404": { $ref: "#/components/responses/NotFound" }
2788
+ "409": { $ref: "#/components/responses/Conflict" }
2789
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2790
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2791
+ /auth/qr-login/{requestId}/deny:
2792
+ parameters:
2793
+ - $ref: "#/components/parameters/ClientVersion"
2794
+ - $ref: "#/components/parameters/ClientApiVersion"
2795
+ - $ref: "#/components/parameters/QrLoginRequestId"
2796
+ post:
2797
+ tags: [auth]
2798
+ operationId: denyQrLogin
2799
+ summary: Refuse a QR sign-in
2800
+ description: The new device then polls `denied`. Same `404` and `409` rules as approving.
2801
+ responses:
2802
+ "204": { description: Denied }
2803
+ "400": { $ref: "#/components/responses/BadRequest" }
2804
+ "401": { $ref: "#/components/responses/Unauthorized" }
2805
+ "404": { $ref: "#/components/responses/NotFound" }
2806
+ "409": { $ref: "#/components/responses/Conflict" }
2807
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2808
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2809
+
2810
+ /auth/passkeys/register/options:
2811
+ parameters: &a1
2812
+ - &a2
2813
+ $ref: "#/components/parameters/ClientVersion"
2814
+ - &a3
2815
+ $ref: "#/components/parameters/ClientApiVersion"
2816
+ post:
2817
+ tags:
2818
+ - auth
2819
+ operationId: passkeyRegistrationOptions
2820
+ summary: Begin passkey registration after password and second-factor verification
2821
+ requestBody:
2822
+ required: true
2823
+ content:
2824
+ application/json:
2825
+ schema:
2826
+ $ref: "#/components/schemas/PasskeyRegistration"
2827
+ responses:
2828
+ "200":
2829
+ description: Success
2830
+ content:
2831
+ application/json:
2832
+ schema:
2833
+ $ref: "#/components/schemas/PasskeyOptions"
2834
+ "400":
2835
+ description: Bad request
2836
+ content:
2837
+ application/problem+json:
2838
+ schema:
2839
+ $ref: "#/components/schemas/Problem"
2840
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
2841
+ "403":
2842
+ description: Forbidden
2843
+ content:
2844
+ application/problem+json:
2845
+ schema:
2846
+ $ref: "#/components/schemas/Problem"
2847
+ "404":
2848
+ description: Not found
2849
+ content:
2850
+ application/problem+json:
2851
+ schema:
2852
+ $ref: "#/components/schemas/Problem"
2853
+ "409":
2854
+ description: Conflict
2855
+ content:
2856
+ application/problem+json:
2857
+ schema:
2858
+ $ref: "#/components/schemas/Problem"
2859
+ "422":
2860
+ description: Invalid input
2861
+ content:
2862
+ application/problem+json:
2863
+ schema:
2864
+ $ref: "#/components/schemas/Problem"
2865
+ "426":
2866
+ description: Client outdated
2867
+ content:
2868
+ application/problem+json:
2869
+ schema:
2870
+ $ref: "#/components/schemas/Problem"
2871
+ "429":
2872
+ description: Rate limited
2873
+ content:
2874
+ application/problem+json:
2875
+ schema:
2876
+ $ref: "#/components/schemas/Problem"
2877
+ "503":
2878
+ description: Passkeys are not configured
2879
+ content:
2880
+ application/problem+json:
2881
+ schema:
2882
+ $ref: "#/components/schemas/Problem"
2883
+ /auth/passkeys/register/verify:
2884
+ parameters: *a1
2885
+ post:
2886
+ tags:
2887
+ - auth
2888
+ operationId: verifyPasskeyRegistration
2889
+ summary: Verify and store a passkey
2890
+ requestBody:
2891
+ required: true
2892
+ content:
2893
+ application/json:
2894
+ schema:
2895
+ $ref: "#/components/schemas/PasskeyVerification"
2896
+ responses:
2897
+ "204":
2898
+ description: Success
2899
+ "400":
2900
+ description: Bad request
2901
+ content:
2902
+ application/problem+json:
2903
+ schema:
2904
+ $ref: "#/components/schemas/Problem"
2905
+ "401":
2906
+ description: Unauthorized
2907
+ content:
2908
+ application/problem+json:
2909
+ schema:
2910
+ $ref: "#/components/schemas/Problem"
2911
+ "403":
2912
+ description: Forbidden
2913
+ content:
2914
+ application/problem+json:
2915
+ schema:
2916
+ $ref: "#/components/schemas/Problem"
2917
+ "404":
2918
+ description: Not found
2919
+ content:
2920
+ application/problem+json:
2921
+ schema:
2922
+ $ref: "#/components/schemas/Problem"
2923
+ "409":
2924
+ description: Conflict
2925
+ content:
2926
+ application/problem+json:
2927
+ schema:
2928
+ $ref: "#/components/schemas/Problem"
2929
+ "422":
2930
+ description: Invalid input
2931
+ content:
2932
+ application/problem+json:
2933
+ schema:
2934
+ $ref: "#/components/schemas/Problem"
2935
+ "426":
2936
+ description: Client outdated
2937
+ content:
2938
+ application/problem+json:
2939
+ schema:
2940
+ $ref: "#/components/schemas/Problem"
2941
+ "429":
2942
+ description: Rate limited
2943
+ content:
2944
+ application/problem+json:
2945
+ schema:
2946
+ $ref: "#/components/schemas/Problem"
2947
+ "503":
2948
+ description: Passkeys are not configured
2949
+ content:
2950
+ application/problem+json:
2951
+ schema:
2952
+ $ref: "#/components/schemas/Problem"
2953
+ /auth/passkeys:
2954
+ parameters: *a1
2955
+ get:
2956
+ tags:
2957
+ - auth
2958
+ operationId: listPasskeys
2959
+ summary: List the account passkeys
2960
+ responses:
2961
+ "200":
2962
+ description: Success
2963
+ content:
2964
+ application/json:
2965
+ schema:
2966
+ $ref: "#/components/schemas/PasskeyPage"
2967
+ "400":
2968
+ description: Bad request
2969
+ content:
2970
+ application/problem+json:
2971
+ schema:
2972
+ $ref: "#/components/schemas/Problem"
2973
+ "401":
2974
+ description: Unauthorized
2975
+ content:
2976
+ application/problem+json:
2977
+ schema:
2978
+ $ref: "#/components/schemas/Problem"
2979
+ "403":
2980
+ description: Forbidden
2981
+ content:
2982
+ application/problem+json:
2983
+ schema:
2984
+ $ref: "#/components/schemas/Problem"
2985
+ "404":
2986
+ description: Not found
2987
+ content:
2988
+ application/problem+json:
2989
+ schema:
2990
+ $ref: "#/components/schemas/Problem"
2991
+ "409":
2992
+ description: Conflict
2993
+ content:
2994
+ application/problem+json:
2995
+ schema:
2996
+ $ref: "#/components/schemas/Problem"
2997
+ "422":
2998
+ description: Invalid input
2999
+ content:
3000
+ application/problem+json:
3001
+ schema:
3002
+ $ref: "#/components/schemas/Problem"
3003
+ "426":
3004
+ description: Client outdated
3005
+ content:
3006
+ application/problem+json:
3007
+ schema:
3008
+ $ref: "#/components/schemas/Problem"
3009
+ "429":
3010
+ description: Rate limited
3011
+ content:
3012
+ application/problem+json:
3013
+ schema:
3014
+ $ref: "#/components/schemas/Problem"
3015
+ "503":
3016
+ description: Passkeys are not configured
3017
+ content:
3018
+ application/problem+json:
3019
+ schema:
3020
+ $ref: "#/components/schemas/Problem"
3021
+ /auth/passkeys/{passkeyId}:
3022
+ parameters:
3023
+ - *a2
3024
+ - *a3
3025
+ - name: passkeyId
3026
+ in: path
3027
+ required: true
3028
+ schema:
3029
+ type: string
3030
+ minLength: 1
3031
+ maxLength: 2048
3032
+ pattern: ^[A-Za-z0-9_-]+$
3033
+ patch:
3034
+ tags:
3035
+ - auth
3036
+ operationId: renamePasskey
3037
+ summary: Rename a passkey
3038
+ requestBody:
3039
+ required: true
3040
+ content:
3041
+ application/json:
3042
+ schema:
3043
+ $ref: "#/components/schemas/PasskeyRename"
3044
+ responses:
3045
+ "204":
3046
+ description: Success
3047
+ "400":
3048
+ description: Bad request
3049
+ content:
3050
+ application/problem+json:
3051
+ schema:
3052
+ $ref: "#/components/schemas/Problem"
3053
+ "401":
3054
+ description: Unauthorized
3055
+ content:
3056
+ application/problem+json:
3057
+ schema:
3058
+ $ref: "#/components/schemas/Problem"
3059
+ "403":
3060
+ description: Forbidden
3061
+ content:
3062
+ application/problem+json:
3063
+ schema:
3064
+ $ref: "#/components/schemas/Problem"
3065
+ "404":
3066
+ description: Not found
3067
+ content:
3068
+ application/problem+json:
3069
+ schema:
3070
+ $ref: "#/components/schemas/Problem"
3071
+ "409":
3072
+ description: Conflict
3073
+ content:
3074
+ application/problem+json:
3075
+ schema:
3076
+ $ref: "#/components/schemas/Problem"
3077
+ "422":
3078
+ description: Invalid input
3079
+ content:
3080
+ application/problem+json:
3081
+ schema:
3082
+ $ref: "#/components/schemas/Problem"
3083
+ "426":
3084
+ description: Client outdated
3085
+ content:
3086
+ application/problem+json:
3087
+ schema:
3088
+ $ref: "#/components/schemas/Problem"
3089
+ "429":
3090
+ description: Rate limited
3091
+ content:
3092
+ application/problem+json:
3093
+ schema:
3094
+ $ref: "#/components/schemas/Problem"
3095
+ "503":
3096
+ description: Passkeys are not configured
3097
+ content:
3098
+ application/problem+json:
3099
+ schema:
3100
+ $ref: "#/components/schemas/Problem"
3101
+ delete:
3102
+ tags:
3103
+ - auth
3104
+ operationId: removePasskey
3105
+ summary: Remove a passkey; the last credential requires the password
3106
+ requestBody:
3107
+ required: true
3108
+ content:
3109
+ application/json:
3110
+ schema:
3111
+ $ref: "#/components/schemas/PasskeyRemoval"
3112
+ responses:
3113
+ "204":
3114
+ description: Success
3115
+ "400":
3116
+ description: Bad request
3117
+ content:
3118
+ application/problem+json:
3119
+ schema:
3120
+ $ref: "#/components/schemas/Problem"
3121
+ "401":
3122
+ description: Unauthorized
3123
+ content:
3124
+ application/problem+json:
3125
+ schema:
3126
+ $ref: "#/components/schemas/Problem"
3127
+ "403":
3128
+ description: Forbidden
3129
+ content:
3130
+ application/problem+json:
3131
+ schema:
3132
+ $ref: "#/components/schemas/Problem"
3133
+ "404":
3134
+ description: Not found
3135
+ content:
3136
+ application/problem+json:
3137
+ schema:
3138
+ $ref: "#/components/schemas/Problem"
3139
+ "409":
3140
+ description: Conflict
3141
+ content:
3142
+ application/problem+json:
3143
+ schema:
3144
+ $ref: "#/components/schemas/Problem"
3145
+ "422":
3146
+ description: Invalid input
3147
+ content:
3148
+ application/problem+json:
3149
+ schema:
3150
+ $ref: "#/components/schemas/Problem"
3151
+ "426":
3152
+ description: Client outdated
3153
+ content:
3154
+ application/problem+json:
3155
+ schema:
3156
+ $ref: "#/components/schemas/Problem"
3157
+ "429":
3158
+ description: Rate limited
3159
+ content:
3160
+ application/problem+json:
3161
+ schema:
3162
+ $ref: "#/components/schemas/Problem"
3163
+ "503":
3164
+ description: Passkeys are not configured
3165
+ content:
3166
+ application/problem+json:
3167
+ schema:
3168
+ $ref: "#/components/schemas/Problem"
3169
+ /auth/passkeys/login/options:
3170
+ parameters: *a1
3171
+ post:
3172
+ tags:
3173
+ - auth
3174
+ operationId: passkeyLoginOptions
3175
+ summary: Begin discoverable passkey sign-in
3176
+ security: []
3177
+ requestBody:
3178
+ required: true
3179
+ content:
3180
+ application/json:
3181
+ schema:
3182
+ $ref: "#/components/schemas/PasskeyLoginOptions"
3183
+ responses:
3184
+ "200":
3185
+ description: Success
3186
+ content:
3187
+ application/json:
3188
+ schema:
3189
+ $ref: "#/components/schemas/PasskeyOptions"
3190
+ "400":
3191
+ description: Bad request
3192
+ content:
3193
+ application/problem+json:
3194
+ schema:
3195
+ $ref: "#/components/schemas/Problem"
3196
+ "401":
3197
+ description: Unauthorized
3198
+ content:
3199
+ application/problem+json:
3200
+ schema:
3201
+ $ref: "#/components/schemas/Problem"
3202
+ "403":
3203
+ description: Forbidden
3204
+ content:
3205
+ application/problem+json:
3206
+ schema:
3207
+ $ref: "#/components/schemas/Problem"
3208
+ "404":
3209
+ description: Not found
3210
+ content:
3211
+ application/problem+json:
3212
+ schema:
3213
+ $ref: "#/components/schemas/Problem"
3214
+ "409":
3215
+ description: Conflict
3216
+ content:
3217
+ application/problem+json:
3218
+ schema:
3219
+ $ref: "#/components/schemas/Problem"
3220
+ "422":
3221
+ description: Invalid input
3222
+ content:
3223
+ application/problem+json:
3224
+ schema:
3225
+ $ref: "#/components/schemas/Problem"
3226
+ "426":
3227
+ description: Client outdated
3228
+ content:
3229
+ application/problem+json:
3230
+ schema:
3231
+ $ref: "#/components/schemas/Problem"
3232
+ "429":
3233
+ description: Rate limited
3234
+ content:
3235
+ application/problem+json:
3236
+ schema:
3237
+ $ref: "#/components/schemas/Problem"
3238
+ "503":
3239
+ description: Passkeys are not configured
3240
+ content:
3241
+ application/problem+json:
3242
+ schema:
3243
+ $ref: "#/components/schemas/Problem"
3244
+ /auth/passkeys/login/verify:
3245
+ parameters: *a1
3246
+ post:
3247
+ tags:
3248
+ - auth
3249
+ operationId: verifyPasskeyLogin
3250
+ summary: Verify a passkey and create a session
3251
+ security: []
3252
+ requestBody:
3253
+ required: true
3254
+ content:
3255
+ application/json:
3256
+ schema:
3257
+ $ref: "#/components/schemas/PasskeyVerification"
3258
+ responses:
3259
+ "200":
3260
+ description: Success
3261
+ content:
3262
+ application/json:
3263
+ schema:
3264
+ $ref: "#/components/schemas/TokenResponse"
3265
+ "400":
3266
+ description: Bad request
3267
+ content:
3268
+ application/problem+json:
3269
+ schema:
3270
+ $ref: "#/components/schemas/Problem"
3271
+ "401":
3272
+ description: Unauthorized
3273
+ content:
3274
+ application/problem+json:
3275
+ schema:
3276
+ $ref: "#/components/schemas/Problem"
3277
+ "403":
3278
+ description: Forbidden
3279
+ content:
3280
+ application/problem+json:
3281
+ schema:
3282
+ $ref: "#/components/schemas/Problem"
3283
+ "404":
3284
+ description: Not found
3285
+ content:
3286
+ application/problem+json:
3287
+ schema:
3288
+ $ref: "#/components/schemas/Problem"
3289
+ "409":
3290
+ description: Conflict
3291
+ content:
3292
+ application/problem+json:
3293
+ schema:
3294
+ $ref: "#/components/schemas/Problem"
3295
+ "422":
3296
+ description: Invalid input
3297
+ content:
3298
+ application/problem+json:
3299
+ schema:
3300
+ $ref: "#/components/schemas/Problem"
3301
+ "426":
3302
+ description: Client outdated
3303
+ content:
3304
+ application/problem+json:
3305
+ schema:
3306
+ $ref: "#/components/schemas/Problem"
3307
+ "429":
3308
+ description: Rate limited
3309
+ content:
3310
+ application/problem+json:
3311
+ schema:
3312
+ $ref: "#/components/schemas/Problem"
3313
+ "503":
3314
+ description: Passkeys are not configured
3315
+ content:
3316
+ application/problem+json:
3317
+ schema:
3318
+ $ref: "#/components/schemas/Problem"
3319
+
3320
+ /me/recovery-status:
3321
+ parameters: &a1
3322
+ - $ref: "#/components/parameters/ClientVersion"
3323
+ - $ref: "#/components/parameters/ClientApiVersion"
3324
+ get:
3325
+ tags:
3326
+ - auth
3327
+ operationId: getRecoveryOverview
3328
+ summary: List recovery methods and their current setup status
3329
+ responses:
3330
+ "200":
3331
+ description: Success
3332
+ content:
3333
+ application/json:
3334
+ schema:
3335
+ $ref: "#/components/schemas/RecoveryOverview"
3336
+ "400":
3337
+ description: Invalid recovery credentials
3338
+ content:
3339
+ application/problem+json:
3340
+ schema:
3341
+ $ref: "#/components/schemas/Problem"
3342
+ "401":
3343
+ description: Unauthorized
3344
+ content:
3345
+ application/problem+json:
3346
+ schema:
3347
+ $ref: "#/components/schemas/Problem"
3348
+ "403":
3349
+ description: Forbidden
3350
+ content:
3351
+ application/problem+json:
3352
+ schema:
3353
+ $ref: "#/components/schemas/Problem"
3354
+ "409":
3355
+ description: Security delay or conflicting state
3356
+ content:
3357
+ application/problem+json:
3358
+ schema:
3359
+ $ref: "#/components/schemas/Problem"
3360
+ "422":
3361
+ description: Invalid input
3362
+ content:
3363
+ application/problem+json:
3364
+ schema:
3365
+ $ref: "#/components/schemas/Problem"
3366
+ "426":
3367
+ description: Client outdated
3368
+ content:
3369
+ application/problem+json:
3370
+ schema:
3371
+ $ref: "#/components/schemas/Problem"
3372
+ "429":
3373
+ description: Rate limited
3374
+ content:
3375
+ application/problem+json:
3376
+ schema:
3377
+ $ref: "#/components/schemas/Problem"
3378
+ "503":
3379
+ description: Email recovery is not configured
3380
+ content:
3381
+ application/problem+json:
3382
+ schema:
3383
+ $ref: "#/components/schemas/Problem"
3384
+ /me/email:
3385
+ parameters: *a1
3386
+ get:
3387
+ tags:
3388
+ - auth
3389
+ operationId: getRecoveryEmail
3390
+ summary: Get private recovery email status
3391
+ responses:
3392
+ "200":
3393
+ description: Success
3394
+ content:
3395
+ application/json:
3396
+ schema:
3397
+ $ref: "#/components/schemas/RecoveryEmailStatus"
3398
+ "400":
3399
+ description: Invalid recovery credentials
3400
+ content:
3401
+ application/problem+json:
3402
+ schema:
3403
+ $ref: "#/components/schemas/Problem"
3404
+ "401":
3405
+ description: Unauthorized
3406
+ content:
3407
+ application/problem+json:
3408
+ schema:
3409
+ $ref: "#/components/schemas/Problem"
3410
+ "403":
3411
+ description: Forbidden
3412
+ content:
3413
+ application/problem+json:
3414
+ schema:
3415
+ $ref: "#/components/schemas/Problem"
3416
+ "409":
3417
+ description: Security delay or conflicting state
3418
+ content:
3419
+ application/problem+json:
3420
+ schema:
3421
+ $ref: "#/components/schemas/Problem"
3422
+ "422":
3423
+ description: Invalid input
3424
+ content:
3425
+ application/problem+json:
3426
+ schema:
3427
+ $ref: "#/components/schemas/Problem"
3428
+ "426":
3429
+ description: Client outdated
3430
+ content:
3431
+ application/problem+json:
3432
+ schema:
3433
+ $ref: "#/components/schemas/Problem"
3434
+ "429":
3435
+ description: Rate limited
3436
+ content:
3437
+ application/problem+json:
3438
+ schema:
3439
+ $ref: "#/components/schemas/Problem"
3440
+ "503":
3441
+ description: Email recovery is not configured
3442
+ content:
3443
+ application/problem+json:
3444
+ schema:
3445
+ $ref: "#/components/schemas/Problem"
3446
+ put:
3447
+ tags:
3448
+ - auth
3449
+ operationId: setRecoveryEmail
3450
+ summary: Set or resend a private recovery email for verification
3451
+ requestBody:
3452
+ required: true
3453
+ content:
3454
+ application/json:
3455
+ schema:
3456
+ $ref: "#/components/schemas/SetRecoveryEmail"
3457
+ responses:
3458
+ "204":
3459
+ description: Success
3460
+ "400":
3461
+ description: Invalid recovery credentials
3462
+ content:
3463
+ application/problem+json:
3464
+ schema:
3465
+ $ref: "#/components/schemas/Problem"
3466
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
3467
+ "403":
3468
+ description: Forbidden
3469
+ content:
3470
+ application/problem+json:
3471
+ schema:
3472
+ $ref: "#/components/schemas/Problem"
3473
+ "409":
3474
+ description: Security delay or conflicting state
3475
+ content:
3476
+ application/problem+json:
3477
+ schema:
3478
+ $ref: "#/components/schemas/Problem"
3479
+ "422":
3480
+ description: Invalid input
3481
+ content:
3482
+ application/problem+json:
3483
+ schema:
3484
+ $ref: "#/components/schemas/Problem"
3485
+ "426":
3486
+ description: Client outdated
3487
+ content:
3488
+ application/problem+json:
3489
+ schema:
3490
+ $ref: "#/components/schemas/Problem"
3491
+ "429":
3492
+ description: Rate limited
3493
+ content:
3494
+ application/problem+json:
3495
+ schema:
3496
+ $ref: "#/components/schemas/Problem"
3497
+ "503":
3498
+ description: Email recovery is not configured
3499
+ content:
3500
+ application/problem+json:
3501
+ schema:
3502
+ $ref: "#/components/schemas/Problem"
3503
+ delete:
3504
+ tags:
3505
+ - auth
3506
+ operationId: removeRecoveryEmail
3507
+ summary: Remove the recovery email after password verification
3508
+ requestBody:
3509
+ required: true
3510
+ content:
3511
+ application/json:
3512
+ schema:
3513
+ $ref: "#/components/schemas/RemoveRecoveryEmail"
3514
+ responses:
3515
+ "204":
3516
+ description: Success
3517
+ "400":
3518
+ description: Invalid recovery credentials
3519
+ content:
3520
+ application/problem+json:
3521
+ schema:
3522
+ $ref: "#/components/schemas/Problem"
3523
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
3524
+ "403":
3525
+ description: Forbidden
3526
+ content:
3527
+ application/problem+json:
3528
+ schema:
3529
+ $ref: "#/components/schemas/Problem"
3530
+ "409":
3531
+ description: Security delay or conflicting state
3532
+ content:
3533
+ application/problem+json:
3534
+ schema:
3535
+ $ref: "#/components/schemas/Problem"
3536
+ "422":
3537
+ description: Invalid input
3538
+ content:
3539
+ application/problem+json:
3540
+ schema:
3541
+ $ref: "#/components/schemas/Problem"
3542
+ "426":
3543
+ description: Client outdated
3544
+ content:
3545
+ application/problem+json:
3546
+ schema:
3547
+ $ref: "#/components/schemas/Problem"
3548
+ "429":
3549
+ description: Rate limited
3550
+ content:
3551
+ application/problem+json:
3552
+ schema:
3553
+ $ref: "#/components/schemas/Problem"
3554
+ "503":
3555
+ description: Email recovery is not configured
3556
+ content:
3557
+ application/problem+json:
3558
+ schema:
3559
+ $ref: "#/components/schemas/Problem"
3560
+ /auth/email/verify:
3561
+ parameters: *a1
3562
+ post:
3563
+ tags:
3564
+ - auth
3565
+ operationId: verifyRecoveryEmail
3566
+ summary: Consume a one-time email verification token
3567
+ security: []
3568
+ requestBody:
3569
+ required: true
3570
+ content:
3571
+ application/json:
3572
+ schema:
3573
+ $ref: "#/components/schemas/VerifyRecoveryEmail"
3574
+ responses:
3575
+ "204":
3576
+ description: Success
3577
+ "400":
3578
+ description: Invalid recovery credentials
3579
+ content:
3580
+ application/problem+json:
3581
+ schema:
3582
+ $ref: "#/components/schemas/Problem"
3583
+ "401":
3584
+ description: Unauthorized
3585
+ content:
3586
+ application/problem+json:
3587
+ schema:
3588
+ $ref: "#/components/schemas/Problem"
3589
+ "403":
3590
+ description: Forbidden
3591
+ content:
3592
+ application/problem+json:
3593
+ schema:
3594
+ $ref: "#/components/schemas/Problem"
3595
+ "409":
3596
+ description: Security delay or conflicting state
3597
+ content:
3598
+ application/problem+json:
3599
+ schema:
3600
+ $ref: "#/components/schemas/Problem"
3601
+ "422":
3602
+ description: Invalid input
3603
+ content:
3604
+ application/problem+json:
3605
+ schema:
3606
+ $ref: "#/components/schemas/Problem"
3607
+ "426":
3608
+ description: Client outdated
3609
+ content:
3610
+ application/problem+json:
3611
+ schema:
3612
+ $ref: "#/components/schemas/Problem"
3613
+ "429":
3614
+ description: Rate limited
3615
+ content:
3616
+ application/problem+json:
3617
+ schema:
3618
+ $ref: "#/components/schemas/Problem"
3619
+ "503":
3620
+ description: Email recovery is not configured
3621
+ content:
3622
+ application/problem+json:
3623
+ schema:
3624
+ $ref: "#/components/schemas/Problem"
3625
+ /auth/password-reset/request:
3626
+ parameters: *a1
3627
+ post:
3628
+ tags:
3629
+ - auth
3630
+ operationId: requestEmailReset
3631
+ summary: Queue a recovery email without revealing whether an account exists
3632
+ security: []
3633
+ requestBody:
3634
+ required: true
3635
+ content:
3636
+ application/json:
3637
+ schema:
3638
+ $ref: "#/components/schemas/EmailResetRequest"
3639
+ responses:
3640
+ "202":
3641
+ description: Success
3642
+ content:
3643
+ application/json:
3644
+ schema:
3645
+ $ref: "#/components/schemas/EmailResetAccepted"
3646
+ "400":
3647
+ description: Invalid recovery credentials
3648
+ content:
3649
+ application/problem+json:
3650
+ schema:
3651
+ $ref: "#/components/schemas/Problem"
3652
+ "401":
3653
+ description: Unauthorized
3654
+ content:
3655
+ application/problem+json:
3656
+ schema:
3657
+ $ref: "#/components/schemas/Problem"
3658
+ "403":
3659
+ description: Forbidden
3660
+ content:
3661
+ application/problem+json:
3662
+ schema:
3663
+ $ref: "#/components/schemas/Problem"
3664
+ "409":
3665
+ description: Security delay or conflicting state
3666
+ content:
3667
+ application/problem+json:
3668
+ schema:
3669
+ $ref: "#/components/schemas/Problem"
3670
+ "422":
3671
+ description: Invalid input
3672
+ content:
3673
+ application/problem+json:
3674
+ schema:
3675
+ $ref: "#/components/schemas/Problem"
3676
+ "426":
3677
+ description: Client outdated
3678
+ content:
3679
+ application/problem+json:
3680
+ schema:
3681
+ $ref: "#/components/schemas/Problem"
3682
+ "429":
3683
+ description: Rate limited
3684
+ content:
3685
+ application/problem+json:
3686
+ schema:
3687
+ $ref: "#/components/schemas/Problem"
3688
+ "503":
3689
+ description: Email recovery is not configured
3690
+ content:
3691
+ application/problem+json:
3692
+ schema:
3693
+ $ref: "#/components/schemas/Problem"
3694
+ /auth/password-reset/confirm:
3695
+ parameters: *a1
3696
+ post:
3697
+ tags:
3698
+ - auth
3699
+ operationId: confirmEmailReset
3700
+ summary: Reset a password using a one-time email token and the current second
3701
+ factor
3702
+ security: []
3703
+ requestBody:
3704
+ required: true
3705
+ content:
3706
+ application/json:
3707
+ schema:
3708
+ $ref: "#/components/schemas/EmailResetConfirmation"
3709
+ responses:
3710
+ "200":
3711
+ description: Success
3712
+ content:
3713
+ application/json:
3714
+ schema:
3715
+ $ref: "#/components/schemas/RegisterResponse"
3716
+ "400":
3717
+ description: Invalid recovery credentials
3718
+ content:
3719
+ application/problem+json:
3720
+ schema:
3721
+ $ref: "#/components/schemas/Problem"
3722
+ "401": { $ref: "#/components/responses/TwoFactorRequired" }
3723
+ "403":
3724
+ description: Forbidden
3725
+ content:
3726
+ application/problem+json:
3727
+ schema:
3728
+ $ref: "#/components/schemas/Problem"
3729
+ "404":
3730
+ $ref: "#/components/responses/NotFound"
3731
+ "409":
3732
+ description: Security delay or conflicting state
3733
+ content:
3734
+ application/problem+json:
3735
+ schema:
3736
+ $ref: "#/components/schemas/Problem"
3737
+ "422":
3738
+ description: Invalid input
3739
+ content:
3740
+ application/problem+json:
3741
+ schema:
3742
+ $ref: "#/components/schemas/Problem"
3743
+ "426":
3744
+ description: Client outdated
3745
+ content:
3746
+ application/problem+json:
3747
+ schema:
3748
+ $ref: "#/components/schemas/Problem"
3749
+ "429":
3750
+ description: Rate limited
3751
+ content:
3752
+ application/problem+json:
3753
+ schema:
3754
+ $ref: "#/components/schemas/Problem"
3755
+ "503":
3756
+ description: Email recovery is not configured
3757
+ content:
3758
+ application/problem+json:
3759
+ schema:
3760
+ $ref: "#/components/schemas/Problem"
3761
+
3762
+ /calls/config:
3763
+ parameters:
3764
+ - $ref: "#/components/parameters/ClientVersion"
3765
+ - $ref: "#/components/parameters/ClientApiVersion"
3766
+ get:
3767
+ tags: [calls]
3768
+ operationId: getCallConfig
3769
+ summary: Whether audio calls are available and their limits
3770
+ description: |
3771
+ `enabled` is `false` when the server has no media service configured or calls are switched off; clients then
3772
+ hide every call control. Clients must also check that the browser supports call encryption before offering
3773
+ calls.
3774
+ responses:
3775
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3776
+ "400": { $ref: "#/components/responses/BadRequest" }
3777
+ "200":
3778
+ description: Call availability
3779
+ content:
3780
+ application/json:
3781
+ schema: { $ref: "#/components/schemas/CallConfig" }
3782
+ "401": { $ref: "#/components/responses/Unauthorized" }
3783
+ /me/call-identity:
3784
+ parameters:
3785
+ - $ref: "#/components/parameters/ClientVersion"
3786
+ - $ref: "#/components/parameters/ClientApiVersion"
3787
+ put:
3788
+ tags: [calls]
3789
+ operationId: setCallIdentity
3790
+ summary: Register this session's call identity public key
3791
+ description: |
3792
+ One key per session (see `docs/calls-e2ee.md`). Registering a different key replaces the old one; if the
3793
+ session is in a call, the call's epoch increases. The private key never leaves the client.
3794
+ requestBody:
3795
+ required: true
3796
+ content:
3797
+ application/json:
3798
+ schema: { $ref: "#/components/schemas/CallIdentityRequest" }
3799
+ responses:
3800
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3801
+ "400": { $ref: "#/components/responses/BadRequest" }
3802
+ "204":
3803
+ description: Stored
3804
+ "401": { $ref: "#/components/responses/Unauthorized" }
3805
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3806
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3807
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3808
+ /calls:
3809
+ parameters:
3810
+ - $ref: "#/components/parameters/ClientVersion"
3811
+ - $ref: "#/components/parameters/ClientApiVersion"
3812
+ get:
3813
+ tags: [calls]
3814
+ operationId: listMyCalls
3815
+ summary: Calls that are not over and involve the current user
3816
+ description: |
3817
+ Calls ringing the user and calls the user has joined, newest first. Clients load this after every
3818
+ (re)connect, because realtime events are best effort.
3819
+ responses:
3820
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3821
+ "400": { $ref: "#/components/responses/BadRequest" }
3822
+ "200":
3823
+ description: Current calls
3824
+ content:
3825
+ application/json:
3826
+ schema: { $ref: "#/components/schemas/CallList" }
3827
+ "401": { $ref: "#/components/responses/Unauthorized" }
3828
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3829
+ /chats/{chat_id}/call:
3830
+ parameters:
3831
+ - $ref: "#/components/parameters/ClientVersion"
3832
+ - $ref: "#/components/parameters/ClientApiVersion"
3833
+ - $ref: "#/components/parameters/ChatId"
3834
+ get:
3835
+ tags: [calls]
3836
+ operationId: getChatCall
3837
+ summary: The chat's call that is not over
3838
+ responses:
3839
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3840
+ "400": { $ref: "#/components/responses/BadRequest" }
3841
+ "200":
3842
+ description: The current call of the chat
3843
+ content:
3844
+ application/json:
3845
+ schema: { $ref: "#/components/schemas/Call" }
3846
+ "401": { $ref: "#/components/responses/Unauthorized" }
3847
+ "404": { $ref: "#/components/responses/NotFound" }
3848
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3849
+ post:
3850
+ tags: [calls]
3851
+ operationId: startChatCall
3852
+ summary: Start a call in the chat, or get the one already running
3853
+ description: |
3854
+ Starts ringing the other members. A chat has at most one call that is not over: when one exists it is
3855
+ returned with `200` and the client joins it instead. `client_request_id` makes retries idempotent for
3856
+ 24 hours. Starting does not join: the caller then calls `POST /calls/{call_id}/join`.
3857
+
3858
+ Refused with `403` (`calls_not_allowed`) when the peer of a direct chat has calls turned off or one user
3859
+ blocked the other, `503` (`calls_unavailable`) when calls are off on the server.
3860
+ requestBody:
3861
+ required: true
3862
+ content:
3863
+ application/json:
3864
+ schema: { $ref: "#/components/schemas/StartCallRequest" }
3865
+ responses:
3866
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3867
+ "400": { $ref: "#/components/responses/BadRequest" }
3868
+ "200":
3869
+ description: A call was already running in the chat
3870
+ content:
3871
+ application/json:
3872
+ schema: { $ref: "#/components/schemas/Call" }
3873
+ "201":
3874
+ description: The new call, ringing
3875
+ content:
3876
+ application/json:
3877
+ schema: { $ref: "#/components/schemas/Call" }
3878
+ "401": { $ref: "#/components/responses/Unauthorized" }
3879
+ "403": { $ref: "#/components/responses/Forbidden" }
3880
+ "404": { $ref: "#/components/responses/NotFound" }
3881
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3882
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3883
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3884
+ /calls/{call_id}:
3885
+ parameters:
3886
+ - $ref: "#/components/parameters/ClientVersion"
3887
+ - $ref: "#/components/parameters/ClientApiVersion"
3888
+ - $ref: "#/components/parameters/CallId"
3889
+ get:
3890
+ tags: [calls]
3891
+ operationId: getCall
3892
+ summary: A call of one of the user's chats
3893
+ description: Ended calls stay readable for 90 days.
3894
+ responses:
3895
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3896
+ "400": { $ref: "#/components/responses/BadRequest" }
3897
+ "200":
3898
+ description: The call
3899
+ content:
3900
+ application/json:
3901
+ schema: { $ref: "#/components/schemas/Call" }
3902
+ "401": { $ref: "#/components/responses/Unauthorized" }
3903
+ "404": { $ref: "#/components/responses/NotFound" }
3904
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3905
+ /calls/{call_id}/join:
3906
+ parameters:
3907
+ - $ref: "#/components/parameters/ClientVersion"
3908
+ - $ref: "#/components/parameters/ClientApiVersion"
3909
+ - $ref: "#/components/parameters/CallId"
3910
+ post:
3911
+ tags: [calls]
3912
+ operationId: joinCall
3913
+ summary: Answer or join a call with this session
3914
+ description: |
3915
+ Answers a ringing call or joins a running group call, and returns a short-lived media grant for this
3916
+ session. The session must have a call identity (`422`, `call_identity_required`). A user is in at most one
3917
+ call with one session: `409` (`already_in_call`) unless `takeover` is `true`, which moves the user's
3918
+ participation to this session (the other session is removed from the media room). Other `409` codes:
3919
+ `call_ended`, `call_full`. The epoch of the call increases. The body is optional: no body, an empty body
3920
+ and `{}` all join without takeover.
3921
+ requestBody:
3922
+ required: false
3923
+ content:
3924
+ application/json:
3925
+ schema: { $ref: "#/components/schemas/JoinCallRequest" }
3926
+ responses:
3927
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3928
+ "400": { $ref: "#/components/responses/BadRequest" }
3929
+ "200":
3930
+ description: Joined
3931
+ content:
3932
+ application/json:
3933
+ schema: { $ref: "#/components/schemas/CallJoin" }
3934
+ "401": { $ref: "#/components/responses/Unauthorized" }
3935
+ "403": { $ref: "#/components/responses/Forbidden" }
3936
+ "404": { $ref: "#/components/responses/NotFound" }
3937
+ "409": { $ref: "#/components/responses/Conflict" }
3938
+ "422": { $ref: "#/components/responses/ValidationFailed" }
3939
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3940
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3941
+ /calls/{call_id}/grant:
3942
+ parameters:
3943
+ - $ref: "#/components/parameters/ClientVersion"
3944
+ - $ref: "#/components/parameters/ClientApiVersion"
3945
+ - $ref: "#/components/parameters/CallId"
3946
+ post:
3947
+ tags: [calls]
3948
+ operationId: renewCallGrant
3949
+ summary: A fresh media grant for the session that joined
3950
+ description: For reconnecting to the media server. Only the session that joined gets one (`409` otherwise).
3951
+ responses:
3952
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3953
+ "400": { $ref: "#/components/responses/BadRequest" }
3954
+ "200":
3955
+ description: The grant
3956
+ content:
3957
+ application/json:
3958
+ schema: { $ref: "#/components/schemas/CallGrant" }
3959
+ "401": { $ref: "#/components/responses/Unauthorized" }
3960
+ "404": { $ref: "#/components/responses/NotFound" }
3961
+ "409": { $ref: "#/components/responses/Conflict" }
3962
+ "429": { $ref: "#/components/responses/TooManyRequests" }
3963
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3964
+ /calls/{call_id}/decline:
3965
+ parameters:
3966
+ - $ref: "#/components/parameters/ClientVersion"
3967
+ - $ref: "#/components/parameters/ClientApiVersion"
3968
+ - $ref: "#/components/parameters/CallId"
3969
+ post:
3970
+ tags: [calls]
3971
+ operationId: declineCall
3972
+ summary: Decline a ringing call
3973
+ description: |
3974
+ Stops the ringing on all of the user's devices. In a direct call this ends the call (`declined`); in a group
3975
+ call only this user's invitation ends. Declining a call that no longer rings changes nothing.
3976
+ responses:
3977
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3978
+ "400": { $ref: "#/components/responses/BadRequest" }
3979
+ "204":
3980
+ description: Declined
3981
+ "401": { $ref: "#/components/responses/Unauthorized" }
3982
+ "404": { $ref: "#/components/responses/NotFound" }
3983
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
3984
+ /calls/{call_id}/leave:
3985
+ parameters:
3986
+ - $ref: "#/components/parameters/ClientVersion"
3987
+ - $ref: "#/components/parameters/ClientApiVersion"
3988
+ - $ref: "#/components/parameters/CallId"
3989
+ post:
3990
+ tags: [calls]
3991
+ operationId: leaveCall
3992
+ summary: Leave the call
3993
+ description: |
3994
+ A direct call ends when either side leaves. A group call ends when the last participant has left and the
3995
+ short reconnect grace has passed. The caller leaving a call nobody answered cancels it (`cancelled`).
3996
+ responses:
3997
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3998
+ "400": { $ref: "#/components/responses/BadRequest" }
3999
+ "204":
4000
+ description: Left
4001
+ "401": { $ref: "#/components/responses/Unauthorized" }
4002
+ "404": { $ref: "#/components/responses/NotFound" }
4003
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
4004
+ /calls/{call_id}/end:
4005
+ parameters:
4006
+ - $ref: "#/components/parameters/ClientVersion"
4007
+ - $ref: "#/components/parameters/ClientApiVersion"
4008
+ - $ref: "#/components/parameters/CallId"
4009
+ post:
4010
+ tags: [calls]
4011
+ operationId: endCall
4012
+ summary: End the call for everyone
4013
+ description: |
4014
+ Allowed for the initiator, for both members of a direct call, and for the owner, admins and moderators of a
4015
+ group (`403` otherwise). Everyone is removed from the media room.
1830
4016
  responses:
4017
+ "426": { $ref: "#/components/responses/ClientOutdated" }
4018
+ "400": { $ref: "#/components/responses/BadRequest" }
1831
4019
  "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:
4020
+ description: Ended
4021
+ "401": { $ref: "#/components/responses/Unauthorized" }
4022
+ "403": { $ref: "#/components/responses/Forbidden" }
4023
+ "404": { $ref: "#/components/responses/NotFound" }
4024
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
4025
+ /calls/{call_id}/keys:
1842
4026
  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
4027
+ - $ref: "#/components/parameters/ClientVersion"
4028
+ - $ref: "#/components/parameters/ClientApiVersion"
4029
+ - $ref: "#/components/parameters/CallId"
4030
+ get:
4031
+ tags: [calls]
4032
+ operationId: getCallKeys
4033
+ summary: Key envelopes addressed to this session in the current epoch
4034
+ description: For catching up after a reconnect; the same envelopes also arrive as `call_keys` events.
4035
+ responses:
4036
+ "426": { $ref: "#/components/responses/ClientOutdated" }
4037
+ "400": { $ref: "#/components/responses/BadRequest" }
4038
+ "200":
4039
+ description: The envelopes
4040
+ content:
4041
+ application/json:
4042
+ schema: { $ref: "#/components/schemas/CallKeyEnvelopeList" }
4043
+ "401": { $ref: "#/components/responses/Unauthorized" }
4044
+ "404": { $ref: "#/components/responses/NotFound" }
4045
+ "409": { $ref: "#/components/responses/Conflict" }
4046
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
4047
+ post:
4048
+ tags: [calls]
4049
+ operationId: sendCallKeys
4050
+ summary: Send this session's sealed sender key to the other participants
4051
+ description: |
4052
+ Relays opaque HPKE envelopes (see `docs/calls-e2ee.md`). Only the session that joined may send, only for the
4053
+ current epoch (`409`, `stale_epoch`), and only to sessions on the roster of that epoch (`422`). The server
4054
+ never sees a plaintext key.
1854
4055
  requestBody:
1855
4056
  required: true
1856
4057
  content:
1857
4058
  application/json:
1858
- schema:
1859
- $ref: "#/components/schemas/NotificationActivity"
4059
+ schema: { $ref: "#/components/schemas/SendCallKeysRequest" }
1860
4060
  responses:
4061
+ "426": { $ref: "#/components/responses/ClientOutdated" }
4062
+ "400": { $ref: "#/components/responses/BadRequest" }
1861
4063
  "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"
4064
+ description: Relayed
4065
+ "401": { $ref: "#/components/responses/Unauthorized" }
4066
+ "404": { $ref: "#/components/responses/NotFound" }
4067
+ "409": { $ref: "#/components/responses/Conflict" }
4068
+ "422": { $ref: "#/components/responses/ValidationFailed" }
4069
+ "429": { $ref: "#/components/responses/TooManyRequests" }
4070
+ "503": { $ref: "#/components/responses/CallsUnavailable" }
1871
4071
 
1872
4072
  components:
1873
4073
  securitySchemes:
@@ -1888,6 +4088,12 @@ components:
1888
4088
  schema: { type: string }
1889
4089
 
1890
4090
  parameters:
4091
+ QrLoginRequestId:
4092
+ name: requestId
4093
+ in: path
4094
+ required: true
4095
+ description: ID of a QR sign-in request, from the QR code link `/qr/<request_id>`.
4096
+ schema: { type: string, minLength: 32, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" }
1891
4097
  Limit:
1892
4098
  name: limit
1893
4099
  in: query
@@ -1923,11 +4129,31 @@ components:
1923
4129
  in: path
1924
4130
  required: true
1925
4131
  schema: { $ref: "#/components/schemas/AttachmentRef" }
4132
+ StickerPackId:
4133
+ name: pack_id
4134
+ in: path
4135
+ required: true
4136
+ schema: { $ref: "#/components/schemas/Id" }
4137
+ StickerId:
4138
+ name: sticker_id
4139
+ in: path
4140
+ required: true
4141
+ schema: { $ref: "#/components/schemas/Id" }
4142
+ StickerPackSlug:
4143
+ name: slug
4144
+ in: path
4145
+ required: true
4146
+ schema: { $ref: "#/components/schemas/StickerPackSlug" }
1926
4147
  SessionId:
1927
4148
  name: session_id
1928
4149
  in: path
1929
4150
  required: true
1930
4151
  schema: { type: string, format: uuid }
4152
+ CallId:
4153
+ name: call_id
4154
+ in: path
4155
+ required: true
4156
+ schema: { $ref: "#/components/schemas/Id" }
1931
4157
 
1932
4158
  ClientVersion:
1933
4159
  name: X-Client-Version
@@ -1958,6 +4184,17 @@ components:
1958
4184
  content:
1959
4185
  application/problem+json:
1960
4186
  schema: { $ref: "#/components/schemas/Problem" }
4187
+ TwoFactorRequired:
4188
+ description: |
4189
+ Missing, invalid or expired credentials, or `code: two_factor_required`. `two_factor_required` means every
4190
+ other credential in the request was valid, the account has two-factor on, and no `code` was sent. Nothing
4191
+ single-use (recovery key, email token, recovery request) was consumed: send the same request again with
4192
+ `code`. Invalid other credentials get the usual error of the operation instead, whatever the two-factor
4193
+ state, and a wrong `code` keeps its usual error. On operations that need an access token this 401 does not
4194
+ mean the session is lost; tell the two apart by `code`.
4195
+ content:
4196
+ application/problem+json:
4197
+ schema: { $ref: "#/components/schemas/Problem" }
1961
4198
  Forbidden:
1962
4199
  description: Authenticated but not allowed
1963
4200
  content:
@@ -1997,6 +4234,18 @@ components:
1997
4234
  content:
1998
4235
  application/problem+json:
1999
4236
  schema: { $ref: "#/components/schemas/Problem" }
4237
+ CallsUnavailable:
4238
+ description: |
4239
+ Calls are switched off on the server, or the server is at its call capacity (both `calls_unavailable`), or
4240
+ the media service or a store is away for a moment (`internal_error`). Retry after `Retry-After` when it is
4241
+ present; without it calls stay off until `GET /calls/config` reports them enabled.
4242
+ headers:
4243
+ Retry-After:
4244
+ description: Seconds until a retry may succeed
4245
+ schema: { type: integer, minimum: 0 }
4246
+ content:
4247
+ application/problem+json:
4248
+ schema: { $ref: "#/components/schemas/Problem" }
2000
4249
 
2001
4250
  schemas:
2002
4251
  NotificationPreferences:
@@ -2149,6 +4398,16 @@ components:
2149
4398
  - invalid_client_version
2150
4399
  - blocked_by_user
2151
4400
  - approval_required
4401
+ - user_verification_required
4402
+ - session_too_new
4403
+ - calls_unavailable
4404
+ - calls_not_allowed
4405
+ - call_identity_required
4406
+ - call_full
4407
+ - call_ended
4408
+ - already_in_call
4409
+ - stale_epoch
4410
+ - limit_reached
2152
4411
  - internal_error
2153
4412
  Problem:
2154
4413
  type: object
@@ -2259,20 +4518,25 @@ components:
2259
4518
  type: array
2260
4519
  items:
2261
4520
  type: object
2262
- required: [id, type, created_at]
4521
+ required: [id, type, created_at, location]
2263
4522
  properties:
2264
4523
  id: { $ref: "#/components/schemas/Id" }
2265
4524
  type: { type: string }
2266
4525
  created_at: { type: string, format: date-time }
4526
+ user_agent: { type: [string, "null"], maxLength: 512 }
4527
+ location:
4528
+ description: Approximate location of the client when the event happened; `null` when unknown.
4529
+ oneOf:
4530
+ - $ref: "#/components/schemas/Location"
4531
+ - type: "null"
2267
4532
  RegisterResponse:
2268
4533
  allOf:
2269
4534
  - $ref: "#/components/schemas/TokenResponse"
2270
4535
  - type: object
2271
- description: Recovery parts of the temporary recovery flow (redesigned in release 1.1).
4536
+ description: The one-time recovery key shown after registration.
2272
4537
  properties:
2273
4538
  recovery_key: { type: string, description: Shown once; only a keyed hash is stored }
2274
- device_part: { type: string }
2275
- qr_part: { type: string }
4539
+ username: { $ref: "#/components/schemas/Username" }
2276
4540
  TwoFactorChallenge:
2277
4541
  type: object
2278
4542
  required: [two_factor_required, login_challenge]
@@ -2283,24 +4547,6 @@ components:
2283
4547
  oneOf:
2284
4548
  - $ref: "#/components/schemas/TokenResponse"
2285
4549
  - $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
4550
  WebSocketTicket:
2305
4551
  type: object
2306
4552
  required: [ticket, expires_in]
@@ -2347,7 +4593,7 @@ components:
2347
4593
  session_duration_days: { type: integer, minimum: 1, maximum: 365 }
2348
4594
  Session:
2349
4595
  type: object
2350
- required: [id, created_at, last_used_at, is_current]
4596
+ required: [id, created_at, last_used_at, is_current, location]
2351
4597
  properties:
2352
4598
  id: { type: string, format: uuid }
2353
4599
  device:
@@ -2357,6 +4603,25 @@ components:
2357
4603
  last_used_at: { $ref: "#/components/schemas/Timestamp" }
2358
4604
  expires_at: { $ref: "#/components/schemas/Timestamp" }
2359
4605
  is_current: { type: boolean }
4606
+ location:
4607
+ description: Approximate location of the device when it signed in or last refreshed its token; `null` when unknown.
4608
+ oneOf:
4609
+ - $ref: "#/components/schemas/Location"
4610
+ - type: "null"
4611
+ Location:
4612
+ type: object
4613
+ description: |
4614
+ Approximate location of a client address, looked up in an offline GeoIP database (IP geolocation by
4615
+ DB-IP, https://db-ip.com, CC BY 4.0). The address itself is never exposed. Each field is `null` when the
4616
+ database does not know it; clients localise the country name from `country_code`.
4617
+ required: [city, country_code, country]
4618
+ properties:
4619
+ city: { type: [string, "null"], description: City name in English }
4620
+ country_code:
4621
+ type: [string, "null"]
4622
+ pattern: "^[A-Z]{2}$"
4623
+ description: ISO 3166-1 alpha-2 country code
4624
+ country: { type: [string, "null"], description: Country name in English }
2360
4625
  TwoFactorSetup:
2361
4626
  type: object
2362
4627
  required: [secret, otpauth_uri]
@@ -2378,7 +4643,7 @@ components:
2378
4643
  description: One-time codes for signing in without the authenticator app. Shown only once.
2379
4644
  DisableTwoFactorRequest:
2380
4645
  type: object
2381
- required: [password, code]
4646
+ required: [password]
2382
4647
  properties:
2383
4648
  password: { type: string, maxLength: 128, writeOnly: true }
2384
4649
  code:
@@ -2387,7 +4652,9 @@ components:
2387
4652
  description: A code of the authenticator app, or an unused recovery code.
2388
4653
  Visibility:
2389
4654
  type: string
2390
- description: Who may see the item. `*_except` scopes use the exception lists.
4655
+ description: |
4656
+ Who may see the item. The exception lists apply to every value; `*_except` behave like `everyone` and `nobody`.
4657
+ `contacts` are the users you share a group with, or a direct chat that you opened or read in.
2391
4658
  enum: [everyone, contacts, everyone_except, nobody_except, nobody]
2392
4659
  DirectMessagePolicy:
2393
4660
  type: string
@@ -2400,7 +4667,7 @@ components:
2400
4667
  enum: [everyone, nobody]
2401
4668
  PrivacyExceptions:
2402
4669
  type: object
2403
- description: User IDs per setting; `allow` applies to `nobody_except`, `deny` to `everyone_except`.
4670
+ 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
4671
  additionalProperties:
2405
4672
  type: object
2406
4673
  required: [allow, deny]
@@ -2421,6 +4688,8 @@ components:
2421
4688
  - direct_messages
2422
4689
  - group_invites
2423
4690
  - search_visibility
4691
+ - calls_enabled
4692
+ - typing_indicators_enabled
2424
4693
  - exceptions
2425
4694
  properties:
2426
4695
  avatar_visibility: { $ref: "#/components/schemas/Visibility" }
@@ -2430,6 +4699,12 @@ components:
2430
4699
  direct_messages: { $ref: "#/components/schemas/DirectMessagePolicy" }
2431
4700
  group_invites: { $ref: "#/components/schemas/GroupInvitePolicy" }
2432
4701
  search_visibility: { $ref: "#/components/schemas/SearchVisibility" }
4702
+ calls_enabled:
4703
+ type: boolean
4704
+ description: Whether others may ring this user. Calls are only possible from an existing direct chat or a shared group.
4705
+ typing_indicators_enabled:
4706
+ type: boolean
4707
+ description: Whether other members see that this user is typing or recording a voice message. The user still sees theirs.
2433
4708
  exceptions: { $ref: "#/components/schemas/PrivacyExceptions" }
2434
4709
  UpdatePrivacySettingsRequest:
2435
4710
  type: object
@@ -2442,6 +4717,8 @@ components:
2442
4717
  direct_messages: { $ref: "#/components/schemas/DirectMessagePolicy" }
2443
4718
  group_invites: { $ref: "#/components/schemas/GroupInvitePolicy" }
2444
4719
  search_visibility: { $ref: "#/components/schemas/SearchVisibility" }
4720
+ calls_enabled: { type: boolean }
4721
+ typing_indicators_enabled: { type: boolean }
2445
4722
  PrivacyExceptionsRequest:
2446
4723
  type: object
2447
4724
  required: [user_ids]
@@ -2465,7 +4742,7 @@ components:
2465
4742
  description: The requesting user's own name for this user, if set.
2466
4743
  avatar_url:
2467
4744
  type: [string, "null"]
2468
- description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
4745
+ description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
2469
4746
  bio: { type: [string, "null"] }
2470
4747
  is_online: { type: boolean }
2471
4748
  last_seen:
@@ -2508,7 +4785,11 @@ components:
2508
4785
  enum: [image, audio, voice, video, file]
2509
4786
  UploadPurpose:
2510
4787
  type: string
2511
- enum: [message, avatar]
4788
+ description: |
4789
+ `sticker`: a PNG, JPEG or still WebP of at most 5 MB. The server fits it into 512 x 512 px with a transparent
4790
+ border and stores a WebP (`413` when that is still over 512 KB). Only its uploader can load it until it is
4791
+ added to a pack.
4792
+ enum: [message, avatar, sticker]
2512
4793
  UploadAttachmentRequest:
2513
4794
  type: object
2514
4795
  required: [file, purpose]
@@ -2548,18 +4829,212 @@ components:
2548
4829
  width: { type: [integer, "null"], minimum: 1 }
2549
4830
  height: { type: [integer, "null"], minimum: 1 }
2550
4831
  thumbnail_url: { type: [string, "null"], readOnly: true }
4832
+ display_url:
4833
+ type: [string, "null"]
4834
+ readOnly: true
4835
+ 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
4836
  duration_ms: { type: [integer, "null"], minimum: 0 }
2552
4837
  waveform:
2553
4838
  type: [array, "null"]
2554
4839
  items: { type: integer, minimum: 0, maximum: 255 }
4840
+ drawing:
4841
+ description: |
4842
+ What the sender drew on this image of this message. Clients show the image with the drawing on top
4843
+ and never without it. Absent when the image has no drawing. The same image can carry another drawing
4844
+ in another message.
4845
+ $ref: "#/components/schemas/Drawing"
4846
+ Drawing:
4847
+ type: object
4848
+ description: |
4849
+ Strokes and text labels on an image. Coordinates, widths and sizes are fractions of the image as it is
4850
+ shown (0 is the left or top edge, 1 the right or bottom edge), so the drawing fits any display size.
4851
+ Items are drawn in order. The server rounds numbers to four decimals.
4852
+ required: [version, items]
4853
+ additionalProperties: false
4854
+ properties:
4855
+ version: { type: integer, minimum: 1, maximum: 1 }
4856
+ items:
4857
+ type: array
4858
+ minItems: 1
4859
+ maxItems: 200
4860
+ items: { $ref: "#/components/schemas/DrawingItem" }
4861
+ DrawingItem:
4862
+ type: object
4863
+ required: [type, color]
4864
+ additionalProperties: false
4865
+ properties:
4866
+ type:
4867
+ type: string
4868
+ enum: [stroke, text]
4869
+ color:
4870
+ type: string
4871
+ pattern: "^#[0-9a-fA-F]{6}$"
4872
+ width:
4873
+ type: number
4874
+ format: double
4875
+ minimum: 0.001
4876
+ maximum: 0.2
4877
+ description: Stroke only. Line width as a fraction of the image width.
4878
+ points:
4879
+ type: array
4880
+ minItems: 2
4881
+ maxItems: 10000
4882
+ description: Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes.
4883
+ items: { type: number, format: double, minimum: 0, maximum: 1 }
4884
+ x: { type: number, format: double, minimum: 0, maximum: 1, description: Text only. Left edge of the label. }
4885
+ y: { type: number, format: double, minimum: 0, maximum: 1, description: Text only. Top edge of the label. }
4886
+ size:
4887
+ type: number
4888
+ format: double
4889
+ minimum: 0.01
4890
+ maximum: 0.5
4891
+ description: Text only. Font height as a fraction of the image height.
4892
+ text: { type: string, minLength: 1, maxLength: 200, description: Text only. }
4893
+ if:
4894
+ properties:
4895
+ type: { const: stroke }
4896
+ then:
4897
+ required: [width, points]
4898
+ properties:
4899
+ width: { type: number }
4900
+ points: { type: array }
4901
+ x: { not: {} }
4902
+ y: { not: {} }
4903
+ size: { not: {} }
4904
+ text: { not: {} }
4905
+ else:
4906
+ required: [x, y, size, text]
4907
+ properties:
4908
+ x: { type: number }
4909
+ y: { type: number }
4910
+ size: { type: number }
4911
+ text: { type: string }
4912
+ width: { not: {} }
4913
+ points: { not: {} }
4914
+ AttachmentDrawing:
4915
+ type: object
4916
+ required: [attachment_id, drawing]
4917
+ additionalProperties: false
4918
+ properties:
4919
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
4920
+ drawing: { $ref: "#/components/schemas/Drawing" }
2555
4921
  MediaKind:
2556
4922
  type: string
2557
- enum: [image, audio]
4923
+ enum: [image, audio, visual]
2558
4924
 
2559
4925
  # -------------------------------------------------------- messages
2560
4926
  MessageType:
2561
4927
  type: string
2562
- enum: [text, file, voice, system]
4928
+ enum: [text, file, voice, system, sticker]
4929
+ Sticker:
4930
+ type: object
4931
+ description: |
4932
+ One sticker of a pack. `image` is a WebP or PNG of at most 512 x 512 px with transparency, animated when
4933
+ `is_animated` is true; any signed-in user can load it. Clients show it without a bubble.
4934
+ required: [id, pack_id, emoji, is_animated, image]
4935
+ properties:
4936
+ id: { $ref: "#/components/schemas/Id" }
4937
+ pack_id: { $ref: "#/components/schemas/Id" }
4938
+ pack_slug:
4939
+ allOf: [{ $ref: "#/components/schemas/StickerPackSlug" }]
4940
+ description: |
4941
+ The share link of the sticker's pack when a user made it; missing for built-in packs. A client that
4942
+ shows the pack of a sticker someone sent opens it with `GET /stickers/links/{slug}`.
4943
+ emoji:
4944
+ type: string
4945
+ minLength: 1
4946
+ maxLength: 32
4947
+ description: The emoji the sticker stands for, for previews, notifications and search.
4948
+ is_animated: { type: boolean }
4949
+ image: { $ref: "#/components/schemas/Attachment" }
4950
+ StickerPackSlug:
4951
+ type: string
4952
+ pattern: "^[A-Za-z0-9]{8,32}$"
4953
+ StickerPack:
4954
+ type: object
4955
+ required: [id, title, is_official, is_installed, is_mine, is_hidden, stickers]
4956
+ properties:
4957
+ id: { $ref: "#/components/schemas/Id" }
4958
+ title: { type: string, minLength: 1, maxLength: 64 }
4959
+ is_official:
4960
+ type: boolean
4961
+ description: A built-in pack of the messenger, not made by a user.
4962
+ is_installed:
4963
+ type: boolean
4964
+ description: The pack is in the user's sticker panel.
4965
+ is_mine:
4966
+ type: boolean
4967
+ description: The user made the pack and may change it.
4968
+ is_hidden:
4969
+ type: boolean
4970
+ description: Hidden after reports; only the owner sees such a pack, and nobody can send from it.
4971
+ owner_id: { $ref: "#/components/schemas/Id" }
4972
+ slug:
4973
+ allOf: [{ $ref: "#/components/schemas/StickerPackSlug" }]
4974
+ description: The share link of a pack a user made; missing for built-in packs.
4975
+ stickers:
4976
+ type: array
4977
+ maxItems: 120
4978
+ items: { $ref: "#/components/schemas/Sticker" }
4979
+ StickerPackList:
4980
+ type: object
4981
+ required: [items]
4982
+ properties:
4983
+ items:
4984
+ type: array
4985
+ maxItems: 200
4986
+ items: { $ref: "#/components/schemas/StickerPack" }
4987
+ CreateStickerPackRequest:
4988
+ type: object
4989
+ additionalProperties: false
4990
+ required: [title]
4991
+ properties:
4992
+ title: { type: string, minLength: 1, maxLength: 64 }
4993
+ UpdateStickerPackRequest:
4994
+ type: object
4995
+ additionalProperties: false
4996
+ required: [title]
4997
+ properties:
4998
+ title: { type: string, minLength: 1, maxLength: 64 }
4999
+ AddStickerRequest:
5000
+ type: object
5001
+ additionalProperties: false
5002
+ required: [attachment_id, emoji]
5003
+ properties:
5004
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
5005
+ emoji: { type: string, minLength: 1, maxLength: 32 }
5006
+ UpdateStickerRequest:
5007
+ type: object
5008
+ additionalProperties: false
5009
+ required: [emoji]
5010
+ properties:
5011
+ emoji: { type: string, minLength: 1, maxLength: 32 }
5012
+ ReorderStickersRequest:
5013
+ type: object
5014
+ additionalProperties: false
5015
+ required: [sticker_ids]
5016
+ properties:
5017
+ sticker_ids:
5018
+ type: array
5019
+ maxItems: 120
5020
+ items: { $ref: "#/components/schemas/Id" }
5021
+ StickerPackReportReason:
5022
+ type: string
5023
+ enum: [spam, violence, sexual, hate, copyright, other]
5024
+ ReportStickerPackRequest:
5025
+ type: object
5026
+ additionalProperties: false
5027
+ required: [reason]
5028
+ properties:
5029
+ reason: { $ref: "#/components/schemas/StickerPackReportReason" }
5030
+ StickerList:
5031
+ type: object
5032
+ required: [items]
5033
+ properties:
5034
+ items:
5035
+ type: array
5036
+ maxItems: 20
5037
+ items: { $ref: "#/components/schemas/Sticker" }
2563
5038
  Reaction:
2564
5039
  type: object
2565
5040
  required: [emoji, user_id]
@@ -2582,6 +5057,29 @@ components:
2582
5057
  - $ref: "#/components/schemas/Id"
2583
5058
  - type: "null"
2584
5059
  sender_name: { type: string }
5060
+ ReplyPreview:
5061
+ type: object
5062
+ description: |
5063
+ What a reply shows of the message it answers, so a client can draw the quote without loading that
5064
+ message. Set on messages of history pages and `message` events when the recipient can see the answered
5065
+ message; absent when it is gone or hidden for them, and on chat-list previews and search results.
5066
+ required: [id, type, sender, content, attachment, is_deleted]
5067
+ properties:
5068
+ id: { $ref: "#/components/schemas/Id" }
5069
+ type: { $ref: "#/components/schemas/MessageType" }
5070
+ sender:
5071
+ oneOf:
5072
+ - $ref: "#/components/schemas/User"
5073
+ - type: "null"
5074
+ content:
5075
+ type: [string, "null"]
5076
+ maxLength: 100
5077
+ description: The first 100 characters of the text or caption; `null` when deleted or empty.
5078
+ attachment:
5079
+ oneOf:
5080
+ - $ref: "#/components/schemas/Attachment"
5081
+ - type: "null"
5082
+ is_deleted: { type: boolean }
2585
5083
  Message:
2586
5084
  type: object
2587
5085
  required:
@@ -2610,7 +5108,7 @@ components:
2610
5108
  content:
2611
5109
  type: [string, "null"]
2612
5110
  maxLength: 4096
2613
- description: Text, or the caption of a file; `null` when deleted.
5111
+ description: Text, the caption of a file, or the emoji of a sticker; `null` when deleted.
2614
5112
  attachment:
2615
5113
  oneOf:
2616
5114
  - $ref: "#/components/schemas/Attachment"
@@ -2619,10 +5117,23 @@ components:
2619
5117
  oneOf:
2620
5118
  - $ref: "#/components/schemas/Id"
2621
5119
  - type: "null"
5120
+ reply_preview:
5121
+ $ref: "#/components/schemas/ReplyPreview"
2622
5122
  forwarded_from:
2623
5123
  oneOf:
2624
5124
  - $ref: "#/components/schemas/ForwardedFrom"
2625
5125
  - type: "null"
5126
+ sticker:
5127
+ description: |
5128
+ The sticker of a `sticker` message; absent for other types and when deleted. `attachment` carries the
5129
+ same image, so older clients show a sticker as a picture.
5130
+ $ref: "#/components/schemas/Sticker"
5131
+ attachments:
5132
+ type: array
5133
+ description: Ordered images and videos of an album. The first item is also returned as attachment for older clients.
5134
+ minItems: 2
5135
+ maxItems: 10
5136
+ items: { $ref: "#/components/schemas/Attachment" }
2626
5137
  reactions:
2627
5138
  type: array
2628
5139
  items: { $ref: "#/components/schemas/Reaction" }
@@ -2635,7 +5146,53 @@ components:
2635
5146
  - $ref: "#/components/schemas/Timestamp"
2636
5147
  - type: "null"
2637
5148
  is_deleted: { type: boolean }
5149
+ system_event:
5150
+ $ref: "#/components/schemas/SystemEvent"
2638
5151
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
5152
+ LinkPreview:
5153
+ type: object
5154
+ required: [url, title, description, site_name, image]
5155
+ properties:
5156
+ url:
5157
+ type: string
5158
+ description: The page after redirects
5159
+ title: { type: [string, "null"], maxLength: 300 }
5160
+ description: { type: [string, "null"], maxLength: 500 }
5161
+ site_name: { type: [string, "null"], maxLength: 100 }
5162
+ image:
5163
+ oneOf:
5164
+ - $ref: "#/components/schemas/LinkPreviewImage"
5165
+ - type: "null"
5166
+ LinkPreviewImage:
5167
+ type: object
5168
+ required: [url, width, height]
5169
+ properties:
5170
+ url:
5171
+ type: string
5172
+ description: "`GET /link-preview/image` with the signed address of the page's image"
5173
+ width: { type: [integer, "null"], minimum: 1 }
5174
+ height: { type: [integer, "null"], minimum: 1 }
5175
+ SystemEventKind:
5176
+ type: string
5177
+ enum: [group_created, member_added, member_joined, member_removed, member_left, call]
5178
+ SystemEvent:
5179
+ type: object
5180
+ description: |
5181
+ What a `system` message records; set on system messages only, whose `content` is then `null`. The names
5182
+ are the display names at the time of the event. `target` fields are set for `member_added` and
5183
+ `member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the
5184
+ initiator.
5185
+ required: [kind, actor_id, actor_name]
5186
+ properties:
5187
+ kind: { $ref: "#/components/schemas/SystemEventKind" }
5188
+ actor_id:
5189
+ oneOf:
5190
+ - $ref: "#/components/schemas/Id"
5191
+ - type: "null"
5192
+ actor_name: { type: string }
5193
+ target_id: { $ref: "#/components/schemas/Id" }
5194
+ target_name: { type: string }
5195
+ call: { $ref: "#/components/schemas/CallSummary" }
2639
5196
  MessagePage:
2640
5197
  type: object
2641
5198
  required: [items, next_cursor, prev_cursor]
@@ -2683,36 +5240,84 @@ components:
2683
5240
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
2684
5241
  type:
2685
5242
  type: string
2686
- enum: [text, file, voice]
5243
+ enum: [text, file, voice, sticker]
2687
5244
  content:
2688
5245
  type: [string, "null"]
2689
5246
  maxLength: 4096
5247
+ sticker_id:
5248
+ description: |
5249
+ The sticker of a `sticker` message, from any pack that is not deleted. Sticker messages have no content,
5250
+ attachment or drawings; the server sets `content` to the sticker's emoji. Send stickers with this
5251
+ operation; the WebSocket `message` event does not take them.
5252
+ $ref: "#/components/schemas/Id"
2690
5253
  attachment_id:
2691
- description: Required and not null for `file` and `voice`; never a URL.
5254
+ description: Single upload ID for a file or voice message. Omit for albums.
2692
5255
  oneOf:
2693
5256
  - $ref: "#/components/schemas/AttachmentRef"
2694
5257
  - type: "null"
5258
+ attachment_ids:
5259
+ type: array
5260
+ description: Ordered IDs of two to ten image or video uploads for one file message.
5261
+ minItems: 2
5262
+ maxItems: 10
5263
+ uniqueItems: true
5264
+ items: { $ref: "#/components/schemas/AttachmentRef" }
2695
5265
  reply_to:
2696
5266
  oneOf:
2697
5267
  - $ref: "#/components/schemas/Id"
2698
5268
  - type: "null"
5269
+ drawings:
5270
+ type: array
5271
+ description: |
5272
+ Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the
5273
+ message's attachments. An image with a drawing may also be an image of the message in `reply_to`
5274
+ instead of the sender's own upload: that is how a member draws on an image someone sent.
5275
+ maxItems: 10
5276
+ items: { $ref: "#/components/schemas/AttachmentDrawing" }
2699
5277
  if:
2700
5278
  properties:
2701
5279
  type: { enum: [file, voice] }
2702
5280
  then:
2703
- required: [attachment_id]
2704
5281
  properties:
2705
- attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
5282
+ sticker_id: { not: {} }
5283
+ oneOf:
5284
+ - required: [attachment_id]
5285
+ properties:
5286
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
5287
+ attachment_ids: { not: {} }
5288
+ - required: [attachment_ids]
5289
+ properties:
5290
+ type: { const: file }
5291
+ attachment_id: { not: {} }
5292
+ attachment_ids: { type: array }
2706
5293
  else:
2707
- required: [content]
2708
- properties:
2709
- content: { type: string, minLength: 1, maxLength: 4096 }
2710
- attachment_id: { not: {} }
5294
+ if:
5295
+ properties:
5296
+ type: { const: sticker }
5297
+ then:
5298
+ required: [sticker_id]
5299
+ properties:
5300
+ sticker_id: { $ref: "#/components/schemas/Id" }
5301
+ content: { not: {} }
5302
+ attachment_id: { not: {} }
5303
+ attachment_ids: { not: {} }
5304
+ drawings: { not: {} }
5305
+ else:
5306
+ required: [content]
5307
+ properties:
5308
+ content: { type: string, minLength: 1, maxLength: 4096 }
5309
+ attachment_id: { not: {} }
5310
+ attachment_ids: { not: {} }
5311
+ drawings: { not: {} }
5312
+ sticker_id: { not: {} }
2711
5313
  EditMessageRequest:
2712
5314
  type: object
2713
5315
  required: [content]
2714
5316
  properties:
2715
- content: { type: string, minLength: 1, maxLength: 4096 }
5317
+ content:
5318
+ type: string
5319
+ maxLength: 4096
5320
+ description: New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it.
2716
5321
  ForwardMessageRequest:
2717
5322
  type: object
2718
5323
  required: [chat_ids]
@@ -2723,6 +5328,35 @@ components:
2723
5328
  maxItems: 20
2724
5329
  uniqueItems: true
2725
5330
  items: { $ref: "#/components/schemas/Id" }
5331
+ ForwardMessagesRequest:
5332
+ type: object
5333
+ required: [message_ids, chat_ids]
5334
+ properties:
5335
+ message_ids:
5336
+ type: array
5337
+ minItems: 1
5338
+ maxItems: 20
5339
+ uniqueItems: true
5340
+ items: { $ref: "#/components/schemas/Id" }
5341
+ chat_ids:
5342
+ type: array
5343
+ minItems: 1
5344
+ maxItems: 20
5345
+ uniqueItems: true
5346
+ items: { $ref: "#/components/schemas/Id" }
5347
+ DeleteMessagesRequest:
5348
+ type: object
5349
+ required: [message_ids, scope]
5350
+ properties:
5351
+ message_ids:
5352
+ type: array
5353
+ minItems: 1
5354
+ maxItems: 100
5355
+ uniqueItems: true
5356
+ items: { $ref: "#/components/schemas/Id" }
5357
+ scope:
5358
+ type: string
5359
+ enum: [me, everyone]
2726
5360
  MarkReadRequest:
2727
5361
  type: object
2728
5362
  required: [message_id]
@@ -2737,7 +5371,30 @@ components:
2737
5371
  enum: [direct, group]
2738
5372
  GroupRole:
2739
5373
  type: string
2740
- enum: [owner, admin, member]
5374
+ description: A moderator may delete other members' messages; owners and admins also manage the group.
5375
+ enum: [owner, admin, moderator, member]
5376
+ GroupRoleEvent:
5377
+ type: object
5378
+ description: A member got a new role; `owner` means the actor transferred ownership to them.
5379
+ required: [id, actor, target, role, created_at]
5380
+ properties:
5381
+ id: { $ref: "#/components/schemas/Id" }
5382
+ actor:
5383
+ description: "`null` when the account is gone."
5384
+ oneOf:
5385
+ - $ref: "#/components/schemas/User"
5386
+ - type: "null"
5387
+ target: { $ref: "#/components/schemas/User" }
5388
+ role: { $ref: "#/components/schemas/GroupRole" }
5389
+ created_at: { $ref: "#/components/schemas/Timestamp" }
5390
+ GroupRoleLog:
5391
+ type: object
5392
+ required: [items]
5393
+ properties:
5394
+ items:
5395
+ type: array
5396
+ description: Newest first, at most 100
5397
+ items: { $ref: "#/components/schemas/GroupRoleEvent" }
2741
5398
  Chat:
2742
5399
  type: object
2743
5400
  required:
@@ -2839,7 +5496,7 @@ components:
2839
5496
  properties:
2840
5497
  role:
2841
5498
  type: string
2842
- enum: [admin, member]
5499
+ enum: [admin, moderator, member]
2843
5500
  TransferOwnerRequest:
2844
5501
  type: object
2845
5502
  required: [user_id]
@@ -2868,3 +5525,569 @@ components:
2868
5525
  type: [string, "null"]
2869
5526
  description: First message of a direct-message request
2870
5527
  created_at: { $ref: "#/components/schemas/Timestamp" }
5528
+
5529
+ DeviceRecoveryStart:
5530
+ type: object
5531
+ required:
5532
+ - username
5533
+ properties:
5534
+ username:
5535
+ $ref: "#/components/schemas/Username"
5536
+ DeviceRecoveryResult:
5537
+ type: object
5538
+ required:
5539
+ - request_id
5540
+ - match_number
5541
+ - expires_at
5542
+ properties:
5543
+ request_id:
5544
+ type: string
5545
+ minLength: 32
5546
+ maxLength: 128
5547
+ pattern: ^[A-Za-z0-9_-]+$
5548
+ match_number:
5549
+ type: integer
5550
+ minimum: 10
5551
+ maximum: 99
5552
+ expires_at:
5553
+ type: string
5554
+ format: date-time
5555
+ DeviceRecoveryStatus:
5556
+ type: object
5557
+ required:
5558
+ - status
5559
+ properties:
5560
+ status:
5561
+ type: string
5562
+ enum:
5563
+ - pending
5564
+ - approved
5565
+ - denied
5566
+ - used
5567
+ - expired
5568
+ DeviceRecoveryApproval:
5569
+ type: object
5570
+ required:
5571
+ - match_number
5572
+ properties:
5573
+ match_number:
5574
+ type: integer
5575
+ minimum: 10
5576
+ maximum: 99
5577
+ passkey:
5578
+ $ref: "#/components/schemas/PasskeyVerification"
5579
+ code:
5580
+ type: string
5581
+ maxLength: 128
5582
+ password:
5583
+ type: string
5584
+ maxLength: 1024
5585
+ deprecated: true
5586
+ description: Ignored. Older clients still send it.
5587
+ DeviceRecoveryApprovalOptions:
5588
+ type: object
5589
+ required:
5590
+ - method
5591
+ properties:
5592
+ method:
5593
+ type: string
5594
+ enum: [passkey, session]
5595
+ challenge_id:
5596
+ type: string
5597
+ minLength: 32
5598
+ maxLength: 128
5599
+ description: "Present with `method: passkey`."
5600
+ public_key:
5601
+ type: object
5602
+ additionalProperties: true
5603
+ description: "WebAuthn request options, present with `method: passkey`."
5604
+ approvable_from:
5605
+ type: string
5606
+ format: date-time
5607
+ description: "Present with `method: session` while the session is too new to approve."
5608
+ DeviceRecoveryComplete:
5609
+ type: object
5610
+ required:
5611
+ - new_password
5612
+ properties:
5613
+ new_password:
5614
+ type: string
5615
+ minLength: 8
5616
+ maxLength: 128
5617
+ writeOnly: true
5618
+
5619
+ QrLoginStatus:
5620
+ type: string
5621
+ description: |
5622
+ `pending` until a signed-in device opens the request, `scanned` once it did, then `approved` or `denied`.
5623
+ `expired` when the request timed out or was used (only in poll answers).
5624
+ enum: [pending, scanned, approved, denied, expired]
5625
+ QrLoginStart:
5626
+ type: object
5627
+ required: [request_id, poll_token, url, expires_at]
5628
+ properties:
5629
+ request_id:
5630
+ type: string
5631
+ minLength: 32
5632
+ maxLength: 128
5633
+ pattern: ^[A-Za-z0-9_-]+$
5634
+ poll_token:
5635
+ type: string
5636
+ minLength: 32
5637
+ maxLength: 128
5638
+ pattern: ^[A-Za-z0-9_-]+$
5639
+ description: Secret of the requesting device; only a keyed hash is stored.
5640
+ url:
5641
+ type: string
5642
+ description: "`<RECOVERY_WEB_URL>/qr/<request_id>`, the content of the QR code."
5643
+ expires_at: { $ref: "#/components/schemas/Timestamp" }
5644
+ QrLoginRequest:
5645
+ type: object
5646
+ required: [request_id, status, device, location, created_at, expires_at]
5647
+ properties:
5648
+ request_id: { type: string }
5649
+ status: { $ref: "#/components/schemas/QrLoginStatus" }
5650
+ device:
5651
+ type: [string, "null"]
5652
+ maxLength: 512
5653
+ description: User agent of the device that asks to sign in; `null` when it sent none.
5654
+ location:
5655
+ description: Approximate location of the device that asks to sign in; `null` when unknown.
5656
+ oneOf:
5657
+ - $ref: "#/components/schemas/Location"
5658
+ - type: "null"
5659
+ created_at: { $ref: "#/components/schemas/Timestamp" }
5660
+ expires_at: { $ref: "#/components/schemas/Timestamp" }
5661
+ QrLoginPollRequest:
5662
+ type: object
5663
+ required: [poll_token]
5664
+ properties:
5665
+ poll_token: { type: string, maxLength: 128, writeOnly: true }
5666
+ QrLoginPollResult:
5667
+ oneOf:
5668
+ - type: object
5669
+ required: [status]
5670
+ properties:
5671
+ status:
5672
+ type: string
5673
+ enum: [pending, scanned, denied, expired]
5674
+ - allOf:
5675
+ - $ref: "#/components/schemas/TokenResponse"
5676
+ - type: object
5677
+ required: [status]
5678
+ properties:
5679
+ status: { type: string, const: approved }
5680
+ QrLoginApproval:
5681
+ type: object
5682
+ properties:
5683
+ code:
5684
+ type: string
5685
+ maxLength: 128
5686
+ description: An authenticator code or an unused recovery code; required when two-factor is on.
5687
+
5688
+ PasskeyOptions:
5689
+ type: object
5690
+ required:
5691
+ - challenge_id
5692
+ - public_key
5693
+ properties:
5694
+ challenge_id: &a1
5695
+ type: string
5696
+ minLength: 32
5697
+ maxLength: 128
5698
+ public_key: &a2
5699
+ type: object
5700
+ additionalProperties: true
5701
+ PasskeyRegistration:
5702
+ type: object
5703
+ required:
5704
+ - password
5705
+ - name
5706
+ properties:
5707
+ password: &a4
5708
+ type: string
5709
+ maxLength: 128
5710
+ writeOnly: true
5711
+ code:
5712
+ type: string
5713
+ maxLength: 128
5714
+ name: &a3
5715
+ type: string
5716
+ minLength: 1
5717
+ maxLength: 64
5718
+ PasskeyVerification:
5719
+ type: object
5720
+ required:
5721
+ - challenge_id
5722
+ - credential
5723
+ properties:
5724
+ challenge_id: *a1
5725
+ credential: *a2
5726
+ PasskeyLoginOptions:
5727
+ type: object
5728
+ required: []
5729
+ properties:
5730
+ username:
5731
+ $ref: "#/components/schemas/Username"
5732
+ PasskeyRename:
5733
+ type: object
5734
+ required:
5735
+ - name
5736
+ properties:
5737
+ name: *a3
5738
+ PasskeyRemoval:
5739
+ type: object
5740
+ required: []
5741
+ properties:
5742
+ password: *a4
5743
+ Passkey:
5744
+ type: object
5745
+ required:
5746
+ - id
5747
+ - name
5748
+ - created_at
5749
+ - last_used_at
5750
+ properties:
5751
+ id:
5752
+ type: string
5753
+ name: *a3
5754
+ created_at:
5755
+ type: string
5756
+ format: date-time
5757
+ last_used_at:
5758
+ type:
5759
+ - string
5760
+ - "null"
5761
+ format: date-time
5762
+ PasskeyPage:
5763
+ type: object
5764
+ required:
5765
+ - items
5766
+ properties:
5767
+ items:
5768
+ type: array
5769
+ items:
5770
+ $ref: "#/components/schemas/Passkey"
5771
+
5772
+ RecoveryEmailStatus:
5773
+ type: object
5774
+ required:
5775
+ - address
5776
+ - state
5777
+ - enabled
5778
+ properties:
5779
+ address:
5780
+ type: string
5781
+ state:
5782
+ type: string
5783
+ enum:
5784
+ - not_added
5785
+ - pending
5786
+ - verified
5787
+ enabled:
5788
+ type: boolean
5789
+ RecoveryOverview:
5790
+ type: object
5791
+ required:
5792
+ - recovery_key
5793
+ - other_devices
5794
+ - passkeys
5795
+ - passkeys_enabled
5796
+ - email
5797
+ properties:
5798
+ recovery_key:
5799
+ $ref: "#/components/schemas/RecoveryKeyStatus"
5800
+ other_devices:
5801
+ type: integer
5802
+ minimum: 0
5803
+ passkeys:
5804
+ type: integer
5805
+ minimum: 0
5806
+ passkeys_enabled:
5807
+ type: boolean
5808
+ email:
5809
+ $ref: "#/components/schemas/RecoveryEmailStatus"
5810
+ SetRecoveryEmail:
5811
+ type: object
5812
+ required:
5813
+ - email
5814
+ - password
5815
+ properties:
5816
+ email:
5817
+ type: string
5818
+ format: email
5819
+ maxLength: 254
5820
+ password: &a1
5821
+ type: string
5822
+ minLength: 8
5823
+ maxLength: 128
5824
+ writeOnly: true
5825
+ code: &a2
5826
+ type: string
5827
+ maxLength: 128
5828
+ RemoveRecoveryEmail:
5829
+ type: object
5830
+ required:
5831
+ - password
5832
+ properties:
5833
+ password: *a1
5834
+ code: *a2
5835
+ VerifyRecoveryEmail:
5836
+ type: object
5837
+ required:
5838
+ - token
5839
+ properties:
5840
+ token: &a3
5841
+ type: string
5842
+ minLength: 32
5843
+ maxLength: 128
5844
+ EmailResetRequest:
5845
+ type: object
5846
+ required:
5847
+ - username_or_email
5848
+ properties:
5849
+ username_or_email:
5850
+ type: string
5851
+ maxLength: 254
5852
+ EmailResetConfirmation:
5853
+ type: object
5854
+ required:
5855
+ - token
5856
+ - new_password
5857
+ properties:
5858
+ token: *a3
5859
+ new_password: *a1
5860
+ code: *a2
5861
+ EmailResetAccepted:
5862
+ type: object
5863
+ required:
5864
+ - message
5865
+ properties:
5866
+ message:
5867
+ type: string
5868
+
5869
+ # ----------------------------------------------------------- calls
5870
+ CallConfig:
5871
+ type: object
5872
+ required: [enabled, max_participants, ring_timeout_seconds]
5873
+ properties:
5874
+ enabled: { type: boolean }
5875
+ max_participants:
5876
+ type: integer
5877
+ minimum: 2
5878
+ description: Most sessions joined to one call at the same time.
5879
+ ring_timeout_seconds:
5880
+ type: integer
5881
+ minimum: 1
5882
+ description: How long an invitation rings before it counts as missed.
5883
+ CallIdentityRequest:
5884
+ type: object
5885
+ required: [public_key]
5886
+ properties:
5887
+ public_key: { $ref: "#/components/schemas/CallIdentityKey" }
5888
+ CallIdentityKey:
5889
+ type: string
5890
+ description: |
5891
+ P-256 public key as an uncompressed point (65 bytes, first byte `0x04`), base64url without padding.
5892
+ minLength: 87
5893
+ maxLength: 87
5894
+ pattern: "^[A-Za-z0-9_-]+$"
5895
+ CallState:
5896
+ type: string
5897
+ description: "`ringing` until someone answers, `active` while people are in it, `ended` afterwards."
5898
+ enum: [ringing, active, ended]
5899
+ CallEndReason:
5900
+ type: string
5901
+ description: |
5902
+ Why the call ended: `completed` (people talked), `missed` (nobody answered in time), `declined` (the peer of a
5903
+ direct call declined), `cancelled` (the caller hung up before an answer), `failed` (the media service lost
5904
+ the call).
5905
+ enum: [completed, missed, declined, cancelled, failed]
5906
+ CallParticipantState:
5907
+ type: string
5908
+ description: "`left` and `declined` can become `joined` again in a group call."
5909
+ enum: [ringing, joined, declined, missed, left]
5910
+ CallParticipant:
5911
+ type: object
5912
+ required: [user_id, state, session_id, identity_key, joined_at]
5913
+ properties:
5914
+ user_id: { $ref: "#/components/schemas/Id" }
5915
+ state: { $ref: "#/components/schemas/CallParticipantState" }
5916
+ session_id:
5917
+ description: The session that joined; `null` unless `state` is `joined`.
5918
+ oneOf:
5919
+ - { type: string, format: uuid }
5920
+ - type: "null"
5921
+ identity_key:
5922
+ description: Call identity of the joined session; `null` unless `state` is `joined`.
5923
+ oneOf:
5924
+ - $ref: "#/components/schemas/CallIdentityKey"
5925
+ - type: "null"
5926
+ joined_at:
5927
+ description: When the participant last joined; `null` if never.
5928
+ oneOf:
5929
+ - $ref: "#/components/schemas/Timestamp"
5930
+ - type: "null"
5931
+ Call:
5932
+ type: object
5933
+ required:
5934
+ - id
5935
+ - chat_id
5936
+ - kind
5937
+ - state
5938
+ - end_reason
5939
+ - initiator_id
5940
+ - created_at
5941
+ - started_at
5942
+ - ended_at
5943
+ - ring_expires_at
5944
+ - epoch
5945
+ - version
5946
+ - max_participants
5947
+ - participants
5948
+ properties:
5949
+ id: { $ref: "#/components/schemas/Id" }
5950
+ chat_id: { $ref: "#/components/schemas/Id" }
5951
+ kind:
5952
+ type: string
5953
+ enum: [direct, group]
5954
+ state: { $ref: "#/components/schemas/CallState" }
5955
+ end_reason:
5956
+ oneOf:
5957
+ - $ref: "#/components/schemas/CallEndReason"
5958
+ - type: "null"
5959
+ initiator_id: { $ref: "#/components/schemas/Id" }
5960
+ created_at: { $ref: "#/components/schemas/Timestamp" }
5961
+ started_at:
5962
+ description: First answer; `null` while nobody answered.
5963
+ oneOf:
5964
+ - $ref: "#/components/schemas/Timestamp"
5965
+ - type: "null"
5966
+ ended_at:
5967
+ oneOf:
5968
+ - $ref: "#/components/schemas/Timestamp"
5969
+ - type: "null"
5970
+ ring_expires_at:
5971
+ description: When ringing invitations of this call turn into `missed`.
5972
+ $ref: "#/components/schemas/Timestamp"
5973
+ epoch:
5974
+ type: integer
5975
+ minimum: 0
5976
+ description: Key epoch; increases whenever the set of joined sessions or their identity keys change.
5977
+ version:
5978
+ type: integer
5979
+ minimum: 1
5980
+ description: Increases with every change of the call; ignore events with a lower version than one already seen.
5981
+ max_participants: { type: integer, minimum: 2 }
5982
+ participants:
5983
+ type: array
5984
+ description: Everyone invited or joined, the initiator first.
5985
+ items: { $ref: "#/components/schemas/CallParticipant" }
5986
+ CallList:
5987
+ type: object
5988
+ required: [items]
5989
+ properties:
5990
+ items:
5991
+ type: array
5992
+ items: { $ref: "#/components/schemas/Call" }
5993
+ StartCallRequest:
5994
+ type: object
5995
+ required: [client_request_id]
5996
+ properties:
5997
+ client_request_id:
5998
+ type: string
5999
+ format: uuid
6000
+ description: Idempotency key chosen by the client.
6001
+ JoinCallRequest:
6002
+ type: object
6003
+ properties:
6004
+ takeover:
6005
+ type: boolean
6006
+ default: false
6007
+ description: Move the user's participation from another session to this one.
6008
+ CallGrant:
6009
+ type: object
6010
+ required: [url, token, identity, expires_at]
6011
+ properties:
6012
+ url:
6013
+ type: string
6014
+ description: WebSocket URL of the media server (`wss://`).
6015
+ token:
6016
+ type: string
6017
+ description: Media access token for this call and session only; microphone audio only.
6018
+ identity:
6019
+ type: string
6020
+ description: The participant identity inside the media room (`<user_id>:<session_id>`).
6021
+ expires_at: { $ref: "#/components/schemas/Timestamp" }
6022
+ CallJoin:
6023
+ type: object
6024
+ required: [call, grant]
6025
+ properties:
6026
+ call: { $ref: "#/components/schemas/Call" }
6027
+ grant: { $ref: "#/components/schemas/CallGrant" }
6028
+ CallKeyEnvelope:
6029
+ type: object
6030
+ description: An HPKE Auth-mode envelope carrying one sender key (see `docs/calls-e2ee.md`).
6031
+ required: [epoch, sender_user_id, sender_session_id, recipient_session_id, enc, ciphertext]
6032
+ properties:
6033
+ epoch: { type: integer, minimum: 0 }
6034
+ sender_user_id: { $ref: "#/components/schemas/Id" }
6035
+ sender_session_id: { type: string, format: uuid }
6036
+ recipient_session_id: { type: string, format: uuid }
6037
+ enc:
6038
+ type: string
6039
+ description: HPKE encapsulated key, base64url without padding.
6040
+ maxLength: 128
6041
+ pattern: "^[A-Za-z0-9_-]+$"
6042
+ ciphertext:
6043
+ type: string
6044
+ description: Sealed sender key, base64url without padding.
6045
+ maxLength: 256
6046
+ pattern: "^[A-Za-z0-9_-]+$"
6047
+ CallKeyEnvelopeList:
6048
+ type: object
6049
+ required: [call_id, epoch, items]
6050
+ properties:
6051
+ call_id: { $ref: "#/components/schemas/Id" }
6052
+ epoch: { type: integer, minimum: 0 }
6053
+ items:
6054
+ type: array
6055
+ items: { $ref: "#/components/schemas/CallKeyEnvelope" }
6056
+ SendCallKeysRequest:
6057
+ type: object
6058
+ required: [epoch, envelopes]
6059
+ properties:
6060
+ epoch: { type: integer, minimum: 0 }
6061
+ envelopes:
6062
+ type: array
6063
+ minItems: 1
6064
+ maxItems: 64
6065
+ items: { $ref: "#/components/schemas/OutgoingCallKeyEnvelope" }
6066
+ OutgoingCallKeyEnvelope:
6067
+ type: object
6068
+ required: [recipient_session_id, enc, ciphertext]
6069
+ properties:
6070
+ recipient_session_id: { type: string, format: uuid }
6071
+ enc:
6072
+ type: string
6073
+ maxLength: 128
6074
+ pattern: "^[A-Za-z0-9_-]+$"
6075
+ ciphertext:
6076
+ type: string
6077
+ maxLength: 256
6078
+ pattern: "^[A-Za-z0-9_-]+$"
6079
+ CallSummary:
6080
+ type: object
6081
+ description: The call a `call` system message records.
6082
+ required: [call_id, kind, outcome, duration_seconds]
6083
+ properties:
6084
+ call_id: { $ref: "#/components/schemas/Id" }
6085
+ kind:
6086
+ type: string
6087
+ enum: [direct, group]
6088
+ outcome: { $ref: "#/components/schemas/CallEndReason" }
6089
+ duration_seconds:
6090
+ description: From the first answer to the end; `null` if nobody answered.
6091
+ oneOf:
6092
+ - { type: integer, minimum: 0 }
6093
+ - type: "null"