---
title: "Generate a TOTP code"
method: POST
path: "/2fa"
tags: ["2FA"]
---

# Generate a TOTP code

`POST /2fa`

## Request

- Base URL: `https://dummyjson.com`
- URL: `https://dummyjson.com/2fa`
- Auth: none required

## Request body

- object
  - `key` string, required: Base32 secret or otpauth:// URI

## Response `200`

TOTP payload

- TotpResponse
  - `totp` string
  - `expiresIn` integer
  - `period` integer

## Other responses

- `400`: Error

---

[API](https://skmtc.dev/dummyjson/apis/dummyjson-api.md) - [All operations](https://skmtc.dev/dummyjson/apis/dummyjson-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dummyjson/apis/dummyjson-api/revisions/5e704f33a559?raw)
