Step-Up MFA API Reference
The Step-Up MFA APIs can be called from your backend using your PropelAuth API Key. These APIs are not required for your users to login with MFA and are instead to be used when you want to require a user to verify their MFA for a specific action within your application.
Check out the Step-Up MFA documentation for more information on how to use these APIs.
GET /api/backend/v1/user/<user_id>>/mfa
Returns which type of MFA (TOTP or SMS) the user is enrolled in. See the
Step-Up MFA Guide for more information.
Properties Name userId * Type string Description The ID of the user. Request Javascript Python Rust Go cURL
auth .fetchUserMfaMethods ( "31c41c16-c281-44ae-9602-8a047e3bf33d" ) CopyCopied! auth . fetch_user_mfa_methods ( "31c41c16-c281-44ae-9602-8a047e3bf33d" ) CopyCopied! auth . user () . fetch_user_mfa_methods ( FetchUserMfaMethodsParams {
user_id : "31c41c16-c281-44ae-9602-8a047e3bf33d" . to_string ()
}) CopyCopied! auth. FetchUserMfaMethods (uuid. MustParse ( "31c41c16-c281-44ae-9602-8a047e3bf33d" )) CopyCopied! curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
"<AUTH_URL>/api/backend/v1/user/<user_id>/mfa" CopyCopied!
Successful Response // if TOTP MFA
{
mfaSetup : {
type : "Totp"
}
}
// if SMS MFA
{
mfaSetup : {
type : "Phone" ,
phone_numbers : [
{
mfa_phone_number_suffix : "1234" ,
mfa_phone_id : "cc83af74-cd..."
} ,
{
mfa_phone_number_suffix : "5678" ,
mfa_phone_id : "4d01e8ac-2c..."
}
]
}
} CopyCopied! # if TOTP MFA
{
mfa_setup : {
type : "Totp"
}
}
# if SMS MFA
{
mfa_setup : {
type : "Phone" ,
phone_numbers : [
{
mfa_phone_number_suffix : "1234" ,
mfa_phone_id : "cc83af74-cd..."
} ,
{
mfa_phone_number_suffix : "5678" ,
mfa_phone_id : "4d01e8ac-2c..."
}
]
}
} CopyCopied! // if TOTP MFA
FetchUserMfaMethodsResponse {
mfa_setup : {
type : "Totp"
}
}
// if SMS MFA
FetchUserMfaMethodsResponse {
mfa_setup : {
type : "Phone" ,
phone_numbers : [
{
mfa_phone_number_suffix : "1234" ,
mfa_phone_id : "cc83af74-cd..."
} ,
{
mfa_phone_number_suffix : "5678" ,
mfa_phone_id : "4d01e8ac-2c..."
}
]
}
} CopyCopied! // if TOTP MFA
FetchUserMfaMethodsResponse {
MfaSetup : {
Type : "Totp"
}
}
// if SMS MFA
FetchUserMfaMethodsResponse{
MfaSetup : {
Type : "Phone" ,
PhoneNumbers : [
{
MfaPhoneNumberSuffix : "1234" ,
MfaPhoneID : "cc83af74-cd..."
} ,
{
MfaPhoneNumberSuffix : "5678" ,
MfaPhoneID : "4d01e8ac-2c..."
}
]
}
} CopyCopied! // if TOTP MFA
{
"mfa_setup" : {
"type" : "Totp"
}
}
// if SMS MFA
{
"mfa_setup" : {
"type" : "Phone" ,
"phone_numbers" : [
{
"mfa_phone_number_suffix" : "1234" ,
"mfa_phone_id" : "cc83af74-cd..."
} ,
{
"mfa_phone_number_suffix" : "5678" ,
"mfa_phone_id" : "4d01e8ac-2c..."
}
]
}
} CopyCopied!
POST /api/backend/v1/mfa/step-up/verify-totp
Verifies a user's TOTP code and returns a step-up grant if successful. The user must have MFA enabled before this endpoint can be used. See the
Step-Up MFA Guide for more information.
Properties Name actionType * Type string Description Any string you want, such as `SENSITIVE_ACTION`. This is used to identify the action that the user is trying to perform. It must match the action_type that will be used when
verifying the user's Step-Up Grant .
Name userId * Type string Description The ID of the user. Name code * Type string Description The code from the user's TOTP app. This is usually a 6-digit number. Name grantType * Type string Description Must equal either "ONE_TIME_USE" or "TIME_BASED". This is used to identify the type of grant that you want to create. Name validForSeconds * Type number Description The number of seconds that the grant should be valid for. Request Javascript Python Rust Go cURL
auth .verifyStepUpTotpChallenge ({
actionType : "SENSITIVE_ACTION" ,
userId : "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
code : "123456" ,
grantType : "TIME_BASED" ,
validForSeconds : 60
}); CopyCopied! auth . verify_step_up_totp_challenge (
action_type = "SENSITIVE_ACTION" ,
user_id = "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
code = "123456" ,
grant_type: "TIME_BASED" ,
valid_for_seconds: 60
) CopyCopied! auth . mfa () . verify_step_up_totp_challenge ( VerifyTotpChallengeParams {
action_type : "SENSITIVE_ACTION" . to_string (),
user_id : "31c41c16-c281-44ae-9602-8a047e3bf33d" . to_string (),
code : "123456" . to_string (),
grant_type : "TIME_BASED" . to_string (),
valid_for_seconds : 60
}) CopyCopied! auth. VerifyStepUpTotpChallenge (
models.VerifyTotpChallengeRequest{
ActionType: "SENSITIVE_ACTION"
UserID: "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
Code: "123456" ,
GrantType: "TIME_BASED" ,
ValidForSeconds: 60
}
) CopyCopied! curl --location --request POST '<AUTH_URL>/api/backend/v1/mfa/step-up/verify-totp'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <API_KEY>'
--data '{
"action_type": "SENSITIVE_ACTION",
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"code": "123456",
"grant_type": "TIME_BASED",
"valid_for_seconds": 60
}' CopyCopied!
Successful Response {
stepUpGrant : "f374f738cc..."
} CopyCopied! {
step_up_grant : "f374f738cc..."
} CopyCopied! VerifyTotpChallengeResponse {
step_up_grant : "f374f738cc..."
} CopyCopied! VerifyTotpChallengeResponse {
StepUpGrant : "f374f738cc..."
} CopyCopied! {
"step_up_grant" : "f374f738cc..."
} CopyCopied!
POST /api/backend/v1/mfa/step-up/phone/send
Properties Name actionType * Type string Description Any string you want, such as `SENSITIVE_ACTION`. This is used to identify the action that the user is trying to perform. It must match the action_type that will be used when
verifying the user's Step-Up Grant .
Name userId * Type string Description The ID of the user. Name mfaPhoneId * Type string Description The ID of the phone retrieved from the Fetch User MFA Methods API. Name grantType * Type string Description Must equal either "ONE_TIME_USE" or "TIME_BASED". This is used to identify the type of grant that you want to create. Name validForSeconds * Type number Description The number of seconds that the grant should be valid for. Request Javascript Python Rust Go cURL
auth .sendSmsMfaCode ({
actionType : "SENSITIVE_ACTION" ,
userId : "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
mfaPhoneId : "38497dea-4d6..." ,
grantType : "TIME_BASED" ,
validForSeconds : 60
}); CopyCopied! auth . send_sms_mfa_code (
action_type = "SENSITIVE_ACTION" ,
user_id = "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
mfa_phone_id = "38497dea-4d6..." ,
grant_type: "TIME_BASED" ,
valid_for_seconds: 60
) CopyCopied! auth . mfa () . send_sms_mfa_code ( SendSmsMfaCodeParams {
action_type : "SENSITIVE_ACTION" . to_string (),
user_id : "31c41c16-c281-44ae-9602-8a047e3bf33d" . to_string (),
mfa_phone_id : "38497dea-4d6..." . to_string (),
grant_type : "TIME_BASED" . to_string (),
valid_for_seconds : 60
}) CopyCopied! auth. SendSmsMfaCode (
models.SendSmsMfaCodeRequest{
ActionType: "SENSITIVE_ACTION"
UserID: "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
MfaPhoneID: "38497dea-4d6..." ,
GrantType: "TIME_BASED" ,
ValidForSeconds: 60
}
) CopyCopied! curl --location --request POST '<AUTH_URL>/api/backend/v1/mfa/step-up/phone/send'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <API_KEY>'
--data '{
"action_type": "SENSITIVE_ACTION",
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"mfa_phone_id": "38497dea-4d6...",
"grant_type": "ONE_TIME_USE",
"valid_for_seconds": 100
}' CopyCopied!
Successful Response {
challengeId : "a7b0e75b-3a..."
} CopyCopied! {
challenge_id : "a7b0e75b-3a..."
} CopyCopied! SendSmsCodeResponse {
challenge_id : "a7b0e75b-3a..."
} CopyCopied! SendSmsMfaCodeResponse {
ChallengeID : "a7b0e75b-3a..."
} CopyCopied! {
"challenge_id" : "a7b0e75b-3a..."
} CopyCopied!
POST /api/backend/v1/mfa/step-up/phone/verify
Verifies a user's MFA challenge and code created by the
Send SMS MFA Code API. The user must have MFA enabled before this endpoint can be used. See the
Step-Up MFA Guide for more information.
Properties Name challengeId * Type string Description Name userId * Type string Description The ID of the user. Name code * Type string Description The code from the SMS. This is usually a 6-character string. Request Javascript Python Rust Go cURL
auth .verifySmsChallenge ({
challengeId : "38497dea-4d6.." ,
userId : "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
code : "123456" ,
}); CopyCopied! auth . verify_sms_challenge (
challenge_id = "38497dea-4d6.." ,
user_id = "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
code = "123465" ,
) CopyCopied! auth . mfa () . verify_sms_challenge ( VerifySmsChallengeParams {
challenge_id : "38497dea-4d6.." . to_string (),
user_id : "31c41c16-c281-44ae-9602-8a047e3bf33d" . to_string (),
code : "123456" . to_string (),
}) CopyCopied! auth. VerifySmsChallenge (
models.VerifySmsChallengeRequest{
ChallengeID: "38497dea-4d6.." ,
UserID: "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
Code: "123456" ,
}
) CopyCopied! curl --location --request POST '<AUTH_URL>/api/backend/v1/mfa/step-up/phone/verify'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <API_KEY>'
--data '{
"challenge_id": "6a03ef0c-5d...",
"user_id": "6200a53c-c2...",
"code": "ABC123"
}' CopyCopied!
Successful Response {
stepUpGrant : "f1d402e7679197..."
} CopyCopied! {
step_up_grant : "f1d402e7679197..."
} CopyCopied! VerifySmsChallengeResponse {
step_up_grant : "f1d402e7679197..."
} CopyCopied! VerifySmsChallengeResponse{
StepUpGrant : "f1d402e7679197..."
} CopyCopied! {
"step_up_grant" : "f1d402e7679197..."
} CopyCopied!
POST /api/backend/v1/mfa/step-up/verify-grant
Properties Name actionType * Type string Description Any string you want, such as `SENSITIVE_ACTION`. This is used to identify the action that the user is trying to perform. It must match the action_type that was used in either the
Verify TOTP Challenge or
Send SMS MFA Code APIs.
Name userId * Type string Description The ID of the user. Name grant * Type string Description Request Javascript Python Rust Go cURL
auth .verifyStepUpGrant ({
actionType : "SENSITIVE_ACTION" ,
userId : "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
grant : "f374f738cc..."
}); CopyCopied! auth . verify_step_up_grant (
action_type = "SENSITIVE_ACTION" ,
user_id = "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
grant = "f374f738cc..."
) CopyCopied! auth . mfa () . verify_step_up_grant ( VerifyStepUpGrantParams {
action_type : "SENSITIVE_ACTION" . to_string (),
user_id : "31c41c16-c281-44ae-9602-8a047e3bf33d" . to_string (),
grant : "f374f738cc..." . to_string (),
}) CopyCopied! auth. VerifyStepUpGrant (
models.VerifyStepUpGrantRequest{
ActionType: "SENSITIVE_ACTION"
UserID: "31c41c16-c281-44ae-9602-8a047e3bf33d" ,
Grant: "f374f738cc..."
}
) CopyCopied! curl --location --request POST '<AUTH_URL>/api/backend/v1/mfa/step-up/verify-grant'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <API_KEY>'
--data '{
"action_type": "SENSITIVE_ACTION",
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"grant": "f374f738cc..."
}' CopyCopied!
Successful Response {
success : true
} CopyCopied! VerifyStepUpGrantResponse {
success : true ,
} CopyCopied! {
"success" : true
}, nil CopyCopied!