> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vast.ai/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. The CLI asks you to confirm (`y`/`n`) before proceeding, since this invalidates every existing backup code, and then prompts for how to save the new ones (a default file under `~/Downloads`, a custom path, or print to screen).

## 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. (alias: `-c`)
</ParamField>

<ParamField path="--backup-code" type="string">
  One-time backup code to authorize regeneration. Exactly one of `--code` or `--backup-code` is required. (alias: `-bc`)
</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. (alias: `-t`)
</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`. (alias: `-s`)
</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`. (alias: `-id`)
</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`) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.