Create Product
Create a new product in your easycart store.
Request
POST /products
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
status | string | Yes | Product status ("draft" or "published") |
name | string | Yes | Product name (max 255 characters) |
description | string | No | Product description (max 10,000 characters) |
image_url | string | No | URL to the product image (max 255 characters) |
currency | string | Yes | ISO currency code (3 characters, e.g., "usd", "eur") |
Example Request
curl -X POST "https://cart.easy.tools/api/v1/products" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "published",
"name": "Premium Coffee Beans",
"description": "High-quality arabica coffee beans from Colombia",
"image_url": "https://example.com/images/coffee-beans.jpg",
"currency": "usd"
}'
Response
Success Response (201)
Returns the created product with its empty variants array.
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "published",
"name": "Premium Coffee Beans",
"description": "High-quality arabica coffee beans from Colombia",
"image_url": "https://example.com/images/coffee-beans.jpg",
"checkout_url": "https://cart.easy.tools/checkout/550e8400-e29b-41d4-a716-446655440000",
"currency": "usd",
"variants": []
}
Response Fields
Field | Type | Nullable | Description |
---|---|---|---|
id | string | No | Unique identifier for the product (UUID) |
status | string | No | Product status (e.g., "published" or "draft") |
name | string | No | Product name |
description | string | Yes | Product description |
image_url | string | Yes | URL to the product image |
checkout_url | string | No | Direct checkout URL for the product |
currency | string | No | ISO currency code (e.g., "usd", "eur") |
variants | array | No | List of product variants (empty for new products) |
Error Responses
Validation Error (422)
{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
],
"status": [
"The status field must be one of: draft, published."
],
"currency": [
"The currency field must be exactly 3 characters."
]
}
}