---
title: "Configure TOTP authentication"
method: PUT
path: "/api/users/{username}/totp"
tags: ["Users"]
---

# Configure TOTP authentication

`PUT /api/users/{username}/totp`

## Path parameters

- `username` string, required

## Request body

- object
  - `provisioning_uri` string — The provisioning_uri previously obtained from a GET request for this user.
  - `totp` number — Valid TOTP code for the given provisioning_uri

## Response `201`

When TOTP has been configured successfully.

## Other responses

- `400` — If the provisioning_uri is invalid.
- `403` — If TOTP is already configured for this user, or {username} is not the currently logged in user.
- `422` — If the TOTP code is invalid/does not match the provisioning_uri.
- `503` — If the user is using Passkey authentication, TOTP cannot be configured.

## Changes

- **2025-03-06** `4dc3bf84edf7` — 2 info
  - the endpoint scheme security `CookieAuthentication` was added to the API
  - the endpoint scheme security `TokenAuthentication` was added to the API
- **2025-01-29** `b0fe14acdeaf` — 1 info
  - added the non-success response with the status `503`
- **2025-01-21** `f3f0ed40c70a` — 1 info
  - endpoint added
- **2020-07-23** `42c41034504b` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/contao/apis/contao-manager-api/changes/api/users/:username/totp/put.md)

---

[API](https://skmtc.dev/contao/apis/contao-manager-api.md) · [All operations](https://skmtc.dev/contao/apis/contao-manager-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/contao/contao-manager-api/revisions/074d8046de13/schema)
