Skip to main content
POST
/
product
Create a product
curl --request POST \
  --url https://lightyshare.com/api/token-secured/product \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "product": {
    "title": "4K Pro Camera",
    "rent": 250,
    "description": "Professional camera with full frame sensor",
    "cost": 3500,
    "productType": 0,
    "stock_type": 0,
    "sku": "CAM-4K-001",
    "quantity": 2,
    "equipments": [
      {
        "name": "Battery",
        "quantity": 4
      }
    ],
    "images": [
      {
        "src": "https://cdn.example.com/camera-front.jpg"
      }
    ],
    "online": true,
    "archived": false
  }
}
'
{
  "success": true,
  "id": 14567,
  "location": "/api/token-secured/product/14567"
}

Request Structure

{
  "data": {
    "type": "products",
    "attributes": {
      "code": "SKU-001",
      "description": "Widget A - Standard Size",
      "stock_unit_type_id": 1,
      "barcode": "5012345678901",
      "commodity_code": "84719000",
      "country_of_manufacture": "GB",
      "shelf_life_min": 30,
      "shelf_life_max": 365
    }
  }
}

Key Fields

FieldRequiredDescription
codeNoUnique product SKU code
descriptionYesShort product description
stock_unit_type_idYesUnit of measure type ID
barcodeNoPrimary product barcode
commodity_codeNoHS code for customs
shelf_life_minNoMinimum shelf life in days
shelf_life_maxNoMaximum shelf life in days

Authorizations

Authorization
string
header
required

Use your API token in the Authorization header with Bearer scheme. Alternative: You can also pass the token as a query parameter ?token=your_token for backward compatibility.

Query Parameters

token
string
required

User authentication token

Example:

"YOUR_TOKEN"

Body

application/json
product
object
required

Response

Product successfully created

success
boolean
Example:

true

id
integer
Example:

14567

location
string
Example:

"/api/token-secured/product/14567"