> For the complete documentation index, see [llms.txt](https://docs.delos.financial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.delos.financial/authentication/otp-enable.md).

# Otp Enable

Initiates two-factor authentication (2FA) setup by generating a new OTP secret and QR code for authenticator apps (Google Authenticator, Authy, etc.).

**Endpoint**

&#x20;`POST/v2/auth/otp/enable`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Auth_OtpEnable>" %}

### **Request**

#### **Headers**

| Key             | Value              | Required |
| --------------- | ------------------ | -------- |
| `Authorization` | `Bearer <JWT>`     | Yes      |
| `Content-Type`  | `application/json` | Yes      |
| `Accept`        | `application/json` | Yes      |

#### **Request Body**

No body required. Send an empty JSON object:

```
{}
```

***

### **Response (200 OK)**

Returns the OTP setup data for configuring an authenticator app.

#### **Response Fields**

| Field        | Type     | Description                                                          | Example                                  |
| ------------ | -------- | -------------------------------------------------------------------- | ---------------------------------------- |
| **`qr`**     | `string` | **Base64-encoded QR code** image. Scan with authenticator apps.      | `"data:image/png;base64,iVBORw0KGgo..."` |
| **`secret`** | `string` | **OTP secret key** (manual entry option). 32-character alphanumeric. | `"JBSWY3DPEHPK3PXP"`                     |

**Example Response:**

```
{
  "qr": "data:image/png;base64,iVBORw0KGgo...",
  "secret": "JBSWY3DPEHPK3PXP"
}
```

#### **Next Steps**

1. **Scan QR Code** with an authenticator app **OR**
2. **Manually Enter Secret**:

   ```
   Secret: JBSWY3DPEHPK3PXP
   Type: TOTP (Time-based)
   Digits: 6
   Period: 30s
   ```
3. **Verify Setup**: Use `/v2/auth/otp/confirm` with a generated OTP code to activate 2FA.

***

### **Error Responses**

1. **2FA Already Enabled**:

   ```
   {
     "error": "2FA is already active"
   }
   ```
2. **Invalid/Missing Token**:

   ```
   {
     "error": "Unauthorized"
   }
   ```

***

### **Notes**

* **QR Code Usage**:
  * The QR contains the `secret` + issuer info (e.g., `otpauth://totp/YourApp:user@email.com?secret=JBSWY3DPEHPK3PXP&issuer=YourApp`).
* **Backup Codes**: Generate separately via `/v2/auth/otp/backup-codes` after confirmation.
* **Security**:
  * Store the `secret` securely (required for recovery).
  * The QR/secret are **valid for 10 minutes** (confirm promptly).

### Examples

**Real request**&#x20;

```codeql
Authorization:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE2NCwiZXhwIjoxNzYzNTQ5NTU1LCJrZXkiOiI1Y2ZiOGZjN2RmYjk4ZjVkYmIyZTgwNTVkZWFhN2U2Zjk4MzEyYmE3Iiwib3RwX3ZlcmlmaWVkIjpmYWxzZX0.OHY4Gtx1S9W-eOjcLUHqPd5gDB4aqVDec7q9to0L9-0

```

**Real response**&#x20;

```codeql
{
  "qr": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsEAAAAAAMhg3qAAAHbUlEQVR4nOzdwW4bOxKG0cngvv8rZxbZCDAYk2J9Lc/FOctEYrftHwSIIln//P79Hxj330+/AP9OgkVCsEgIFgnBIiFYJASLhGCRECwSgkVCsEgIFgnBIiFYJP75+3//+jX/yNVGndNnvY6z+u7OpqDX767GPH3n081IO8+6GefJv+MfZiwSgkVCsEgIFgnBIvHNqvDV1GqlftbOym71PlMrwZ2f9/Xz9ep19dxT+39HMxYJwSIhWCQEi4RgkThYFb46XfXsjHPz+dOV4M2/rz5zulp8sq63MvV3/MqMRUKwSAgWCcEiIVgk3lwVFnZWVVO1sJsa4qnTZ93ssJ3aiXrPjEVCsEgIFgnBIiFYJH7QqvBmNXS6o/KzZ+6++gnvPMuMRUKwSAgWCcEiIVgk3lwV/oTWTlOrpJszeqfPvakPntZMd3R/RzMWCcEiIVgkBIuEYJE4WBV+6rzbzS0uUze03NTypj6/8z43t+XMMmORECwSgkVCsEgIFolvVoVP1gSnVivFDSrF7+HJnavP13bNWCQEi4RgkRAsEoJF4tff1wvFPZmnuyWnulrUdbTTm2RuVq/FTTWn7/B3ZiwSgkVCsEgIFgnBInGwKnw1tfIqdj8W5wG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FrXD1nsX4O6ZqdsWNOk/2dvzDjEVCsEgIFgnBIiFYJA5qhXVH+LreV+xuXbl5t6nPnD735vNfmbFICBYJwSIhWCQEi8TADtK6u/3NrSn/L7s3X03VLqfGVyvkBxEsEoJFQrBICBaJg9tmbnYhnp6zK26S2XmfouPDytTv4XTMZ3bbmrFICBYJwSIhWCQEi8TBucIdT66qbkydkbyph56udqdu4LmhVsiHCRYJwSIhWCQEi8RBF/u6y8POd4szgDvPXSnOAJ4+a2Wqi8d7K0ozFgnBIiFYJASLhGCRGL5t5tVNR/WbOteT5xB3xlwpdnsWu2rfex8zFgnBIiFYJASLhGCRGNhBWndk+NSu1NNaZ/GeN98tziE6V8iHCRYJwSIhWCQEi8Q3q8K6a8PN2brVv0/tnNwZf8fUyvrGkz0Z/zBjkRAsEoJFQrBICBaJ4TtIV05Xc6fvMHsmbnac0x22RT30pm743u/WjEVCsEgIFgnBIiFYJA5Wha/qDginZxJf3dwFurOj9VR9j+vpam5ltl5pxiIhWCQEi4RgkRAsEm+uCgtT93nedI64GefUzc+yo+h8sTP+H2YsEoJFQrBICBYJwSLxg1aFxbm/J88M7tQZizOVK8WuWucK+TDBIiFYJASLhGCReHNV+OR5vak64Kubc3x1PXHq5zodc+d99pmxSAgWCcEiIVgkBIvEwaqwuI90aoVyuvrb+czNiq/ohn/63dVnnumOYcYiIVgkBIuEYJEQLBLfdLGH95ixSAgWCcEiIVgkBIuEYJEQLBKCRUKwSAgWCcEiIVgkBIuEYJH4XwAAAP//xl+mjdPOCl0AAAAASUVORK5CYII=",
  "secret": "ZEB74RJ6YSNH4KHBWOV4ZOBI"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.delos.financial/authentication/otp-enable.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
