Start two-factor setup

POST/api/v1/mailbox/security/2fa/begin
Requires amailbox token— it acts as one mailbox holder, not as the organization.

No body. Returns a secret and a QR code for an authenticator app, and one-time recovery codes. Show the codes once; then confirm with POST /security/2fa/confirm. Nothing changes until it is confirmed.

Errors

Status When
401 No token, or the session expired or was signed out. Sign in again with POST /mailbox-auth/login.
403 The account has a temporary password: until POST /security/password succeeds, every other call answers this with error_code: password_change_required.
400 Could not start enrolment (for example, two-factor is already on).

Request

POST/api/v1/mailbox/security/2fa/begin
curl -X POST 'https://courier.mailyte.com/api/v1/mailbox/security/2fa/begin' \
  -H 'Authorization: Bearer MAILBOX_TOKEN'

Response

Successful Response

  • dataobject
    • secretstring
    • qr_code_svgstring

      An SVG image to show.

    • recovery_codesarray<string>
200application/json
{
  "type": "success",
  "msg": "Enrolment started",
  "data": {
    "secret": "JBSWY3DPEHPK3PXP",
    "qr_code_svg": "<svg ...>",
    "recovery_codes": [
      "8f3k-2m9q",
      "p4x7-1c6z"
    ]
  }
}

Returned inside the standard envelope.

Errors

StatusWhen
400`Could not start enrolment` (for example, two-factor is already on).
401No token, or the session expired or was signed out. Sign in again with `POST /mailbox-auth/login`.
403The account has a temporary password: until `POST /security/password` succeeds, every other call answers this with `error_code: password_change_required`.

Every status, with what causes it and what to do, is on the error reference.