Skip to main content
POST
/
api
/
product
/
inventory
/
add
Add Product
curl --request POST \
  --url https://api.example.com/api/product/inventory/add \
  --header 'Content-Type: application/json' \
  --data '
{
  "productName": "<string>",
  "category": "<string>",
  "barcode": "<string>"
}
'
{
  "message": "<string>",
  "productId": "<string>",
  "productName": "<string>",
  "category": "<string>"
}
This endpoint requires authentication. Include a valid Bearer token in the Authorization header.

Endpoint

POST /api/product/inventory/add
This endpoint adds a new product to the inventory database. The product information includes the product name and category.

Request Body

productName
string
required
The name of the product to add to the inventory
category
string
required
The category of the product (e.g., “Dairy”, “Vegetables”, “Beverages”)
barcode
string
Optional barcode identifier for the product

Authentication

This endpoint requires a valid JWT Bearer token. The token should be included in the Authorization header:
Authorization: Bearer <your_access_token>
The user ID is extracted from the JWT token to associate the product with the user.

Response

The response structure depends on the implementation of the add_product_to_inventory service function.
message
string
Status message indicating the result of the operation
productId
string
The unique identifier of the newly created product
productName
string
The name of the product that was added
category
string
The category of the product that was added

Example Request

curl -X POST https://api.expireeye.com/api/product/inventory/add \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -d '{
    "productName": "Organic Milk",
    "category": "Dairy",
    "barcode": "123456789012"
  }'

Example Response

{
  "message": "Product added successfully",
  "productId": "550e8400-e29b-41d4-a716-446655440000",
  "productName": "Organic Milk",
  "category": "Dairy"
}

Build docs developers (and LLMs) love