---
title: "Regenerate Backup Codes"
method: POST
path: "/api/user/2fa/backup_codes"
tags: ["2FA"]
---

# Regenerate Backup Codes

`POST /api/user/2fa/backup_codes`

## 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/backup_codes`
- 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

- ResponseDtoBackupCodesData: Response_dto.BackupCodesData schema
  - `data` BackupCodesData, required
    - `access_expires_at` integer
    - `access_token` string
    - `backup_codes` string[], nullable, required
    - `session` LoginSessionView
      - `created_at` integer, required
      - `current` boolean, required
      - `expires_at` integer, required
      - `ip` string, required
      - `last_active_at` integer, required
      - `login_method` string, required
      - `sid` string, required
      - `user_agent` string, required
    - `token_type` string
  - `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)
  - added the optional property `data/access_expires_at` to the response with the `200` status (media type: application/json)
  - …11 more

[Operation history](https://skmtc.dev/unorouter/apis/new-api/changes/api/user/2fa/backup_codes/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)
