---
title: "Generate TOTP code"
method: GET
path: "/credentials/{id_or_name}/totp-code"
tags: ["Credentials"]
---

# Generate TOTP code

`GET /credentials/{id_or_name}/totp-code`

Returns the current 6-digit TOTP code for a credential with a configured totp_secret. Use this to complete 2FA setup on sites or when you need a fresh code.

## Path parameters

- `id_or_name` string, required

## Response `200`

TOTP code generated successfully

- object
  - `code` string, required — Current 6-digit TOTP code
  - `expires_at` string, date-time, required — When this code expires (ISO 8601 timestamp)

## Other responses

- `401` — Unauthorized – missing or invalid authorization token
- `404` — Credential not found or has no TOTP secret configured
- `500` — Internal Server Error

---

[API](https://skmtc.net/kernel/apis/kernel-api.md) · [All operations](https://skmtc.net/kernel/apis/kernel-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kernel/kernel-api/versions/9e8ce9fcf5e1/schema)
