# AuthTOTP

## Verify TOTP

> Verify TOTP code and complete the login process. This endpoint is used after initial login when TOTP is required.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"TOTPVerify":{"type":"object","required":["temp_token","token"],"properties":{"temp_token":{"type":"string","description":"Temporary token received from initial login"},"token":{"type":"string","description":"TOTP verification code"}}},"TOTPVerifyResponse":{"type":"object","properties":{"key":{"type":"string","description":"Login token"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/verify/":{"post":{"summary":"Verify TOTP","description":"Verify TOTP code and complete the login process. This endpoint is used after initial login when TOTP is required.","tags":["AuthTOTP"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPVerify"}}}},"responses":{"200":{"description":"The TOTP verification was successful and login is completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPVerifyResponse"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Setup TOTP

> Setup TOTP authentication.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"TOTPSetup":{"type":"object","properties":{"secret_key":{"type":"string","description":"TOTP secret key"},"provisioning_uri":{"type":"string","description":"TOTP provisioning URI"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/setup/":{"post":{"summary":"Setup TOTP","description":"Setup TOTP authentication.","tags":["AuthTOTP"],"responses":{"201":{"description":"The TOTP setup was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPSetup"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Activate TOTP

> Activate TOTP authentication by verifying the TOTP code.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"TOTPActivate":{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"TOTP verification code"}}},"TOTPActivateResponse":{"type":"object","properties":{"recovery_codes":{"type":"array","description":"Recovery codes","items":{"type":"string"}}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/activate/":{"post":{"summary":"Activate TOTP","description":"Activate TOTP authentication by verifying the TOTP code.","tags":["AuthTOTP"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPActivate"}}}},"responses":{"200":{"description":"The TOTP activation was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPActivateResponse"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Deactivate TOTP

> Deactivate TOTP authentication for the current user.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/deactivate/":{"post":{"summary":"Deactivate TOTP","description":"Deactivate TOTP authentication for the current user.","tags":["AuthTOTP"],"responses":{"200":{"description":"The TOTP deactivation was successful."},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```
