https://mercurio-api.vercel.app/api
Auth: Use header Authorization: Bearer <token> for protected routes.
POST/auth/signup
{ "email":"user@example.com","password":"123456" }
POST/auth/login
{ "email":"user@example.com","password":"123456" }
Response: { "access_token":"...", "user":{ "id":"..","email":".." }}
POST/auth/logout
{ "message":"Logged out" }
GET/auth/profile
{ "id":"..","email":"user@example.com","role":"student" }
PUT/auth/profile
{ "full_name":"New Name" } → { "id":"..","full_name":"New Name" }
POST/auth/forgot-password
{ "email":"user@example.com" }
PUT/auth/reset-password
{ "access_token":"..","new_password":"newPass123" }
GET/users/all?page=1
{ "page":1,"users":[{ "id":"..","email":".." }] }
GET/users/:id
{ "id":"..","email":"..","role":"student" }
DELETE/users/:id
{ "message":"User deleted successfully" }
GET/products/all?page=1
{ "page":1,"products":[{ "id":1,"name":"Product A" }] }
GET/products/:id
{ "id":68,"name":"Wireless Headphones","price":8.99 }
POST/products/create (Admin)
{ "name":"Phone","price":299,"stock":20,"category_id":21 }
PUT/products/:id (Admin)
{ "name":"Phone Updated","stock":15 }
DELETE/products/:id (Admin)
{ "message":"Product deleted successfully" }
GET/products/category/:category_id?page=1
{ "page":1,"products":[{ "id":1,"name":"Product A" }] }
GET/products/search/withQuery?query=phone&page=1
{ "page":1,"products":[{ "id":2,"name":"Smartphone" }] }
GET/categories/all
[{ "id":21,"name":"Garden" },{ "id":22,"name":"Computers" }]
GET/categories/:id
{ "id":22,"name":"Computers" }
POST/categories/create (Admin)
{ "name":"Phones","description":"Explore latest Phones..." }
PUT/categories/:id (Admin)
{ "name":"Phones Updated" }
DELETE/categories/:id (Admin)
{ "message":"Category deleted successfully" }
GET/cart/all (auth)
[
{
"id": 12,
"quantity": 2,
"product": {
"id": 68,
"name": "Wireless Headphones",
"price": 8.99
}
}
]
POST/cart/create (auth)
Request: { "product_id": 68, "quantity": 1 }
Response: { "id": 12, "user_id": "user123", "product_id": 68, "quantity": 1 }
PUT/cart/:itemId (auth)
Request: { "quantity": 3 }
Response: { "id": 12, "user_id": "user123", "product_id": 68, "quantity": 3 }
DELETE/cart/:itemId (auth)
{ "message": "Item removed from cart" }
GET/orders/all (auth)
[
{
"id": 3,
"created_at": "2025-09-22T17:26:21.965934+00:00",
"total": 179.48,
"status": "pending",
"profile_id": "cd2d7381-7123-44a8-b50c-61e0067403f6",
"order_items": [
{
"id": 1,
"price": 4999,
"product": {
"id": 70,
"name": "Awesome Rubber Shoes",
...
},
"order_id": 3,
...
},
{
"id": 2,
"price": 7950,
"product": {
"id": 71,
"name": "Awesome Cotton Tuna",
...
},
"order_id": 3,
...
}
]
},
{
"id": 2,
"created_at": "2025-09-22T17:25:31.94497+00:00",
"total": 179.48,
"status": "pending",
"profile_id": "cd2d7381-7123-44a8-b50c-61e0067403f6",
"order_items": []
}
]
POST/order/create (auth)
Request: {
"items": [
{ "product_id": 70, "quantity": 2, "price": 49.99 },
{ "product_id": 71, "quantity": 1, "price": 79.50 }
]
}
Response: {
"id": 3,
"created_at": "2025-09-22T17:26:21.965934+00:00",
"total": 179.48,
"status": "pending",
"profile_id": "cd2d7381-7123-44a8-b50c-61e0067403f6",
"items": [
{
"order_id": 3,
"product_id": 70,
"quantity": 2,
"price": 4999
},
{
"order_id": 3,
"product_id": 71,
"quantity": 1,
"price": 7950
}
]
}
GET/order/:id (auth)
Response: {
"id": 1,
"created_at": "2025-09-22T17:25:00.356489+00:00",
"total": 179.48,
"status": "pending",
"profile_id": "cd2d7381-7123-44a8-b50c-61e0067403f6",
"order_items": []
}
PUT/order/:id (admin)
Request: {
"status": "cancelled"
}
Response: {
"id": 1,
"created_at": "2025-09-22T17:25:00.356489+00:00",
"total": 179.48,
"status": "cancelled",
"profile_id": "cd2d7381-7123-44a8-b50c-61e0067403f6"
}
DELETE/cart/:itemId (auth || admin)
{
"message": "Order cancelled"
}
GET/wishlist/all (auth)
[
{
"id": 1,
"product": {
"id": 74,
"name": "Small Concrete Car",
"image": "https://loremflickr.com/2711/1009/product?lock=8788736141285686",
"price": 45.89,
"stock": 48,
"created_at": "2025-08-24T13:27:54.733+00:00",
"category_id": 26,
"description": "The Team-oriented mobile hub Towels offers reliable performance and worthless design"
}
},
{
"id": 2,
"product": {
"id": 75,
"name": "Sleek Ceramic Bacon",
"image": "https://loremflickr.com/606/2176/product?lock=7652425830551299",
"price": 288.09,
"stock": 10,
"created_at": "2025-08-24T13:27:55.237+00:00",
"category_id": 26,
"description": "The indigo Car combines Honduras aesthetics with Cobalt-based durability"
}
}
]
POST/wishlist/create (auth)
Request: {
"product_id":"76"
}
Response: {
"id": 3,
"product": {
"id": 76,
"name": "Intelligent Steel Fish",
"image": "https://loremflickr.com/756/2109/product?lock=3638821534937501",
"price": 47.25,
"stock": 96,
"created_at": "2025-08-24T13:27:56.477+00:00",
"category_id": 24,
"description": "Discover the proud new Pizza with an exciting mix of Concrete ingredients"
}
}
DELETE/wishlist/:itemId (auth)
Response: {
"message": "Item removed from wishlist"
}
GET/reviews/:id
[
{
"id": 1,
"comment": "That's great!!",
"rating": 5,
"profile_id": "b046557c-3d34-4d5d-8999-f09c0a0dfc53",
"created_at": "2025-10-06T18:09:45.400459+00:00",
"profile": {
"image": "https://randomuser.me/api/portraits/men/25.jpg",
"full_name": "Clara Nienow"
}
}
]
POST/reviews/add (auth)
Request: {
"product_id":68,
"rating":4,
"comment":"bad"
}
Response: {
"id": 1,
"comment": "bad",
"rating": 4,
"created_at": "2025-10-06T18:09:45.400459+00:00",
}
PUT/reviews/:id (auth)
Request: {
"rating":8,
"comment":"great"
}
Response: {
"id": 1,
"comment": "great",
"rating": 8,
"created_at": "2025-10-06T18:09:45.400459+00:00",
}
DELETE/reviews/:id (auth, admin)
Response: {
"message": "Review deleted successfully"
}