{ "swagger": "2.0", "info": { "title": "AK Sharma Backend", "version": "1.0.0", "description": "API documentation" }, "host": "ak-backend-4wac.onrender.com", "basePath": "/api", "schemes": [ "https", "http" ], "paths": { "/register": { "post": { "summary": "Register a new user", "tags": [ "Auth" ], "parameters": [ { "in": "body", "name": "body", "required": true, "schema": { "type": "object", "properties": { "name": { "type": "string", "example": "John Doe" }, "email": { "type": "string", "format": "email", "example": "johndoe@example.com" }, "mobile": { "type": "string", "example": "+1234567890" }, "gender": { "type": "string", "enum": [ "male", "female", "other" ], "example": "male" }, "password": { "type": "string", "example": "securepassword" } }, "required": [ "name", "email", "mobile", "gender", "password" ] } } ], "responses": { "201": { "description": "User registered successfully", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User registered successfully" }, "data": { "type": "object", "properties": { "accessToken": { "type": "string", "example": "your_access_token" }, "user": { "type": "object", "properties": { "_id": { "type": "string", "example": "6708f46bfae27f07a9acb462" }, "name": { "type": "string", "example": "John Doe" }, "email": { "type": "string", "example": "johndoe@example.com" }, "mobile": { "type": "string", "example": "+91234567890" }, "gender": { "type": "string", "example": "male" }, "__v": { "type": "integer", "example": 0 } } } } } } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "Bad Request" }, "details": { "type": "string", "example": "Detailed error information can go here" } } } }, "500": { "description": "Internal server error" } } } }, "/login": { "post": { "summary": "Log in an existing user", "tags": [ "Auth" ], "parameters": [ { "in": "body", "name": "body", "required": true, "schema": { "type": "object", "properties": { "email": { "type": "string", "format": "email", "example": "johndoe@example.com" }, "password": { "type": "string", "example": "securepassword" } }, "required": [ "email", "password" ] } } ], "responses": { "200": { "description": "User logged in successfully", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User logged in successfully" }, "data": { "type": "object", "properties": { "accessToken": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDhmNDZiZmFlMjdmMDdhOWFjYjQ2MiIsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTcyODY0MTgwMywiZXhwIjoxNzI4NjQ1NDAzfQ.zyP_gRhlDuIZ0-MAF_mB1sx-vQG00g5i8fSZ--80gUc" }, "user": { "type": "object", "properties": { "_id": { "type": "string", "example": "6708f46bfae27f07a9acb462" }, "name": { "type": "string", "example": "John Doe" }, "email": { "type": "string", "example": "johndoe@example.com" }, "mobile": { "type": "string", "example": "+91234567890" }, "gender": { "type": "string", "example": "male" }, "__v": { "type": "integer", "example": 0 } } } } } } } }, "401": { "description": "Unauthorized - Invalid credentials" }, "400": { "description": "Bad Request", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "Bad Request" }, "details": { "type": "string", "example": "Detailed error information can go here" } } } }, "500": { "description": "Internal server error" } } } }, "/users/{id}": { "get": { "tags": [ "User" ], "summary": "Get user by ID", "description": "Retrieve a user by their user ID.", "operationId": "getByIdUser", "produces": [ "application/json" ], "parameters": [ { "name": "id", "in": "path", "description": "User ID to fetch", "required": true, "type": "string" } ], "responses": { "200": { "description": "User logged in successfully", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User logged in successfully" }, "data": { "type": "object", "properties": { "user": { "type": "object", "properties": { "_id": { "type": "string", "example": "6708f46bfae27f07a9acb462" }, "name": { "type": "string", "example": "John Doe" }, "email": { "type": "string", "example": "johndoe@example.com" }, "mobile": { "type": "string", "example": "+91234567890" }, "gender": { "type": "string", "example": "male" }, "__v": { "type": "integer", "example": 0 } } } } } } } }, "401": { "description": "Unauthorized - Invalid credentials" }, "400": { "description": "Bad Request", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "Bad Request" }, "details": { "type": "string", "example": "Detailed error information can go here" } } } }, "500": { "description": "Internal server error" } } } }, "/users": { "get": { "tags": [ "User" ], "summary": "Get all user", "description": "Retrieve a user ", "operationId": "getAllUser", "produces": [ "application/json" ], "responses": { "200": { "description": "Users found successfully", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User found successfully" }, "data": { "type": "array", "items": { "type": "object", "properties": { "_id": { "type": "string", "example": "67090b9e3f39c2d04f8108af" }, "name": { "type": "string", "example": "John Doe" }, "email": { "type": "string", "example": "johndoe@example.com" }, "mobile": { "type": "string", "example": "+1234567890" }, "gender": { "type": "string", "example": "male" }, "__v": { "type": "integer", "example": 0 } } } } } } }, "401": { "description": "Unauthorized access", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "Unauthorized access" } } } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "Internal Server Error" }, "details": { "type": "string", "example": "Error details go here" } } } } } } } }, "definitions": { "User": { "type": "object", "properties": { "id": { "type": "string", "example": "12345" }, "name": { "type": "string", "example": "John Doe" }, "email": { "type": "string", "example": "johndoe@example.com" }, "gander": { "type": "string", "example": "male" }, "mobile": { "type": "string", "example": "+9198346789" } } } } }