---
title: "Generate a TOTP code (query) or render the 2FA tool page"
method: GET
path: "/2fa"
tags: ["2FA"]
---

# Generate a TOTP code (query) or render the 2FA tool page

`GET /2fa`

## Request

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

## Query parameters

- `key` string

## Response `200`

TOTP payload or HTML page

- 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)
