Make Money From Coding

Products API

List Products

Get all your products.

Endpoint: GET /api/products

Response:

{
  "products": [
    {
      "id": 123,
      "title": "React Component Library",
      "slug": "react-component-library",
      "description": "50+ production-ready React components",
      "price": 4900,
      "currency": "usd",
      "isPublished": true,
      "createdAt": "2025-01-15T10:00:00Z"
    }
  ]
}

Create Product

Create a new product.

Endpoint: POST /api/products

Request Body:

{
  "title": "My New Product",
  "description": "Product description here",
  "price": 2900,
  "currency": "usd",
  "isPublished": false
}

Response:

{
  "product": {
    "id": 124,
    "title": "My New Product",
    "slug": "my-new-product",
    "price": 2900,
    "isPublished": false
  }
}

Get Product

Get a single product by ID.

Endpoint: GET /api/products/:id

Response:

{
  "product": {
    "id": 123,
    "title": "React Component Library",
    "slug": "react-component-library",
    "description": "50+ production-ready React components",
    "price": 4900,
    "currency": "usd",
    "isPublished": true,
    "files": [
      {
        "id": 1,
        "filename": "components.zip",
        "size": 1048576
      }
    ]
  }
}

Update Product

Update an existing product.

Endpoint: PATCH /api/products/:id

Request Body:

{
  "title": "Updated Title",
  "price": 5900,
  "isPublished": true
}

Delete Product

Delete a product (soft delete).

Endpoint: DELETE /api/products/:id

Response:

{
  "message": "Product deleted successfully"
}
Products API