# Verify TOTP enrollment and get backup codes

> Source: https://elaichi.ai/docs/api-reference/current-user/user/verifytotpenrollment/

`POST /user/me/mfa/totp/verify`

Resource: **User** · API: **Current user**

## Request body

- **`code`** _(string)_

## Response body

- **`success`** _(boolean)_
- **`backup_codes`** _(array<string>)_

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/user/me/mfa/totp/verify' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"code":"your_code"}'
```

### JavaScript

```javascript
const body = {
  "code": "your_code"
};

const response = await fetch('https://api.elaichi.ai/user/me/mfa/totp/verify', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/user/me/mfa/totp/verify"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "code": "your_code"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```
