---
title: "Setup2 F A"
method: POST
path: "/api/user/2fa/setup"
tags: ["2FA"]
---

# Setup2 F A

`POST /api/user/2fa/setup`

## Request

- Base URL: `https://api.unorouter.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.unorouter.com/api/user/2fa/setup`
- Auth: one of:
  - API key in header `Authorization` and API key in header `New-Api-User`
  - API key in header `New-Api-User` and API key in cookie `session`

## Response `200`

OK

- ResponseDtoSetup2FAResponse: Response_dto.Setup2FAResponse schema
  - `data` Setup2FAResponse, required
    - `backup_codes` string[], nullable, required
    - `expires_at` integer, required
    - `flow_token` string, required
    - `qr_code_data` string, required
    - `secret` string, required
  - `message` string, required
  - `success` boolean, required

## Changes

- **2026-10-15** `6cb670e861f5`: 1 breaking, 2 warning, 12 info
  - the `data` response's property type changed from no type to `object` for status `200` (media type: application/json)
  - removed the optional property `object` from the response with the `200` status (media type: application/json)
  - removed the optional property `object` from the response with the `200` status (media type: application/xml)
  - the response property `data` became required for the status `200` (media type: application/json)
  - …11 more

[Operation history](https://skmtc.dev/unorouter/apis/new-api/changes/api/user/2fa/setup/post.md)

---

[API](https://skmtc.dev/unorouter/apis/new-api.md) - [All operations](https://skmtc.dev/unorouter/apis/new-api/llms.txt) - [OpenAPI document](https://skmtc.dev/unorouter/apis/new-api/revisions/1b50ada14f59?raw)
