Edit Product

This endpoint enables you to edit details of an existing product.

Endpoint

PUT https://api.keepup.store/v2.0/products/edit/{product_id}

Headers

Authorization: Bearer API_KEY

Body Parameters

product_name

string

yes

Name of the product. Example: "Widget A"

description

string

optional

Detailed description of the product. Uses sanitized content.

cost_price

float

optional

Cost price of the product. Must be a valid monetary amount. Example: 15.75

selling_price

float

yes

Selling price of the product. Must be a valid monetary amount. Example: 20.00

previous_price

float

optional

Previous selling price, if any. Must be a valid monetary amount. Example: 18.00

quantity

integer

conditional

Available quantity of the product. Required if stock_limit is 'limited'. Example: 50

restock_level

integer

optional

Level at which the product should be restocked. Example: 10

show_on_storefront

string

optional

Whether to show the product on the storefront. Accepts 'yes' or 'no'. Default is 'no'.

featured_product

string

optional

Whether the product is featured. Accepts 'yes' or 'no'. Default is 'no'.

category

string

optional

Category of the product. Example: "Electronics"

tags

JSON

optional

Tags associated with the product, in JSON format. Example: ["Electronics", "Gadget"]

variants

JSON

optional

Variants of the product, in JSON format. Example: [{"color": "red", "size": "M"}]

SKU

string

optional

Stock Keeping Unit, unique identifier for each product variant. Example: "SKU12345"

barcode

string

optional

Barcode of the product. Example: "0123456789012"

product_location

string

optional

Storage location of the product within the business. Example: "Aisle 3, Shelf 5"

expirations

JSON

optional

List of expiration details in JSON format. Includes batch numbers and dates.

removed_images

array

optional

primary_product_image_index

array

optional

Sample Requests

const axios = require('axios');

const productData = {
  product_name: 'Product A',
  description: 'High-quality gadget',
  cost_price: 15.75,
  selling_price: 20.00,
  quantity: 50,
  restock_level: 10,
  show_on_storefront: 'yes',
  featured_product: 'no',
  category: 'Electronics',
  tags: ["Electronics", "Gadget"],
  variants: [{ color: "red", size: "M" }],
  SKU: 'SKU12345',
  barcode: '0123456789012',
  product_location: 'Aisle 3, Shelf 5',
  expirations: [{
    batch_number: "batch123",
    expiration_date: "2024-12-31",
    alert_date: "2024-12-01"
  }],
  removed_images: [],
  primary_product_image_index: 0
};

const config = {
  method: 'post',
  url: 'https://api.keepup.store/v2.0/products/edit/{product_id}',
  headers: {
    'Authorization': 'Bearer API_KEY',  // Replace YOUR_ACCESS_TOKEN with your actual access token
    'Content-Type': 'application/json'
  },
  data: JSON.stringify(productData)
};

axios(config)
.then(function (response) {
  console.log('Product updated successfully:', response.data);
})
.catch(function (error) {
  console.error('Failed to updated product:', error);
});

Sample Response

{
    "status": 200,
    "message": "product updated",
    "data": {
        "product_id": 19845
    }
}

Last updated