Skip to main content
POST
/
products
Create product
curl --request POST \
  --url http://localhost:3002/api/v1/products \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sku": "PROD-002",
  "name": "New Product",
  "price": 123,
  "description": "<string>",
  "category": "<string>",
  "cost": 123,
  "stock": 123
}
'
{
  "id": "prod_123",
  "sku": "PROD-001",
  "name": "Product Name",
  "price": 100000,
  "description": "<string>",
  "category": "electronics",
  "cost": 75000,
  "stock": 50,
  "status": "active",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

JWT Bearer token authentication

Body

application/json
sku
string
required
Example:

"PROD-002"

name
string
required
Example:

"New Product"

price
number<double>
required
description
string
category
string
cost
number<double>
stock
integer

Response

201 - application/json

Product created

id
string
required
Example:

"prod_123"

sku
string
required
Example:

"PROD-001"

name
string
required
Example:

"Product Name"

price
number<double>
required
Example:

100000

description
string
category
string
Example:

"electronics"

cost
number<double>
Example:

75000

stock
integer
Example:

50

status
enum<string>
Available options:
active,
inactive
Example:

"active"

created_at
string<date-time>
updated_at
string<date-time>