---
title: "Create an MFA verification for a user"
method: POST
path: "/api/users/{userId}/mfa-verifications"
tags: ["Users"]
---

# Create an MFA verification for a user

`POST /api/users/{userId}/mfa-verifications`

Create a new MFA verification for a given user ID.

## Path parameters

- `userId` string, required

## Request body

- union
  - object
    - `type` string, "Totp", required
    - `secret` string
  - object
    - `type` string, "BackupCode", required
    - `codes` string[]
  - object
    - `type` string, required — The type of MFA verification to create.
    - `secret` string — The secret for the MFA verification, if not provided, a new secret will be generated.
  - object
    - `type` string, required — The type of MFA verification to create.
    - `codes` string[] — The backup codes for the MFA verification, if not provided, a new group of backup codes will be generated.

## Response `200`

The MFA verification that was created.

- union
  - object
    - `type` string, "Totp", required
    - `secret` string, required
    - `secretQrCode` string, required
  - object
    - `type` string, "BackupCode", required
    - `codes` string[], required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Content

---

[API](https://skmtc.net/logto/apis/logto-api-references.md) · [All operations](https://skmtc.net/logto/apis/logto-api-references/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/logto/logto-api-references/versions/a163dc77d842/schema)
