directory.openapi.yml 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470
  1. .references:
  2. # Servers
  3. work-servers: &work-servers
  4. - url: https://ds-apip-work.threema.ch
  5. description: Production server
  6. - url: https://ds-apip-work.test.threema.ch
  7. description: Sandbox server
  8. # Primitives
  9. base64: &base64
  10. type: string
  11. format: byte
  12. u16: &u16
  13. type: integer
  14. minimum: 0
  15. maximum: 65535
  16. u32: &u32
  17. type: integer
  18. minimum: 0
  19. maximum: 4294967295
  20. u64: &u64
  21. type: integer
  22. minimum: 0
  23. maximum: 18446744073709551615
  24. # Common
  25. identity: &identity
  26. description: A Threema ID.
  27. type: string
  28. minLength: 8
  29. maxLength: 8
  30. pattern: ^[0-9A-Z*]{1}[0-9A-Z]{7}$
  31. example: ECHOECHO
  32. public-key: &public-key
  33. <<: *base64
  34. description: Public Key (32 bytes, base64) associated to a Threema ID.
  35. example: ZWNob2VjaG9lY2hvZWNob2VjaG9lY2hvZWNob2VjaG8=
  36. app-version: &app-version
  37. description: |-
  38. App version. This is the CSP `client-info` but with the following special postfix:
  39. 1. If at least one Threema-MDM parameter and at least one external MDM parameter is active, append `;me`
  40. 2. If at least one Threema-MDM parameter is active, append `;m`
  41. 3. If at least one external MDM parameter is active, append `;e`
  42. 4. If no MDM parameter is active, don't append. (A lone `;` is also acceptable.)
  43. type: string
  44. minLength: 1
  45. example: 1.2.3;Q;de/DE;...
  46. work-server-time-ms: &work-server-time-ms
  47. description: |-
  48. Current UNIX-ish timestamp in milliseconds of the server.
  49. This timestamp can be used to check if a work contact change from a
  50. `WorkSyncDelta` is relevant compared to the most recent full sync of that
  51. work contact through this (or another) endpoint.
  52. type: integer
  53. minimum: 0
  54. work-username: &work-username
  55. description: Work license username.
  56. type: string
  57. minLength: 1
  58. example: echoecho@threema.ch
  59. work-password: &work-password
  60. description: Work license password.
  61. type: string
  62. minLength: 1
  63. example: super-secret-password
  64. work-nickname: &work-nickname
  65. description: |-
  66. User's nickname sourced from the MDM parameter `th_nickname`. Empty is
  67. equivalent to unset.
  68. type: string
  69. example: personal-🦜
  70. work-first-name: &work-first-name
  71. description: |-
  72. User's first name sourced from the MDM parameter `th_firstname`. Empty is
  73. equivalent to unset.
  74. type: string
  75. example: Aria
  76. work-last-name: &work-last-name
  77. description: |-
  78. User's last name sourced from the MDM parameter `th_lastname`. Empty is
  79. equivalent to unset.
  80. type: string
  81. example: Reverb
  82. work-availability-status: &work-availability-status
  83. <<: *base64
  84. description: |-
  85. User's availability status as defined by
  86. `d2d_sync.WorkAvailabilityStatus`, encoded as base64.
  87. `d2d_sync.WorkAvailabilityStatus` with
  88. `WorkAvailabilityStatusCategory.NONE` is equivalent to unset (and vice
  89. versa, no matter whether a description has been provided or not).
  90. work-user-identifier: &work-user-identifier
  91. description: |-
  92. Custom unique identifier of the user (e.g. employee number), sourced from
  93. the MDM parameter `th_csi`. Also known as _Customer Specific Identifier_.
  94. Empty is equivalent to unset.
  95. type: string
  96. work-job-title: &work-job-title
  97. description: |-
  98. Job title of the user, sourced from the MDM parameter `th_job_title`.
  99. Empty is equivalent to unset.
  100. type: string
  101. work-department: &work-department
  102. description: |-
  103. Department the user is working in, sourced from the MDM parameter
  104. `th_department`. Empty is equivalent to unset.
  105. type: string
  106. work-user-category-labels-delimited: &work-user-category-labels-delimited
  107. description: |-
  108. Custom category labels assigned to the user (e.g. building name, room
  109. number), sourced from the MDM parameter `th_category`. Empty is equivalent
  110. to unset.
  111. Note: For compatibility with the app configuration parameter
  112. `th_category`, this is the delimited variant with the category label
  113. separated by the category delimiter (`,` by default).
  114. type: string
  115. example: Building 1, Room 337
  116. work-user-category-id: &work-user-category-id
  117. description: A custom category ID.
  118. type: string
  119. minLength: 1
  120. example: 'jNekOWhQ8B'
  121. work-user-category-ids: &work-user-category-ids
  122. description: |-
  123. Custom category IDs of the user (e.g. mapping to a corresponding label
  124. such as building name or room number), chosen by the Work subscription
  125. administrator.
  126. type: array
  127. items: *work-user-category-id
  128. example:
  129. - '1'
  130. - 'jNekOWhQ8B'
  131. work-contacts-match: &work-contacts-match
  132. type: array
  133. items: *identity
  134. example:
  135. - ECHOECHO
  136. - '*SUPPORT'
  137. work-contact: &work-contact
  138. type: object
  139. required:
  140. - id
  141. - pk
  142. properties:
  143. id: *identity
  144. pk: *public-key
  145. first:
  146. <<: *work-first-name
  147. type:
  148. - string
  149. - 'null'
  150. last:
  151. <<: *work-last-name
  152. type:
  153. - string
  154. - 'null'
  155. jobTitle: *work-job-title
  156. department: *work-department
  157. availability: *work-availability-status
  158. work-organisation: &work-organisation
  159. type: object
  160. required:
  161. - name
  162. properties:
  163. name:
  164. description: |-
  165. Optional name of the organisation, translated by the `Accept-Language`
  166. header (if provided).
  167. type:
  168. - string
  169. - 'null'
  170. work-directory-page-index: &work-directory-page-index
  171. description: Page index.
  172. type: integer
  173. minimum: 0
  174. work-directory-sort: &work-directory-sort
  175. type: object
  176. properties:
  177. by:
  178. description: The sort key applied to the resulting contacts.
  179. type: string
  180. anyOf:
  181. - title: First name
  182. const: firstName
  183. - title: Last name
  184. const: lastName
  185. - {}
  186. default: firstName
  187. asc:
  188. description: |-
  189. Sort contacts ascending by `by` if `true`, sort descending if `false`.
  190. type: boolean
  191. default: true
  192. work-properties: &work-properties
  193. <<: *base64
  194. description: |-
  195. Work properties as defined by `directory.WorkProperties`, encoded as
  196. base64.
  197. remote-secret: &remote-secret
  198. <<: *base64
  199. description: Remote Secret (32 bytes, base64).
  200. remote-secret-authentication-token: &remote-secret-authentication-token
  201. <<: *base64
  202. description: |-
  203. Remote Secret Authentication Token (32 bytes, base64). Allows to retrieve
  204. an associated Remote Secret.
  205. # Authentication challenge/response
  206. auth-challenge-request: &auth-challenge-request
  207. description: Authentication required.
  208. type: object
  209. required:
  210. - token
  211. - tokenRespKeyPub
  212. properties:
  213. token:
  214. <<: *base64
  215. description: An arbitrary challenge token (base64) to be _signed_.
  216. tokenRespKeyPub:
  217. <<: *base64
  218. description: |-
  219. The public key (CPK, 32 bytes, base64) to derive a shared secret for
  220. solving the challenge.
  221. auth-challenge-response: &auth-challenge-response
  222. type: object
  223. required:
  224. - token
  225. - response
  226. properties:
  227. token:
  228. <<: *base64
  229. description: The token of the challenge request (base64).
  230. response:
  231. <<: *base64
  232. description: |-
  233. The token of the challenge request, _signed_ in the following way:
  234. ```text
  235. base64(
  236. BLAKE2b(
  237. key=BLAKE2b(
  238. key=X25519HSalsa20(CK.secret, CPK.public),
  239. salt='dir',
  240. personal='3ma-csp',
  241. ),
  242. input=<token>
  243. )
  244. )
  245. ```
  246. work-auth-challenge-request: &work-auth-challenge-request
  247. description: |-
  248. Authentication challenge request for a Work endpoint.
  249. type: object
  250. required:
  251. - challengePublicKey
  252. - challenge
  253. properties:
  254. challengePublicKey:
  255. <<: *base64
  256. description: |-
  257. The public key (CPK, 32 bytes, base64) to derive a shared secret for
  258. solving the challenge.
  259. challenge:
  260. <<: *base64
  261. description: An arbitrary challenge (base64) to be _signed_.
  262. work-auth-challenge-response: &work-auth-challenge-response
  263. description: |-
  264. Authentication challenge response for a Work endpoint.
  265. type: object
  266. required:
  267. - challenge
  268. - response
  269. properties:
  270. challenge:
  271. <<: *base64
  272. description: The challenge (base64).
  273. response:
  274. <<: *base64
  275. description: |-
  276. The challenge, _signed_ in the following way:
  277. ```text
  278. base64(
  279. BLAKE2b(
  280. key=BLAKE2b(
  281. key=X25519HSalsa20(CK.secret, CPK.public),
  282. salt='wdir',
  283. personal='3ma-csp',
  284. ),
  285. input=<token>
  286. )
  287. )
  288. ```
  289. work-auth-failed: &work-auth-failed
  290. type: object
  291. required:
  292. - code
  293. properties:
  294. code:
  295. type: string
  296. anyOf:
  297. - enum:
  298. - invalid-credentials
  299. - challenge-expired
  300. - invalid-challenge-response
  301. - {}
  302. # Request/response data fragments
  303. blob-credentials-request: &blob-credentials-request
  304. type: object
  305. required:
  306. - identity
  307. properties:
  308. identity: *identity
  309. blob-credentials-response:
  310. ok: &blob-credentials-response-ok
  311. description: |-
  312. Blob server authentication credentials retrieved successfully.
  313. type: object
  314. required:
  315. - success
  316. - token
  317. - expiration
  318. properties:
  319. success:
  320. type: boolean
  321. const: true
  322. token:
  323. description: |-
  324. An opaque token used to authenticate against the blob server.
  325. HTTP requests towards the the blob server must include it as a
  326. header in the following way: `Authorization: ThreemaBlobToken
  327. <token>`
  328. type: string
  329. expiration:
  330. <<: *u64
  331. description: |-
  332. Amount of seconds until the token expires and must be discarded.
  333. example:
  334. success: true
  335. token: givemeaccessplz
  336. expiration: 600
  337. error: &blob-credentials-response-error
  338. description: |-
  339. Blob server authentication credentials could not be retrieved.
  340. type: object
  341. required:
  342. - success
  343. properties:
  344. success:
  345. type: boolean
  346. const: false
  347. error:
  348. type: string
  349. example:
  350. success: false
  351. error: Identity not found
  352. id-revocation-request: &id-revocation-request
  353. type: object
  354. required:
  355. - identity
  356. properties:
  357. identity: *identity
  358. id-revocation-key-v1: &id-revocation-key-v1
  359. <<: *base64
  360. minLength: 8
  361. maxLength: 8
  362. description: |-
  363. A legacy (v1) identity revocation key.
  364. The revocation key is computed as follows (`[:4]` denotes the first four bytes):
  365. ```text
  366. base64(
  367. SHA256(revocation-password)[:4]
  368. )
  369. ```
  370. id-revocation-request-v1: &id-revocation-request-v1
  371. type: object
  372. required:
  373. - identity
  374. - revocationKey
  375. properties:
  376. identity: *identity
  377. revocationKey: *id-revocation-key-v1
  378. id-revocation-key-check-response:
  379. found: &id-revocation-key-check-response-found
  380. description: 'ID revocation key was set'
  381. required:
  382. - revocationKeySet
  383. - lastChanged
  384. properties:
  385. revocationKeySet:
  386. type: boolean
  387. const: true
  388. lastChanged:
  389. type: string
  390. format: date-time
  391. example:
  392. revocationKeySet: true
  393. lastChanged: '2014-10-29T12:32:54Z'
  394. empty: &id-revocation-key-check-response-empty
  395. description: 'ID revocation key was not set'
  396. required:
  397. - revocationKeySet
  398. properties:
  399. revocationKeySet:
  400. type: boolean
  401. const: false
  402. id-revocation-response:
  403. ok: &id-revocation-response-ok
  404. description: 'ID revocation key request was successful'
  405. type: object
  406. required:
  407. - success
  408. properties:
  409. success:
  410. type: boolean
  411. const: true
  412. error: &id-revocation-response-error
  413. description: 'ID revocation key was not successful'
  414. type: object
  415. required:
  416. - success
  417. properties:
  418. success:
  419. type: boolean
  420. const: false
  421. error:
  422. type: string
  423. example:
  424. success: false
  425. error: 'Identity not found'
  426. sfu-credentials-request: &sfu-credentials-request
  427. type: object
  428. required:
  429. - identity
  430. properties:
  431. identity: *identity
  432. sfu-credentials-response:
  433. ok: &sfu-credentials-response-ok
  434. description: SFU information retrieved successfully.
  435. type: object
  436. required:
  437. - success
  438. - sfuBaseUrl
  439. - allowedSfuHostnameSuffixes
  440. - sfuToken
  441. - expiration
  442. properties:
  443. success:
  444. type: boolean
  445. const: true
  446. sfuBaseUrl:
  447. description: |-
  448. Base URL used to create and distribute new calls.
  449. type: string
  450. allowedSfuHostnameSuffixes:
  451. description: |-
  452. A set of allowed hostname suffixes to be applied against a _SFU
  453. Base URL_ when joining calls.
  454. If the provided _SFU Base URL_'s hostname does not end with one of
  455. the provided hostname suffixes, joining or peeking that call is
  456. disallowed.
  457. type: array
  458. items:
  459. type: string
  460. sfuToken:
  461. description: |-
  462. An opaque token used to authenticate against a SFU.
  463. HTTP requests towards the SFU must include it as a header in the
  464. following way: `Authorization: ThreemaSfuToken <token>`
  465. type: string
  466. expiration:
  467. <<: *u64
  468. description: |-
  469. Amount of seconds until the SFU information is considered stale and
  470. must be discarded.
  471. example:
  472. success: true
  473. sfuBaseUrl: https://sfu.threema.ch
  474. allowedSfuHostnameSuffixes:
  475. - threema.ch
  476. sfuToken: givemeaccessplz
  477. expiration: 600
  478. error: &sfu-credentials-response-error
  479. description: SFU information could not be retrieved.
  480. type: object
  481. required:
  482. - success
  483. properties:
  484. success:
  485. type: boolean
  486. const: false
  487. error:
  488. type: string
  489. example:
  490. success: false
  491. error: 'Identity not found'
  492. work-properties-legacy-request: &work-properties-legacy-request
  493. type: object
  494. required:
  495. - identity
  496. - licenseUsername
  497. - licensePassword
  498. - version
  499. properties:
  500. identity: *identity
  501. licenseUsername: *work-username
  502. licensePassword: *work-password
  503. version: *app-version
  504. publicNickname: *work-nickname
  505. firstName: *work-first-name
  506. lastName: *work-last-name
  507. csi: *work-user-identifier
  508. jobTitle: *work-job-title
  509. department: *work-department
  510. category: *work-user-category-labels-delimited
  511. work-properties-legacy-response:
  512. ok: &work-properties-legacy-response-ok
  513. description: Work properties updated successfully.
  514. type: object
  515. required:
  516. - success
  517. properties:
  518. success:
  519. type: boolean
  520. const: true
  521. error: &work-properties-legacy-response-error
  522. description: Updating Work properties failed.
  523. type: object
  524. required:
  525. - success
  526. properties:
  527. success:
  528. type: boolean
  529. const: false
  530. error:
  531. type: string
  532. example:
  533. success: false
  534. error: 'Missing parameters'
  535. work-credentials: &work-credentials
  536. type: object
  537. required:
  538. - username
  539. - password
  540. properties:
  541. username: *work-username
  542. password: *work-password
  543. work-credentials-with-identity: &work-credentials-with-identity
  544. type: object
  545. required:
  546. - identity
  547. - username
  548. - password
  549. properties:
  550. identity: *identity
  551. username: *work-username
  552. password: *work-password
  553. sync-work-data-request: &sync-work-data-request
  554. type: object
  555. required:
  556. - contacts
  557. properties:
  558. contacts:
  559. <<: *work-contacts-match
  560. description: |-
  561. A list of all existing contacts of the user to match against the Work
  562. subscription.
  563. Note: This is necessary to determine whether a contact is part of the
  564. user's Work subscription and, in that case, get additional
  565. information.
  566. Note 2: Explicitly providing all of the user's contacts also prevents
  567. having to configure **all** Work contacts of the same subscription.
  568. sync-work-data-response: &sync-work-data-response
  569. type: object
  570. required:
  571. - checkInterval
  572. - org
  573. - logo
  574. - support
  575. - directory
  576. - mdm
  577. - contacts
  578. properties:
  579. checkInterval:
  580. <<: *u64
  581. description: |-
  582. Target amount of seconds until a subsequent Work sync should be
  583. initiated.
  584. org: *work-organisation
  585. logo:
  586. description: Logo to be displayed in the app.
  587. type: object
  588. required:
  589. - light
  590. - dark
  591. properties:
  592. light: &work-logo-url
  593. description: |-
  594. Optional URL to a logo to be displayed in the app. The logo must
  595. be provided in PNG format.
  596. type:
  597. - string
  598. - 'null'
  599. dark: *work-logo-url
  600. support:
  601. description: Optional custom in-app support base URL.
  602. type:
  603. - string
  604. - 'null'
  605. directory:
  606. oneOf:
  607. - description: Disabled Work directory.
  608. type: object
  609. required:
  610. - enabled
  611. properties:
  612. enabled:
  613. type: boolean
  614. const: false
  615. - description: Enabled Work directory.
  616. type: object
  617. required:
  618. - enabled
  619. - cat
  620. properties:
  621. enabled:
  622. type: boolean
  623. const: true
  624. cat:
  625. description: |-
  626. Map of contact category IDs to their respective label.
  627. type: object
  628. additionalProperties: *work-user-category-id
  629. mdm:
  630. description: App configuration to be applied.
  631. type: object
  632. required:
  633. - override
  634. - params
  635. properties:
  636. override:
  637. description: |-
  638. Whether the app configuration parameters provided here take
  639. precedence over the the externally configured MDM parameters.
  640. type: boolean
  641. params:
  642. description: |-
  643. A key/value map of app configuration / MDM parameters as defined
  644. by the protocol.
  645. type: object
  646. additionalProperties:
  647. oneOf:
  648. - type: string
  649. - *u64
  650. - type: boolean
  651. contacts:
  652. description: |-
  653. A list of contacts from the same Work subscription to be configured
  654. on the user's device.
  655. type: array
  656. items:
  657. <<: *work-contact
  658. description: A configured Work contact.
  659. time: *work-server-time-ms
  660. work-contacts-request: &work-contacts-request
  661. type: object
  662. required:
  663. - contacts
  664. properties:
  665. contacts:
  666. <<: *work-contacts-match
  667. description: |-
  668. A list of contacts (Threema IDs) to get additional Work properties for.
  669. Note: This is necessary to determine whether a contact is part of the
  670. user's Work subscription and, in that case, get additional
  671. information.
  672. work-contacts-response: &work-contacts-response
  673. type: object
  674. required:
  675. - contacts
  676. properties:
  677. contacts:
  678. description: |-
  679. A subset of the provided contacts that are part of the same Work
  680. subscription with the associated additional Work properties.
  681. type: array
  682. items:
  683. <<: *work-contact
  684. description: A Work contact.
  685. time: *work-server-time-ms
  686. work-directory-request-wildcard: &work-directory-request-wildcard
  687. type: object
  688. required:
  689. - query
  690. - page
  691. - categories
  692. properties:
  693. identity:
  694. <<: *identity
  695. description: The user's Threema ID.
  696. page: *work-directory-page-index
  697. query:
  698. description: Wildcard search query.
  699. type: string
  700. const: '*'
  701. categories:
  702. <<: *work-user-category-ids
  703. description: At least one category ID to narrow down the search with.
  704. minLength: 1
  705. sort: *work-directory-sort
  706. work-directory-request-specific: &work-directory-request-specific
  707. type: object
  708. required:
  709. - query
  710. - page
  711. properties:
  712. identity:
  713. <<: *identity
  714. description: The user's Threema ID.
  715. page: *work-directory-page-index
  716. query:
  717. description: |-
  718. Search query. Matches any of Threema ID, first name, or last name.
  719. type: string
  720. minLength: 3
  721. example: Bob
  722. categories:
  723. <<: *work-user-category-ids
  724. description: Optional category IDs to narrow down the search with.
  725. sort: *work-directory-sort
  726. work-directory-response: &work-directory-response
  727. type: object
  728. required:
  729. - paging
  730. - contacts
  731. properties:
  732. paging:
  733. description: Page information.
  734. type: object
  735. required:
  736. - size
  737. - total
  738. properties:
  739. size:
  740. description: Maximum amount of results present in a single page.
  741. type: integer
  742. minimum: 0
  743. total:
  744. description: Total amount of results (spread across pages).
  745. type: integer
  746. minimum: 0
  747. prev:
  748. description: Previous page index, if any is available.
  749. type: integer
  750. minimum: 0
  751. next:
  752. description: Next page index, if any is available.
  753. type: integer
  754. minimum: 1
  755. contacts:
  756. description: |-
  757. A Work contact of the same subcription that matches the search query.
  758. type: array
  759. items: !merge-objects
  760. - *work-contact
  761. - type: object
  762. required:
  763. - org
  764. properties:
  765. csi: *work-user-identifier
  766. cat: *work-user-category-ids
  767. org: *work-organisation
  768. time: *work-server-time-ms
  769. work-properties-request: &work-properties-request
  770. type: object
  771. required:
  772. - properties
  773. properties:
  774. properties: *work-properties
  775. remote-secret-create-request: &remote-secret-create-request
  776. type: object
  777. required:
  778. - secret
  779. properties:
  780. secret: *remote-secret
  781. remote-secret-create-response: &remote-secret-create-response
  782. type: object
  783. required:
  784. - secretAuthenticationToken
  785. properties:
  786. secretAuthenticationToken: *remote-secret-authentication-token
  787. remote-secret-delete-request: &remote-secret-delete-request
  788. type: object
  789. required:
  790. - secretAuthenticationToken
  791. properties:
  792. secretAuthenticationToken: *remote-secret-authentication-token
  793. remote-secret-fetch-request: &remote-secret-fetch-request
  794. type: object
  795. required:
  796. - secretAuthenticationToken
  797. properties:
  798. secretAuthenticationToken: *remote-secret-authentication-token
  799. remote-secret-fetch-response: &remote-secret-fetch-response
  800. type: object
  801. required:
  802. - secret
  803. - checkIntervalS
  804. - nMissedChecksMax
  805. properties:
  806. secret: *remote-secret
  807. checkIntervalS:
  808. <<: *u32
  809. description: |-
  810. Amount of time in seconds until the Remote Secret should be fetched
  811. again.
  812. nMissedChecksMax:
  813. <<: *u16
  814. description: |-
  815. The maximum number of fetches that may be missed until application
  816. storage should be locked.
  817. openapi: 3.1.0
  818. info:
  819. title: Directory and Work Directory Server APIs
  820. description: |-
  821. Maintains the directory of allocated Threema IDs and all associated
  822. properties.
  823. version: 1.0.0
  824. servers:
  825. - url: https://ds-apip.threema.ch
  826. description: Production server
  827. - url: https://ds-apip.test.threema.ch
  828. description: Sandbox server
  829. paths:
  830. /identity/blob_cred:
  831. post:
  832. summary: Blob Server Credentials
  833. description: |-
  834. Retrieve blob server authentication credentials.
  835. The first call without the challenge response properties initiates the
  836. challenge request. The second call must repeat the exact same properties
  837. and the challenge response.
  838. requestBody:
  839. required: true
  840. content:
  841. application/json:
  842. schema:
  843. oneOf:
  844. - *blob-credentials-request
  845. - !merge-objects
  846. - *auth-challenge-response
  847. - *blob-credentials-request
  848. responses:
  849. '200':
  850. description: Success... or not.
  851. content:
  852. application/json:
  853. schema:
  854. oneOf:
  855. - *auth-challenge-request
  856. - *blob-credentials-response-ok
  857. - *blob-credentials-response-error
  858. '429':
  859. description: Rate limit exceeded.
  860. /identity/revoke:
  861. post:
  862. summary: ID Revocation by Client Key
  863. description: |-
  864. Revoke a Threema ID by proofing the knowledge of the client key.
  865. The first call without the challenge response properties initiates the
  866. challenge request. The second call must repeat the exact same properties
  867. and the challenge response.
  868. requestBody:
  869. required: true
  870. content:
  871. application/json:
  872. schema:
  873. oneOf:
  874. - *id-revocation-request
  875. - !merge-objects
  876. - *id-revocation-request
  877. - *auth-challenge-response
  878. responses:
  879. '200':
  880. description: Success... or not.
  881. content:
  882. application/json:
  883. schema:
  884. oneOf:
  885. - *auth-challenge-request
  886. - *id-revocation-response-ok
  887. - *id-revocation-response-error
  888. /identity/set_revocation_key:
  889. post:
  890. summary: Set ID Revocation Key
  891. description: |-
  892. Set the revocation key for an identity.
  893. The first call without the challenge response properties initiates the
  894. challenge request. The second call must repeat the exact same properties
  895. and the challenge response.
  896. requestBody:
  897. required: true
  898. content:
  899. application/json:
  900. schema:
  901. oneOf:
  902. - *id-revocation-request-v1
  903. - !merge-objects
  904. - *id-revocation-request-v1
  905. - *auth-challenge-response
  906. responses:
  907. '200':
  908. description: Success... or not.
  909. content:
  910. application/json:
  911. schema:
  912. oneOf:
  913. - *auth-challenge-request
  914. - *id-revocation-response-ok
  915. - *id-revocation-response-error
  916. /identity/check_revocation_key:
  917. post:
  918. summary: Check ID Revocation Key
  919. description: |-
  920. Check whether a revocation key is set for a given ID
  921. The first call without the challenge response properties initiates the
  922. challenge request. The second call must repeat the exact same properties
  923. and the challenge response.
  924. requestBody:
  925. required: true
  926. content:
  927. application/json:
  928. schema:
  929. oneOf:
  930. - *id-revocation-request
  931. - !merge-objects
  932. - *id-revocation-request-v1
  933. - *auth-challenge-response
  934. responses:
  935. '200':
  936. description: Success... or not.
  937. content:
  938. application/json:
  939. schema:
  940. oneOf:
  941. - *auth-challenge-request
  942. - *id-revocation-response-error
  943. - *id-revocation-key-check-response-found
  944. - *id-revocation-key-check-response-empty
  945. /identity/ws/revoke:
  946. post:
  947. summary: ID Revocation by User-set Key
  948. description:
  949. Revoke a Threema ID with a user-set key previously derived from a
  950. password.
  951. requestBody:
  952. required: true
  953. content:
  954. application/json:
  955. schema:
  956. oneOf:
  957. - *id-revocation-request-v1
  958. responses:
  959. '200':
  960. description: Success... or not.
  961. content:
  962. application/json:
  963. schema:
  964. oneOf:
  965. - *id-revocation-response-ok
  966. - *id-revocation-response-error
  967. /identity/sfu_cred:
  968. post:
  969. summary: SFU Information
  970. description: |-
  971. Retrieve SFU information including URLs and authentication credentials.
  972. The first call without the challenge response properties initiates the
  973. challenge request. The second call must repeat the exact same properties
  974. and the challenge response.
  975. requestBody:
  976. required: true
  977. content:
  978. application/json:
  979. schema:
  980. oneOf:
  981. - *sfu-credentials-request
  982. - !merge-objects
  983. - *auth-challenge-response
  984. - *sfu-credentials-request
  985. responses:
  986. '200':
  987. description: Success... or not.
  988. content:
  989. application/json:
  990. schema:
  991. oneOf:
  992. - *auth-challenge-request
  993. - *sfu-credentials-response-ok
  994. - *sfu-credentials-response-error
  995. '429':
  996. description: Rate limit exceeded.
  997. /identity/update_work_info:
  998. post:
  999. summary: Work Properties (Legacy)
  1000. description: |-
  1001. Update Work properties associated to the currently used Threema ID. Only
  1002. used by the _Work_ flavour of Threema.
  1003. The first call without the challenge response properties initiates the
  1004. challenge request. The second call must repeat the exact same properties
  1005. and the challenge response.
  1006. Note 1: All data of the request must be sourced **exclusively** from MDM
  1007. parameters. For example, the data source for `nickname` must be
  1008. `th_nickname` and not the custom nickname chosen by the user.
  1009. Note 2: This endpoint is intended to be replaced with the new _Work
  1010. Properties_ endpoint eventually, see PRD-186.
  1011. TODO(SE-368): When sending/receiving steps.
  1012. requestBody:
  1013. required: true
  1014. content:
  1015. application/json:
  1016. schema:
  1017. oneOf:
  1018. - *work-properties-legacy-request
  1019. - !merge-objects
  1020. - *auth-challenge-response
  1021. - *work-properties-legacy-request
  1022. responses:
  1023. '200':
  1024. description: Success... or not.
  1025. content:
  1026. application/json:
  1027. schema:
  1028. oneOf:
  1029. - *auth-challenge-request
  1030. - *work-properties-legacy-response-ok
  1031. - *work-properties-legacy-response-error
  1032. '429':
  1033. description: Rate limit exceeded.
  1034. /fetch2:
  1035. post:
  1036. summary: Work Sync
  1037. description: |-
  1038. Full sync of all data associated to the Work subscription. Only used by
  1039. the _Work_ flavour of Threema.
  1040. TODO(SE-368): When sending/receiving steps.
  1041. servers: *work-servers
  1042. requestBody:
  1043. required: true
  1044. content:
  1045. application/json:
  1046. schema: !merge-objects
  1047. - *work-credentials
  1048. - *sync-work-data-request
  1049. responses:
  1050. '200':
  1051. description: Work subscription data.
  1052. content:
  1053. application/json:
  1054. schema: *sync-work-data-response
  1055. '400':
  1056. description: Invalid request.
  1057. '401':
  1058. description: Invalid username or password.
  1059. '429':
  1060. description: Rate limit exceeded.
  1061. /identities:
  1062. post:
  1063. summary: Work Contacts
  1064. description: |-
  1065. Request properties associated to a contact of the same Work subscription.
  1066. Note: This endpoint is currently buggy. See TWRK-1633 for a list of bugs.
  1067. TODO(SE-368): When sending/receiving steps. Send before adding a new
  1068. contact.
  1069. servers: *work-servers
  1070. requestBody:
  1071. required: true
  1072. content:
  1073. application/json:
  1074. schema: !merge-objects
  1075. - *work-credentials
  1076. - *work-contacts-request
  1077. responses:
  1078. '200':
  1079. description: Matching Work contacts in the same Work subscription.
  1080. content:
  1081. application/json:
  1082. schema: *work-contacts-response
  1083. '400':
  1084. description: Invalid request.
  1085. '401':
  1086. description: Invalid username or password.
  1087. '429':
  1088. description: Rate limit exceeded.
  1089. /directory:
  1090. post:
  1091. summary: Work Directory
  1092. description: |-
  1093. Search for contacts in the same Work subscription as the user.
  1094. TODO(SE-368): When sending/receiving steps.
  1095. servers: *work-servers
  1096. requestBody:
  1097. required: true
  1098. content:
  1099. application/json:
  1100. schema:
  1101. oneOf:
  1102. - !merge-objects
  1103. - *work-credentials
  1104. - *work-directory-request-wildcard
  1105. - !merge-objects
  1106. - *work-credentials
  1107. - *work-directory-request-specific
  1108. responses:
  1109. '200':
  1110. description: Queried Work contacts of the same Work subscription.
  1111. content:
  1112. application/json:
  1113. schema: *work-directory-response
  1114. '400':
  1115. description: Invalid request.
  1116. '401':
  1117. description: Invalid username or password.
  1118. '429':
  1119. description: Rate limit exceeded.
  1120. /api-client/v1/user-properties:
  1121. post:
  1122. summary: Work Properties
  1123. description: |-
  1124. Update Work properties associated to the currently used Threema ID. Only
  1125. used by the _Work_ flavour of Threema.
  1126. The first call without the challenge response properties initiates the
  1127. challenge request. The second call must repeat the exact same properties
  1128. and the challenge response.
  1129. Note 1: All data (except for the availability status) of the request
  1130. must be sourced **exclusively** from MDM parameters. For example, the
  1131. data source for `nickname` must be `th_nickname` and not the custom
  1132. nickname chosen by the user.
  1133. Note 2: This endpoint is intended to replace the old _Work Properties
  1134. (Legacy)_ endpoint eventually, see PRD-186.
  1135. When receiving this request without the challenge response:
  1136. 1. If the request could not be decoded, respond with status code `400`.
  1137. 2. Respond with an authentication challenge tied to the provided data
  1138. with purpose _set_.
  1139. When receiving this request with the challenge response:
  1140. 1. If the request could not be decoded, respond with status code `400`.
  1141. 2. If the Work `credentials` are invalid, respond with status code
  1142. `401` and code `invalid-credentials`.
  1143. 3. If the `challenge` expired, respond with status code `401` and code
  1144. `challenge-expired`.
  1145. 4. If the `challenge` is not tied to the provided data or does not have
  1146. the purpose _set_, respond with status code `401` and code
  1147. `invalid-challenge-response`.
  1148. 5. If the `response` is not the correctly _signed_ `challenge`, respond
  1149. with status code `401` and code `invalid-challenge-response`.
  1150. 6. Decode `properties` into a `directory.WorkProperties` message. If
  1151. this fails, respond with status code `400`.
  1152. 7. Update the work properties of the respective user and let `changes`
  1153. be the set of changes that were applied, including a UNIX-ish
  1154. timestamp in milliseconds on when the change was applied.
  1155. 8. If `changes` is empty, respond with status code `204`.
  1156. 9. For each `contact` of the work contacts in the same subscription as
  1157. the respective user, schedule sending a `csp_e2e.WorkSyncDelta` via
  1158. `*3MAW0RK` to `contact` with `changes`.
  1159. 10. Respond with status code `204`.
  1160. servers: *work-servers
  1161. requestBody:
  1162. required: true
  1163. content:
  1164. application/json:
  1165. schema:
  1166. oneOf:
  1167. - !merge-objects
  1168. - *work-credentials-with-identity
  1169. - *work-properties-request
  1170. - !merge-objects
  1171. - *work-credentials-with-identity
  1172. - *work-auth-challenge-response
  1173. - *work-properties-request
  1174. responses:
  1175. '200':
  1176. description: Authentication challenge.
  1177. content:
  1178. application/json:
  1179. schema: *work-auth-challenge-request
  1180. '204':
  1181. description: Success.
  1182. '400':
  1183. description: Invalid request.
  1184. '401':
  1185. description: Authentication failed.
  1186. content:
  1187. application/json:
  1188. schema: *work-auth-failed
  1189. '429':
  1190. description: Rate limit exceeded.
  1191. /api-client/v1/remote-secret:
  1192. put:
  1193. summary: Create Remote Secret
  1194. description: |-
  1195. Create a new Remote Secret.
  1196. The first call without the challenge response properties initiates the
  1197. challenge request. The second call must repeat the exact same properties
  1198. and the challenge response.
  1199. When receiving this request without the challenge response:
  1200. 1. If the request could not be decoded, respond with status code `400`.
  1201. 2. Respond with an authentication challenge tied to the provided data
  1202. with purpose _create_.
  1203. When receiving this request with the challenge response:
  1204. 1. If the request could not be decoded, respond with status code `400`.
  1205. 2. If the Work `credentials` are invalid, respond with status code `401`
  1206. and code `invalid-credentials`.
  1207. 3. If the `challenge` expired, respond with status code `401` and code
  1208. `challenge-expired`.
  1209. 4. If the `challenge` is not tied to the provided data or does not have
  1210. the purpose _create_, respond with status code `401` and code
  1211. `invalid-challenge-response`.
  1212. 5. If the `response` is not the correctly _signed_ `challenge`, respond
  1213. with status code `401` and code `invalid-challenge-response`.
  1214. 6. Create a new random Remote Secret Authentication Token and let
  1215. `remote-secret-authentication-token` be the result.
  1216. 7. Add a new entry for the Remote Secret `secret` tied to `identity` and
  1217. `remote-secret-authentication-token`.
  1218. 8. Respond with status code `200` and the
  1219. `remote-secret-authentication-token`.
  1220. servers: *work-servers
  1221. requestBody:
  1222. required: true
  1223. content:
  1224. application/json:
  1225. schema:
  1226. oneOf:
  1227. - !merge-objects
  1228. - *work-credentials-with-identity
  1229. - *remote-secret-create-request
  1230. - !merge-objects
  1231. - *work-credentials-with-identity
  1232. - *work-auth-challenge-response
  1233. - *remote-secret-create-request
  1234. responses:
  1235. '200':
  1236. description: Success or authentication challenge.
  1237. content:
  1238. application/json:
  1239. schema:
  1240. oneOf:
  1241. - *work-auth-challenge-request
  1242. - *remote-secret-create-response
  1243. '400':
  1244. description: Invalid request.
  1245. '401':
  1246. description: Authentication failed.
  1247. content:
  1248. application/json:
  1249. schema: *work-auth-failed
  1250. '429':
  1251. description: Rate limit exceeded.
  1252. delete:
  1253. summary: Delete Remote Secret
  1254. description: |-
  1255. Remove an existing Remote Secret.
  1256. The first call without the challenge response properties initiates the
  1257. challenge request. The second call must repeat the exact same properties
  1258. and the challenge response.
  1259. When receiving this request without the challenge response:
  1260. 1. If the request could not be decoded, respond with status code `400`.
  1261. 2. Respond with an authentication challenge tied to the provided data
  1262. with purpose _delete_.
  1263. When receiving this request with the challenge response:
  1264. 1. If the request could not be decoded, respond with status code `400`.
  1265. 2. If the Work `credentials` are invalid, respond with status code `401`
  1266. and code `invalid-credentials`.
  1267. 3. If the `challenge` expired, respond with status code `401` and code
  1268. `challenge-expired`.
  1269. 4. If the `challenge` is not tied to the provided data or does not have
  1270. the purpose _delete_, respond with status code `401` and code
  1271. `invalid-challenge-response`.
  1272. 5. If the `response` is not the correctly _signed_ `challenge`, respond
  1273. with status code `401` and code `invalid-challenge-response`.
  1274. 6. Remove any existing Remote Secret entry tied to `identity` and
  1275. `remoteSecretAuthenticationToken`.
  1276. 7. Respond with status code `204`.
  1277. servers: *work-servers
  1278. requestBody:
  1279. required: true
  1280. content:
  1281. application/json:
  1282. schema:
  1283. oneOf:
  1284. - !merge-objects
  1285. - *work-credentials-with-identity
  1286. - *remote-secret-delete-request
  1287. - !merge-objects
  1288. - *work-credentials-with-identity
  1289. - *work-auth-challenge-response
  1290. - *remote-secret-delete-request
  1291. responses:
  1292. '200':
  1293. description: Authentication challenge.
  1294. content:
  1295. application/json:
  1296. schema: *work-auth-challenge-request
  1297. '204':
  1298. description: Success.
  1299. '400':
  1300. description: Invalid request.
  1301. '401':
  1302. description: Authentication failed.
  1303. content:
  1304. application/json:
  1305. schema: *work-auth-failed
  1306. '429':
  1307. description: Rate limit exceeded.
  1308. post:
  1309. summary: Fetch Remote Secret
  1310. description: |-
  1311. Fetch an existing Remote Secret.
  1312. When receiving this request:
  1313. 1. Look up a Remote Secret tied to `identity` and
  1314. `remoteSecretAuthenticationToken` and let `secret` be the result.
  1315. 2. If `secret` is not defined, respond with status code `404`.
  1316. 3. If the access to `secret` is blocked, respond with status code `403`.
  1317. 4. Respond with status code `200` and `secret` along with the associated
  1318. configuration for `identity`.
  1319. servers: *work-servers
  1320. requestBody:
  1321. required: true
  1322. content:
  1323. application/json:
  1324. schema: *remote-secret-fetch-request
  1325. responses:
  1326. '200':
  1327. description: Success.
  1328. content:
  1329. application/json:
  1330. schema: *remote-secret-fetch-response
  1331. '400':
  1332. description: Invalid request.
  1333. '403':
  1334. description: Access to the Remote Secret blocked.
  1335. '404':
  1336. description: Remote Secret does not exist.
  1337. '429':
  1338. description: Rate limit exceeded.