--- title: auth full: true --- import { Root, API, APIInfo, APIExample, Responses, Response, ResponseTypes, ExampleResponse, TypeScriptResponse, Property, ObjectCollapsible, Requests, Request } from "fumadocs-ui/components/api"; ## auth-createAdmin ### Authorization "} required={true}> In: `header` ### Request Body Format: `"email"` Minimum length: `8` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.createAdmin" \ -d '{ "email": "user@example.com", "password": "stringst" }' ``` ```js fetch("http://localhost:3000/api/auth.createAdmin", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-createUser ### Authorization "} required={true}> In: `header` ### Request Body Minimum length: `8` Minimum length: `1` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.createUser" \ -d '{ "password": "stringst", "id": "string", "token": "string" }' ``` ```js fetch("http://localhost:3000/api/auth.createUser", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-login ### Authorization "} required={true}> In: `header` ### Request Body Format: `"email"` Minimum length: `8` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.login" \ -d '{ "email": "user@example.com", "password": "stringst" }' ``` ```js fetch("http://localhost:3000/api/auth.login", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-get ### Authorization "} required={true}> In: `header` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X GET "http://localhost:3000/api/auth.get" ``` ```js fetch("http://localhost:3000/api/auth.get", { method: "GET" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-logout ### Authorization "} required={true}> In: `header` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.logout" ``` ```js fetch("http://localhost:3000/api/auth.logout", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-update ### Authorization "} required={true}> In: `header` ### Request Body Value in: `"admin" | "user"` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.update" \ -d '{ "id": "string", "email": "string", "password": "string", "rol": "admin", "image": "string", "secret": "string", "token": "string", "is2FAEnabled": true, "createdAt": "string" }' ``` ```js fetch("http://localhost:3000/api/auth.update", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-generateToken ### Authorization "} required={true}> In: `header` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.generateToken" ``` ```js fetch("http://localhost:3000/api/auth.generateToken", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-one ### Authorization "} required={true}> In: `header` ### Query Parameters | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X GET "http://localhost:3000/api/auth.one?id=string" ``` ```js fetch("http://localhost:3000/api/auth.one?id=string", { method: "GET" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-updateByAdmin ### Authorization "} required={true}> In: `header` ### Request Body Minimum length: `1` Value in: `"admin" | "user"` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.updateByAdmin" \ -d '{ "id": "string", "email": "string", "password": "string", "rol": "admin", "image": "string", "secret": "string", "token": "string", "is2FAEnabled": true, "createdAt": "string" }' ``` ```js fetch("http://localhost:3000/api/auth.updateByAdmin", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-generate2FASecret ### Authorization "} required={true}> In: `header` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X GET "http://localhost:3000/api/auth.generate2FASecret" ``` ```js fetch("http://localhost:3000/api/auth.generate2FASecret", { method: "GET" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-verify2FASetup ### Authorization "} required={true}> In: `header` ### Request Body Minimum length: `6` Minimum length: `1` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.verify2FASetup" \ -d '{ "pin": "string", "secret": "string" }' ``` ```js fetch("http://localhost:3000/api/auth.verify2FASetup", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-verifyLogin2FA ### Authorization "} required={true}> In: `header` ### Request Body Minimum length: `6` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.verifyLogin2FA" \ -d '{ "pin": "string", "id": "string" }' ``` ```js fetch("http://localhost:3000/api/auth.verifyLogin2FA", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-disable2FA ### Authorization "} required={true}> In: `header` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.disable2FA" ``` ```js fetch("http://localhost:3000/api/auth.disable2FA", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ``` ## auth-verifyToken ### Authorization "} required={true}> In: `header` | Status code | Description | | ----------- | ----------- | | `200` | Successful response | | `default` | Error response | ```bash curl -X POST "http://localhost:3000/api/auth.verifyToken" ``` ```js fetch("http://localhost:3000/api/auth.verifyToken", { method: "POST" }); ``` ```json { "message": "string", "code": "string", "issues": [ { "message": "string" } ] } ``` ```ts export interface Response { message: string; code: string; issues?: { message: string; }[]; } ```