> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-auto-cli-sdk-preview-pr-398.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# vastai tfa auth-new

Authorize your account to add a new 2FA method

## Usage

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

## Options

<ParamField path="--code" type="string">
  2FA code from Authenticator app, SMS, or Email
</ParamField>

<ParamField path="--secret" type="string">
  Secret token from previous auth step
</ParamField>

<ParamField path="--method-type" type="string" default="email">
  2FA Method type. Only use when you only have one method of this type
  Allowed values: email, sms, totp
</ParamField>

<ParamField path="--backup-code" type="string">
  One-time backup code (alternative to regular 2FA code)
</ParamField>

<ParamField path="--method-id" type="string">
  2FA Method ID if you have more than one of the same type ('id' from `tfa status`)
</ParamField>

## Description

Authorize your account to add a new 2FA method by verifying via email or an existing method.

This is a required step to ensure that only you can add new 2FA methods to your account.

Step 1. Run command with your chosen verification method:

* If you have an existing 2FA method set up, you can use '--backup-code BACKUP\_CODE' to immediately authorize (skip Step 2)
* Use --method-type {sms|totp} or --method-id ID to specify which existing method to use for verification (see `vastai tfa status` for available methods and their IDs)
* Use --method-type email if you have a verified email address and/or no other 2FA methods set up to receive a code via email

Step 2. When prompted, enter the 2FA code from your 2FA method of choice to confirm authorization.

Note:
If you exit the command before being able to enter the code, you can run this command again
with --secret SECRET and --code CODE to complete the authorization step as long as the code has not expired.

## Examples

```bash theme={null}
# Initiating New Method Authorization
 vastai tfa auth-new  (method type is email by default)
 vastai tfa auth-new --method-type totp
 vastai tfa auth-new -t sms
 vastai tfa auth-new --method-id 456
 vastai tfa auth-new --backup-code ABCD-EFGH-IJKL

 # Completing Authorization with code and secret if not completed in previous run
 vastai tfa auth-new --secret abc123def456 --code 123456
```

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