Skip to main content
GET
/
products
/
{id}
Get Product
curl --request GET \
  --url https://api.example.com/products/{id}
{
  "product": {
    "_id": "<string>",
    "brand": "<string>",
    "name": "<string>",
    "stock": 123,
    "price": 123,
    "normalizedName": "<string>"
  }
}
Retrieves a single product by its unique identifier.

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.

Path Parameters

id
string
required
The unique identifier of the product to retrieve

Response

product
object
The requested product object
_id
string
Unique identifier for the product
brand
string
The product brand
name
string
The product name
stock
number
The quantity in stock
price
number
The product price
normalizedName
string
Normalized version of the product name for search purposes

Status Codes

  • 200: Product successfully retrieved
  • 404: Product not found
  • 401: Authentication token missing or invalid
  • 500: Server error

Example Request

curl http://localhost:3000/products/507f1f77bcf86cd799439011 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "product": {
    "_id": "507f1f77bcf86cd799439011",
    "brand": "TechCorp",
    "name": "Wireless Mouse",
    "stock": 150,
    "price": 29.99,
    "normalizedName": "wireless mouse"
  }
}

Error Response (404)

{
  "mesage": "❌ No hay producto que mostrar..."
}

Error Response (500)

{
  "message": "❌ Error en el servidor..."
}

Build docs developers (and LLMs) love