Turn two-factor on
POST
/api/v1/mailbox/security/2fa/confirmConfirms setup with the current code from the authenticator app. From then on, sign-in needs a code.
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. |
422 |
The code is wrong or expired. |
Request body
codestringrequiredThe current 6-digit code from the authenticator app.
Request
POST
/api/v1/mailbox/security/2fa/confirmcurl -X POST 'https://courier.mailyte.com/api/v1/mailbox/security/2fa/confirm' \
-H 'Authorization: Bearer MAILBOX_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"code": "492039"
}'const response = await fetch('https://courier.mailyte.com/api/v1/mailbox/security/2fa/confirm', {
method: 'POST',
headers: {
Authorization: 'Bearer MAILBOX_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"code": "492039"
}),
});
const { data } = await response.json();import requests
response = requests.post(
"https://courier.mailyte.com/api/v1/mailbox/security/2fa/confirm",
headers={"Authorization": "Bearer MAILBOX_TOKEN"},
json={
"code": "492039"
},
)
data = response.json()["data"]<?php
$response = Http::withToken('MAILBOX_TOKEN')
->post('https://courier.mailyte.com/api/v1/mailbox/security/2fa/confirm', [
'code' => '492039',
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://courier.mailyte.com/api/v1/mailbox/security/2fa/confirm")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer MAILBOX_TOKEN"
request["Content-Type"] = "application/json"
request.body = {
"code": "492039"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Successful Response
dataobjecttwo_factor_enabledbooleantwo_factor_confirmed_atstring
200
application/json{
"type": "success",
"msg": "Two-factor authentication enabled",
"data": {
"two_factor_enabled": true,
"two_factor_confirmed_at": "2026-10-11T12:00:00+00:00"
}
}Returned inside the standard envelope.
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`. |
422 | The code is wrong or expired. |
Every status, with what causes it and what to do, is on the error reference.