Recover User
curl --request POST \
--url https://api.dfns.io/auth/recover/user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recovery": {
"kind": "RecoveryKey",
"credentialAssertion": {
"credId": "<string>",
"clientData": "<string>",
"signature": "<string>",
"algorithm": "<string>"
}
},
"newCredentials": {
"firstFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
},
"secondFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
}
}
}
'import requests
url = "https://api.dfns.io/auth/recover/user"
payload = {
"recovery": {
"kind": "RecoveryKey",
"credentialAssertion": {
"credId": "<string>",
"clientData": "<string>",
"signature": "<string>",
"algorithm": "<string>"
}
},
"newCredentials": {
"firstFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
},
"secondFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recovery: {
kind: 'RecoveryKey',
credentialAssertion: {
credId: '<string>',
clientData: '<string>',
signature: '<string>',
algorithm: '<string>'
}
},
newCredentials: {
firstFactorCredential: {
credentialKind: 'Fido2',
credentialInfo: {credId: '<string>', clientData: '<string>', attestationData: '<string>'},
credentialName: '<string>'
},
secondFactorCredential: {
credentialKind: 'Fido2',
credentialInfo: {credId: '<string>', clientData: '<string>', attestationData: '<string>'},
credentialName: '<string>'
}
}
})
};
fetch('https://api.dfns.io/auth/recover/user', 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://api.dfns.io/auth/recover/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'recovery' => [
'kind' => 'RecoveryKey',
'credentialAssertion' => [
'credId' => '<string>',
'clientData' => '<string>',
'signature' => '<string>',
'algorithm' => '<string>'
]
],
'newCredentials' => [
'firstFactorCredential' => [
'credentialKind' => 'Fido2',
'credentialInfo' => [
'credId' => '<string>',
'clientData' => '<string>',
'attestationData' => '<string>'
],
'credentialName' => '<string>'
],
'secondFactorCredential' => [
'credentialKind' => 'Fido2',
'credentialInfo' => [
'credId' => '<string>',
'clientData' => '<string>',
'attestationData' => '<string>'
],
'credentialName' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dfns.io/auth/recover/user"
payload := strings.NewReader("{\n \"recovery\": {\n \"kind\": \"RecoveryKey\",\n \"credentialAssertion\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"signature\": \"<string>\",\n \"algorithm\": \"<string>\"\n }\n },\n \"newCredentials\": {\n \"firstFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n },\n \"secondFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dfns.io/auth/recover/user")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"recovery\": {\n \"kind\": \"RecoveryKey\",\n \"credentialAssertion\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"signature\": \"<string>\",\n \"algorithm\": \"<string>\"\n }\n },\n \"newCredentials\": {\n \"firstFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n },\n \"secondFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dfns.io/auth/recover/user")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recovery\": {\n \"kind\": \"RecoveryKey\",\n \"credentialAssertion\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"signature\": \"<string>\",\n \"algorithm\": \"<string>\"\n }\n },\n \"newCredentials\": {\n \"firstFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n },\n \"secondFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"credential": {
"uuid": "<string>",
"name": "<string>"
},
"user": {
"id": "us-6b58p-r53sr-rlrd3l5cj3uc4ome",
"username": "<string>",
"orgId": "or-30tnh-itmjs-s235s5ontr3r23h2",
"tenantId": "acct-24hka-dhili-9hgvdlvr1ohpibp4"
}
}Recover User
Recovers a user, using a recovery credential. After successfully recovering the user, all of the user’s previous credentials and personal access tokens will be invalidated.
This flow requires cryptographic validation of newly created credential(s) using a recovery credential. The recovery.credentialAssertion.clientData field’s challenge must be the base64url-encoded representation of the newCredential object.
The process is as follows:
- Construct the
newCredentialobject, using the challenge obtained from either the Create Recovery Challenge or Create Delegated Recovery Challenge endpoints. - Serialize the
newCredentialobject to JSON and then base64url-encode the resulting JSON string. This base64url-encoded string will serve as the challenge for therecovery.credentialAssertionobject. - Construct the
recovery.credentialAssertionobject, using the base64url-encoded string generated in step 2 as its challenge.
POST
/
auth
/
recover
/
user
Recover User
curl --request POST \
--url https://api.dfns.io/auth/recover/user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recovery": {
"kind": "RecoveryKey",
"credentialAssertion": {
"credId": "<string>",
"clientData": "<string>",
"signature": "<string>",
"algorithm": "<string>"
}
},
"newCredentials": {
"firstFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
},
"secondFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
}
}
}
'import requests
url = "https://api.dfns.io/auth/recover/user"
payload = {
"recovery": {
"kind": "RecoveryKey",
"credentialAssertion": {
"credId": "<string>",
"clientData": "<string>",
"signature": "<string>",
"algorithm": "<string>"
}
},
"newCredentials": {
"firstFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
},
"secondFactorCredential": {
"credentialKind": "Fido2",
"credentialInfo": {
"credId": "<string>",
"clientData": "<string>",
"attestationData": "<string>"
},
"credentialName": "<string>"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recovery: {
kind: 'RecoveryKey',
credentialAssertion: {
credId: '<string>',
clientData: '<string>',
signature: '<string>',
algorithm: '<string>'
}
},
newCredentials: {
firstFactorCredential: {
credentialKind: 'Fido2',
credentialInfo: {credId: '<string>', clientData: '<string>', attestationData: '<string>'},
credentialName: '<string>'
},
secondFactorCredential: {
credentialKind: 'Fido2',
credentialInfo: {credId: '<string>', clientData: '<string>', attestationData: '<string>'},
credentialName: '<string>'
}
}
})
};
fetch('https://api.dfns.io/auth/recover/user', 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://api.dfns.io/auth/recover/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'recovery' => [
'kind' => 'RecoveryKey',
'credentialAssertion' => [
'credId' => '<string>',
'clientData' => '<string>',
'signature' => '<string>',
'algorithm' => '<string>'
]
],
'newCredentials' => [
'firstFactorCredential' => [
'credentialKind' => 'Fido2',
'credentialInfo' => [
'credId' => '<string>',
'clientData' => '<string>',
'attestationData' => '<string>'
],
'credentialName' => '<string>'
],
'secondFactorCredential' => [
'credentialKind' => 'Fido2',
'credentialInfo' => [
'credId' => '<string>',
'clientData' => '<string>',
'attestationData' => '<string>'
],
'credentialName' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dfns.io/auth/recover/user"
payload := strings.NewReader("{\n \"recovery\": {\n \"kind\": \"RecoveryKey\",\n \"credentialAssertion\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"signature\": \"<string>\",\n \"algorithm\": \"<string>\"\n }\n },\n \"newCredentials\": {\n \"firstFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n },\n \"secondFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dfns.io/auth/recover/user")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"recovery\": {\n \"kind\": \"RecoveryKey\",\n \"credentialAssertion\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"signature\": \"<string>\",\n \"algorithm\": \"<string>\"\n }\n },\n \"newCredentials\": {\n \"firstFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n },\n \"secondFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dfns.io/auth/recover/user")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recovery\": {\n \"kind\": \"RecoveryKey\",\n \"credentialAssertion\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"signature\": \"<string>\",\n \"algorithm\": \"<string>\"\n }\n },\n \"newCredentials\": {\n \"firstFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n },\n \"secondFactorCredential\": {\n \"credentialKind\": \"Fido2\",\n \"credentialInfo\": {\n \"credId\": \"<string>\",\n \"clientData\": \"<string>\",\n \"attestationData\": \"<string>\"\n },\n \"credentialName\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"credential": {
"uuid": "<string>",
"name": "<string>"
},
"user": {
"id": "us-6b58p-r53sr-rlrd3l5cj3uc4ome",
"username": "<string>",
"orgId": "or-30tnh-itmjs-s235s5ontr3r23h2",
"tenantId": "acct-24hka-dhili-9hgvdlvr1ohpibp4"
}
}Authentication
❌ Organization User (CustomerEmployee)❌ Delegated User (
EndUser)❌ Service Account
✅ Recovery Code
Required Permissions
No permission required.Authorizations
Bearer Token: Used to authenticate API requests. More details how to generate the token: Authentication flows
Body
application/json
Last modified on July 9, 2026
Was this page helpful?
⌘I