---
title: "Generate TOTP key"
method: POST
path: "/accounts/generate-totp-key"
tags: ["Multi-Factor Authentication"]
---

# Generate TOTP key

`POST /accounts/generate-totp-key`

## Request

- Base URL: `https://api.quiva.ai`
- URL: `https://api.quiva.ai/accounts/generate-totp-key`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/quivaworks/apis/quiva-ai-gateway/docs/accounts/generate-totp-key/post.ts> (a function with typed inputs; its response is checked against the schema)

Generates a TOTP key for multi-factor authentication

## Response `200`

TOTP key generated successfully

- object
  - `data` object, required
    - `otpauth_url` string: OTP Auth URL for QR code generation
    - `secret` string: TOTP secret key

## Other responses

- `401`: Unauthorized

## Changes

- **2025-06-12** `4979dfd00eda`: 2 warning, 1 info
  - removed the optional property `otpauth_url` from the response with the `200` status
  - removed the optional property `secret` from the response with the `200` status
  - added the required property `data` to the response with the `200` status

[Operation history](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway/changes/accounts/generate-totp-key/post.md)

---

[API](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway.md) - [All operations](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway/llms.txt) - [OpenAPI document](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway/revisions/700eb1ace61a?raw)
