Skip to main content
PUT
/
v1
/
product
Update an Item
curl --request PUT \
  --url https://app.getswipe.in/api/partner/v1/product \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "ITEM123",
  "name": "Item Name",
  "quantity": 1,
  "unit_price": 100,
  "price_with_tax": 118,
  "item_type": "Product",
  "tax_rate": 18,
  "discount_percent": 10,
  "description": "Item Description",
  "hsn_code": "1234",
  "unit": "kg",
  "category": "Electronics",
  "status": "Active"
}
'
import requests

url = "https://app.getswipe.in/api/partner/v1/product"

payload = {
"id": "ITEM123",
"name": "Item Name",
"quantity": 1,
"unit_price": 100,
"price_with_tax": 118,
"item_type": "Product",
"tax_rate": 18,
"discount_percent": 10,
"description": "Item Description",
"hsn_code": "1234",
"unit": "kg",
"category": "Electronics",
"status": "Active"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'ITEM123',
name: 'Item Name',
quantity: 1,
unit_price: 100,
price_with_tax: 118,
item_type: 'Product',
tax_rate: 18,
discount_percent: 10,
description: 'Item Description',
hsn_code: '1234',
unit: 'kg',
category: 'Electronics',
status: 'Active'
})
};

fetch('https://app.getswipe.in/api/partner/v1/product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.getswipe.in/api/partner/v1/product",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'ITEM123',
'name' => 'Item Name',
'quantity' => 1,
'unit_price' => 100,
'price_with_tax' => 118,
'item_type' => 'Product',
'tax_rate' => 18,
'discount_percent' => 10,
'description' => 'Item Description',
'hsn_code' => '1234',
'unit' => 'kg',
'category' => 'Electronics',
'status' => 'Active'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://app.getswipe.in/api/partner/v1/product"

payload := strings.NewReader("{\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"status\": \"Active\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://app.getswipe.in/api/partner/v1/product")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"status\": \"Active\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.getswipe.in/api/partner/v1/product")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"status\": \"Active\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "Product added successfully"
}
{
"success": false,
"error_code": "INVALID_PRODUCT_ID",
"message": "Error Message",
"errors": "List of errors"
}
{
"success": false,
"error_code": "INVALID_PRODUCT_ID",
"message": "Error Message",
"errors": "List of errors"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer , where is your auth token.

Body

application/json
id
string
required

Unique id for each item.

Example:

"ITEM123"

name
string
required

Name of the Product

Example:

"Item Name"

quantity
number
required

Opening Quantity

Example:

1

unit_price
number
required

Price per item without Tax

Example:

100

price_with_tax
number
required

Price per item with Tax

Example:

118

item_type
enum<string>
required

Product or Service enum

Available options:
Product,
Service
Example:

"Product"

tax_rate
number

Tax percentage for each item . Only valid tax rates are accepted

Example:

18

discount_percent
number

Default Discount Percent

Example:

10

description
string

Item Description

Example:

"Item Description"

hsn_code
string

HSN Code

Example:

"1234"

unit
string

Item quantity unit. You can find the GST-approved units in the UQC Codes section at: https://einvoice1.gst.gov.in/Others/MasterCodes.

Example:

"kg"

category
string

Category

Example:

"Electronics"

status
string

Status of the Item

Example:

"Active"

Response

Success

success
boolean

Success flag

Example:

true

message
string

Response message

Example:

"Product added successfully"