Generate new recovery codes
curl --request POST \
--url 'https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token='import requests
url = "https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token="
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token="
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"createdOn": "2023-06-01T12:00:00Z",
"recoveryCodes": [
"51900675"
]
}{
"status": 401,
"type": "AUTH:UNAUTHORIZED",
"message": "Authentication failed",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}{
"status": 403,
"type": "AUTH:ACCESS_DENIED",
"message": "Access denied",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}{
"status": 428,
"type": "AUTH:MFA_REQUIRED",
"message": "MFA activation required",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}Configuration
Generate new recovery codes
POST /configuration/mfa/recovery
Issues a fresh set of one-time recovery codes for the calling user - a single code clears every outstanding factor of one sign-in, for when the usual devices are out of reach. Generating a set invalidates whatever set was issued before, and this response is the only place the codes appear, so they have to be captured here.
Recovery codes only make sense alongside multi-factor authentication, so at least one factor has to be active before a set can be issued.
Token authorization: Authorize using a token — either a session token obtained from login or an API key — to call this endpoint.
Required user rights: update_personal_profile
Generate new recovery codes
curl --request POST \
--url 'https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token='import requests
url = "https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token="
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token="
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.circularo.com/api/v1/configuration/mfa/recovery?token=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"createdOn": "2023-06-01T12:00:00Z",
"recoveryCodes": [
"51900675"
]
}{
"status": 401,
"type": "AUTH:UNAUTHORIZED",
"message": "Authentication failed",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}{
"status": 403,
"type": "AUTH:ACCESS_DENIED",
"message": "Access denied",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}{
"status": 428,
"type": "AUTH:MFA_REQUIRED",
"message": "MFA activation required",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}Authorizations
Response
Returns the new recovery codes; the previous set no longer works.