# Cognifeed: Level You Up ## API Documentation --- - [x]Completed ### Signup ##### Request - POST - /users/signup ##### Request Body ```json= { "email": "saileshbro@gmail.com", "name": "Sailesh Dahal", "password": "saileshdahal1!" } ``` ##### Response - ###### Invalid Email `406 Not acceptable` ```json= { "error": "Invalid email provided" } ``` - ###### Invalid Password `406 Not acceptable` ```json= { "error": "Required: Minimum eight characters, at least one letter, one number and one special character." } ``` - ###### Invalid Name `406 Not acceptable` ```json= { "error": "Invalid name provided" } ``` - ###### User already registered `409 Conflict` ```json= { "error": "Email already registered" } ``` - ###### Successful registration `200 OK` ```json= { "user_id": 3, "name": "Sarayu Gautam", "email": "sarayugautam@gmail.com", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjozLCJpYXQiOjE1NzUyMTI3OTR9.-JTwfbVCl-9pd72P15guasZZuZBXU2hmoYNkXQC6HEc" } ``` --- - [x]Completed ### Login ##### Request - POST - /users/login ##### Request Body ```json= { "email": "saileshbro@gmail.com", "password": "saileshdahal1!" } ``` ##### Response - ###### Invalid Email or password `401 Unauthorized` ```json= { "error": "Invalid email or password" } ``` - ###### Successful login`200 OK` ```json= { "user_id": 1, "email": "saileshbro@gmail.com", "name": "Sailesh Dahal", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJpYXQiOjE1NzUyMTM3MjR9.-fef4wzalnRvHZNZn_LQZJfJNBWy3Az_2EAWufQIsic" } ``` ---