> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-docs-cln-3283-cli-tfa-790d53bc8de7f1f3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# vastai tfa regen-codes

Generate a new set of backup codes. Requires 2FA verification.

## Usage

```bash theme={null}
vastai tfa regen-codes [--code CODE] [--method-type METHOD_TYPE] [--secret SECRET] [--backup-code BACKUP_CODE] [--method-id ID]
```

## Options

<ParamField path="--code" type="string">
  2FA code from your Authenticator app, SMS, or Email. Exactly one of `--code` or `--backup-code` is required.
</ParamField>

<ParamField path="--backup-code" type="string">
  One-time backup code to authorize regeneration. Exactly one of `--code` or `--backup-code` is required.
</ParamField>

<ParamField path="--method-type" type="string">
  2FA method type to use for verification. Choices: `email`, `sms`, `totp`. Only use when you have exactly one method of this type.
</ParamField>

<ParamField path="--secret" type="string">
  Secret token required when verifying with `--method-type sms` or `--method-type email`. Obtain from `vastai tfa send-sms` or `vastai tfa send-email`.
</ParamField>

<ParamField path="--method-id" type="string">
  ID of the 2FA method to use for verification if you have more than one of the same type. Get the ID from `vastai tfa status`.
</ParamField>

## Examples

```bash theme={null}
# Verify with TOTP (Authenticator app)
vastai tfa regen-codes --code 123456 --method-type totp

# Verify with SMS (get secret from send-sms first)
vastai tfa regen-codes --code 123456 --method-type sms --secret abc123def456

# Verify with a backup code
vastai tfa regen-codes --backup-code ABCD-EFGH-IJKL
```

**Warning:** Regenerating codes immediately invalidates all existing backup codes. Save the new codes in a secure location — they are not shown again.

## Global Options

The following options are available for all commands:

| Option          | Description                                           |
| --------------- | ----------------------------------------------------- |
| `--url URL`     | Server REST API URL                                   |
| `--retry N`     | Retry limit                                           |
| `--raw`         | Output machine-readable JSON                          |
| `--explain`     | Verbose explanation of API calls                      |
| `--api-key KEY` | API key (defaults to `~/.config/vastai/vast_api_key`) |
