> ## Documentation Index
> Fetch the complete documentation index at: https://flashapi.phs.vn/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Underlying

Generates an access token, refresh token, and OTP token for an underlying account.

### Endpoint

```text theme={null}
POST /oapi/auth/gen-secret-key/underlying
```

### Required body parameters

* `username` — Account username. Example: `022C099995`
* `password` — Account password. Example: `123456aA@`

### Response fields

* `access_token` (`string`) — Access token for authenticated requests.
* `refresh_token` (`string`) — Refresh token for renewing the session.
* `expires_in` (`number`) — Access token lifetime in seconds.
* `otp_token` (`string`) — OTP token returned by the authentication flow.
* `token_type` (`string`) — Token type. Example: `Bearer`

### cURL

```bash theme={null}
curl -X POST "$BASE_URL/oapi/auth/gen-secret-key/underlying" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "022C099995",
    "password": "123456aA@"
  }'
```

### Python

```python theme={null}
import requests

BASE_URL = "https://api.example.com"

payload = {
    "username": "022C099995",
    "password": "123456aA@",
}

response = requests.post(
    f"{BASE_URL}/oapi/auth/gen-secret-key/underlying",
    json=payload,
)
response.raise_for_status()

print(response.json())
```

### Example response

```json theme={null}
{
    "access_token": "022C099995||KRYRTHUYUI||EIfMSnb0jB9MxpGEmVHV4Ghhiq6Tf9iKknzM02IYfYsLTpfTk3pDFPcR6WJqFepDFWXkQeLEpy9ifffm9NEhT9mDdjfHZDGwR7qwifvY1xUI00qe1pwLg9EY2ADJaBfqtsiEP7o6tDVae9lu2vrlq8GsZAKxLgloI8gibxqgPx0mitckPgNH7zjbyIoGKKNOzgErMP777bAWNIta0fnYmqLW7CleiXHtfJLIlXUruAMX5wxX7Gts7Tk4SiGpC9L",
    "refresh_token": "022C099995||KRYRTHUYUI||WSSb0xaoaWbcmCnqxGcJa5MfjElhnQo6G31b6Ay1yavoIgwLOVxm9nUWQIjix0XfYYaxFLJshAS6foc535ai2r1Mzh7OnEGoCKg3bMh32Y0ds5PRT3ySWck2XCuOZYffYOwgIvqIEjA49vCBa0UPuUOwwnPtdp3yK3E49CkPzn2CgyxFgRJxpZ4oezzgyA5fPqcm9h7jSaKIHWcG7vTc9aTDdhmt0SOkdEDc5sAx4nEWEeFxfdbPtXGKR0tx0mLh",
    "expires_in": 28800,
    "otp_token": "552066a35eb30a9815afc952b14287a8",
    "token_type": "Bearer"
}
```

### Error response

```json theme={null}
{
    "code": "OAPI_EQT_500",
    "messageParams": {
        "error": "server_error",
        "error_description": "-107 Tên đăng nhập hoặc mật khẩu không đúng",
        "s": 500
    },
    "params": null,
    "source": "oapi-bridge-eqt",
    "message": null
}
```

> Replace `BASE_URL` with your API host. Upstream error messages can be returned in Vietnamese.
