Products - Create API

Create a new Product.

Method POST

Body

{
    "name": "Sample Product",
    "description": "This is a sample product description.",
    "price": 100,
    "category_id": 1
}

How to Use

fetch('https://simplecrudapi.com/api/products', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Canon EOS 5D Mark IV',
    description: 'The Canon EOS 5D Mark IV is a professional DSLR camera that combines outstanding image quality, advanced features, and exceptional performance. It’s designed for professional photographers who need high resolution and advanced video features.',
    price: 2499.99,
    category_id: 2,
    quantity: 35,
    is_available: true
  })
})
	.then(response => response.json())
	.then(data => console.log(data))
	.catch(error => console.error(error));

Response

{
    "data": {
        "id": 1,
        "name": "Canon EOS 5D Mark IV",
        "description": "The Canon EOS 5D Mark IV is a professional DSLR camera that combines outstanding image quality, advanced features, and exceptional performance. It\u2019s designed for professional photographers who need high resolution and advanced video features.",
        "price": 2499.99,
        "quantity": 35,
        "is_available": true,
        "category": {
            "id": 2,
            "name": "Cameras",
            "description": "Photography and video equipment for capturing high-quality images and videos.",
            "created_at": "2024-11-09T19:53:48+00:00",
            "updated_at": "2024-11-09T19:53:48+00:00"
        },
        "created_at": "2024-11-09T20:12:15.000000Z",
        "updated_at": "2024-11-09T20:12:15.000000Z"
    }
}

Try Now

fetch('https://simplecrudapi.com/api/products', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Canon EOS 5D Mark IV',
    description: 'The Canon EOS 5D Mark IV is a professional DSLR camera that combines outstanding image quality, advanced features, and exceptional performance. It’s designed for professional photographers who need high resolution and advanced video features.',
    price: 2499.99,
    category_id: 2,
    quantity: 35,
    is_available: true
  })
})
	.then(response => response.json())
	.then(data => console.log(data))
	.catch(error => console.error(error));

Test with Open API

View Open API

Previous
Tags API

Our Proudly Sponsors 🎉

© 2025 Simple CRUD API. All rights reserved.