# OTP

## Generate OTP Code

> Generate a current Time-Based One-Time Password (TOTP) code using the provided base32 secret.\
> \
> This endpoint is \*\*public\*\* — no authentication required.\
> The caller must supply a valid base32-encoded TOTP secret (e.g., from an authenticator app setup).\
> Returns the current 6-digit OTP and its remaining validity period.<br>

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"servers":[{"url":"https://api.dmchamp.com/v1","description":"Production API Server"}],"security":[{"ApiKeyAuth":[]},{"UserIdAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"query","name":"apiKey","description":"Your DM Champ API key. Obtain from Settings → API Keys."},"UserIdAuth":{"type":"apiKey","in":"query","name":"userId","description":"Your DM Champ User ID. Alternative to apiKey authentication. Cannot be used for agency-only endpoints."}},"schemas":{"OtpResponse":{"type":"object","description":"OTP generation response","properties":{"success":{"type":"boolean"},"current_otp":{"type":"string","description":"Current 6-digit TOTP code"},"expires_in":{"type":"integer","description":"Seconds until the current code expires (0-30)"}}}}},"paths":{"/otp/generate":{"get":{"summary":"Generate OTP Code","description":"Generate a current Time-Based One-Time Password (TOTP) code using the provided base32 secret.\n\nThis endpoint is **public** — no authentication required.\nThe caller must supply a valid base32-encoded TOTP secret (e.g., from an authenticator app setup).\nReturns the current 6-digit OTP and its remaining validity period.\n","tags":["OTP"],"parameters":[{"name":"secret","in":"query","required":true,"schema":{"type":"string"},"description":"Base32-encoded TOTP secret key"}],"responses":{"200":{"description":"OTP generated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpResponse"}}}},"400":{"description":"Missing or invalid secret parameter","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"string"}}}}}},"500":{"description":"Error generating OTP","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"string"}}}}}}}}}}}
```

## OTP Generator Interface

> Serves an interactive HTML page for generating and viewing TOTP codes in the browser.\
> \
> This endpoint is \*\*public\*\* — no authentication required.\
> The caller must supply a valid base32-encoded TOTP secret via the secret query parameter.\
> The page auto-refreshes the code every 30 seconds and shows a countdown timer.<br>

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"servers":[{"url":"https://api.dmchamp.com/v1","description":"Production API Server"}],"security":[{"ApiKeyAuth":[]},{"UserIdAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"query","name":"apiKey","description":"Your DM Champ API key. Obtain from Settings → API Keys."},"UserIdAuth":{"type":"apiKey","in":"query","name":"userId","description":"Your DM Champ User ID. Alternative to apiKey authentication. Cannot be used for agency-only endpoints."}}},"paths":{"/otp":{"get":{"summary":"OTP Generator Interface","description":"Serves an interactive HTML page for generating and viewing TOTP codes in the browser.\n\nThis endpoint is **public** — no authentication required.\nThe caller must supply a valid base32-encoded TOTP secret via the secret query parameter.\nThe page auto-refreshes the code every 30 seconds and shows a countdown timer.\n","tags":["OTP"],"parameters":[{"name":"secret","in":"query","required":true,"schema":{"type":"string"},"description":"Base32-encoded TOTP secret key"}],"responses":{"200":{"description":"HTML OTP generator interface","content":{"text/html":{"schema":{"type":"string","description":"Interactive HTML page with auto-refreshing TOTP display"}}}},"400":{"description":"Missing secret parameter","content":{"text/plain":{"schema":{"type":"string"}}}}}}}}}
```
