Skip to main content
POST
/
products
curl -X POST https://api.kiototeteria.com/products \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Oolong Tea",
    "slug": "oolong-tea",
    "description": "Traditional oolong tea with smooth flavor",
    "price": 11.99,
    "categoryId": 1
  }'
{
  "id": 3,
  "name": "Oolong Tea",
  "slug": "oolong-tea",
  "description": "Traditional oolong tea with smooth flavor",
  "price": "11.99",
  "isActive": false,
  "categoryId": 1,
  "createdAt": "2024-01-16T14:30:00Z",
  "updatedAt": "2024-01-16T14:30:00Z"
}

Authentication

This endpoint requires authentication with a JWT token and ADMIN role.
Authorization: Bearer <token>

Body Parameters

name
string
required
Product name (cannot be empty)
slug
string
required
URL-friendly unique identifier (cannot be empty, must be unique)
description
string
required
Product description (cannot be empty)
price
number
required
Product price (must be >= 0, maximum 2 decimal places)
categoryId
number
required
ID of the category (must be >= 1)

Response

id
number
Unique identifier for the created product
name
string
Product name
slug
string
URL-friendly unique identifier
description
string
Product description
price
decimal
Product price
isActive
boolean
Product active status (defaults to false for new products)
categoryId
number
ID of the category this product belongs to
createdAt
datetime
Timestamp when the product was created
updatedAt
datetime
Timestamp when the product was last updated
curl -X POST https://api.kiototeteria.com/products \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Oolong Tea",
    "slug": "oolong-tea",
    "description": "Traditional oolong tea with smooth flavor",
    "price": 11.99,
    "categoryId": 1
  }'
{
  "id": 3,
  "name": "Oolong Tea",
  "slug": "oolong-tea",
  "description": "Traditional oolong tea with smooth flavor",
  "price": "11.99",
  "isActive": false,
  "categoryId": 1,
  "createdAt": "2024-01-16T14:30:00Z",
  "updatedAt": "2024-01-16T14:30:00Z"
}

Build docs developers (and LLMs) love