> ## 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 activate

Activate a new 2FA method by verifying the code. Run `vastai tfa auth-new` before this command to authorize adding a new method.

## Usage

```bash theme={null}
vastai tfa activate CODE --secret SECRET [--method-type METHOD_TYPE] [--phone-number PHONE_NUMBER] [--label LABEL]
```

## Arguments

<ParamField path="code" type="string" required>
  6-digit verification code from SMS or Authenticator app.
</ParamField>

## Options

<ParamField path="--secret" type="string" required>
  Secret token from the setup process. For TOTP, obtained from `vastai tfa totp-setup`. For SMS, obtained from `vastai tfa send-sms`.
</ParamField>

<ParamField path="--method-type" type="string">
  New 2FA method type to activate. Choices: `sms`, `totp`. Treated as `totp` when neither this flag nor `--phone-number` is supplied.
</ParamField>

<ParamField path="--phone-number" type="string">
  Phone number for SMS method in E.164 format (e.g., `+12345678901`). Required when activating an SMS method.
</ParamField>

<ParamField path="--label" type="string">
  Friendly label for the new 2FA method (e.g., "Work Authenticator").
</ParamField>

## Examples

```bash theme={null}
# Activate TOTP (Authenticator app)
vastai tfa activate --method-type totp --secret abc123def456 123456

# Activate SMS
vastai tfa activate --method-type sms --secret abc123def456 --phone-number +12345678901 123456

# Activate SMS with a label
vastai tfa activate --method-type sms --secret abc123def456 --phone-number +12345678901 --label "Work Phone" 123456
```

If this is your **first** 2FA method, backup codes are generated and displayed after activation. Save them in a secure location.

## 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`) |
