curl --request PUT \
--url https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_type": "invoice",
"document_date": "11-06-2024",
"items": [
{
"id": "ITEM123",
"name": "Item Name",
"quantity": 1,
"unit_price": 100,
"price_with_tax": 118,
"net_amount": 100,
"total_amount": 118,
"item_type": "Product",
"tax_rate": 18,
"discount_percent": 10,
"discount_amount": 10,
"description": "Item Description",
"hsn_code": "1234",
"unit": "kg",
"category": "Electronics",
"custom_columns": [
{
"label": "Custom Field 1",
"value": "Value 1"
}
]
}
],
"serial_number": "INV123",
"serial_number_v2": {
"prefix": "INV",
"doc_number": 1,
"suffix": "2024"
},
"due_date": "11-06-2024",
"reference": "Reference Text",
"notes": "Notes for the document",
"terms": "Terms and Conditions",
"extra_discount": 20,
"round_off": true,
"tds_id": 123,
"tcs_id": 123,
"charges_and_deductions": [
{
"id": 1,
"name": "Delivery Charge",
"amount": 100,
"tax_rate": 18,
"type": "charge",
"sac_code": "1234"
}
],
"is_export": false,
"is_multi_currency": false,
"is_subscription": false,
"subscription_details": {
"start_time": "1919-08-17T00:00:00.000Z",
"end_time": "1919-08-18T00:00:00.000Z",
"repeat": 1,
"repeat_type": "days",
"send_email": true,
"send_sms": true,
"send_wtsp": true
},
"custom_headers": [
{
"label": "Custom Header 1",
"value": "Value 1"
}
]
}
'import requests
url = "https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id}"
payload = {
"document_type": "invoice",
"document_date": "11-06-2024",
"items": [
{
"id": "ITEM123",
"name": "Item Name",
"quantity": 1,
"unit_price": 100,
"price_with_tax": 118,
"net_amount": 100,
"total_amount": 118,
"item_type": "Product",
"tax_rate": 18,
"discount_percent": 10,
"discount_amount": 10,
"description": "Item Description",
"hsn_code": "1234",
"unit": "kg",
"category": "Electronics",
"custom_columns": [
{
"label": "Custom Field 1",
"value": "Value 1"
}
]
}
],
"serial_number": "INV123",
"serial_number_v2": {
"prefix": "INV",
"doc_number": 1,
"suffix": "2024"
},
"due_date": "11-06-2024",
"reference": "Reference Text",
"notes": "Notes for the document",
"terms": "Terms and Conditions",
"extra_discount": 20,
"round_off": True,
"tds_id": 123,
"tcs_id": 123,
"charges_and_deductions": [
{
"id": 1,
"name": "Delivery Charge",
"amount": 100,
"tax_rate": 18,
"type": "charge",
"sac_code": "1234"
}
],
"is_export": False,
"is_multi_currency": False,
"is_subscription": False,
"subscription_details": {
"start_time": "1919-08-17T00:00:00.000Z",
"end_time": "1919-08-18T00:00:00.000Z",
"repeat": 1,
"repeat_type": "days",
"send_email": True,
"send_sms": True,
"send_wtsp": True
},
"custom_headers": [
{
"label": "Custom Header 1",
"value": "Value 1"
}
]
}
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({
document_type: 'invoice',
document_date: '11-06-2024',
items: [
{
id: 'ITEM123',
name: 'Item Name',
quantity: 1,
unit_price: 100,
price_with_tax: 118,
net_amount: 100,
total_amount: 118,
item_type: 'Product',
tax_rate: 18,
discount_percent: 10,
discount_amount: 10,
description: 'Item Description',
hsn_code: '1234',
unit: 'kg',
category: 'Electronics',
custom_columns: [{label: 'Custom Field 1', value: 'Value 1'}]
}
],
serial_number: 'INV123',
serial_number_v2: {prefix: 'INV', doc_number: 1, suffix: '2024'},
due_date: '11-06-2024',
reference: 'Reference Text',
notes: 'Notes for the document',
terms: 'Terms and Conditions',
extra_discount: 20,
round_off: true,
tds_id: 123,
tcs_id: 123,
charges_and_deductions: [
{
id: 1,
name: 'Delivery Charge',
amount: 100,
tax_rate: 18,
type: 'charge',
sac_code: '1234'
}
],
is_export: false,
is_multi_currency: false,
is_subscription: false,
subscription_details: {
start_time: '1919-08-17T00:00:00.000Z',
end_time: '1919-08-18T00:00:00.000Z',
repeat: 1,
repeat_type: 'days',
send_email: true,
send_sms: true,
send_wtsp: true
},
custom_headers: [{label: 'Custom Header 1', value: 'Value 1'}]
})
};
fetch('https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id}', 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/v2/doc/{doc_hash_id}",
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([
'document_type' => 'invoice',
'document_date' => '11-06-2024',
'items' => [
[
'id' => 'ITEM123',
'name' => 'Item Name',
'quantity' => 1,
'unit_price' => 100,
'price_with_tax' => 118,
'net_amount' => 100,
'total_amount' => 118,
'item_type' => 'Product',
'tax_rate' => 18,
'discount_percent' => 10,
'discount_amount' => 10,
'description' => 'Item Description',
'hsn_code' => '1234',
'unit' => 'kg',
'category' => 'Electronics',
'custom_columns' => [
[
'label' => 'Custom Field 1',
'value' => 'Value 1'
]
]
]
],
'serial_number' => 'INV123',
'serial_number_v2' => [
'prefix' => 'INV',
'doc_number' => 1,
'suffix' => '2024'
],
'due_date' => '11-06-2024',
'reference' => 'Reference Text',
'notes' => 'Notes for the document',
'terms' => 'Terms and Conditions',
'extra_discount' => 20,
'round_off' => true,
'tds_id' => 123,
'tcs_id' => 123,
'charges_and_deductions' => [
[
'id' => 1,
'name' => 'Delivery Charge',
'amount' => 100,
'tax_rate' => 18,
'type' => 'charge',
'sac_code' => '1234'
]
],
'is_export' => false,
'is_multi_currency' => false,
'is_subscription' => false,
'subscription_details' => [
'start_time' => '1919-08-17T00:00:00.000Z',
'end_time' => '1919-08-18T00:00:00.000Z',
'repeat' => 1,
'repeat_type' => 'days',
'send_email' => true,
'send_sms' => true,
'send_wtsp' => true
],
'custom_headers' => [
[
'label' => 'Custom Header 1',
'value' => 'Value 1'
]
]
]),
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/v2/doc/{doc_hash_id}"
payload := strings.NewReader("{\n \"document_type\": \"invoice\",\n \"document_date\": \"11-06-2024\",\n \"items\": [\n {\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"net_amount\": 100,\n \"total_amount\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"discount_amount\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"custom_columns\": [\n {\n \"label\": \"Custom Field 1\",\n \"value\": \"Value 1\"\n }\n ]\n }\n ],\n \"serial_number\": \"INV123\",\n \"serial_number_v2\": {\n \"prefix\": \"INV\",\n \"doc_number\": 1,\n \"suffix\": \"2024\"\n },\n \"due_date\": \"11-06-2024\",\n \"reference\": \"Reference Text\",\n \"notes\": \"Notes for the document\",\n \"terms\": \"Terms and Conditions\",\n \"extra_discount\": 20,\n \"round_off\": true,\n \"tds_id\": 123,\n \"tcs_id\": 123,\n \"charges_and_deductions\": [\n {\n \"id\": 1,\n \"name\": \"Delivery Charge\",\n \"amount\": 100,\n \"tax_rate\": 18,\n \"type\": \"charge\",\n \"sac_code\": \"1234\"\n }\n ],\n \"is_export\": false,\n \"is_multi_currency\": false,\n \"is_subscription\": false,\n \"subscription_details\": {\n \"start_time\": \"1919-08-17T00:00:00.000Z\",\n \"end_time\": \"1919-08-18T00:00:00.000Z\",\n \"repeat\": 1,\n \"repeat_type\": \"days\",\n \"send_email\": true,\n \"send_sms\": true,\n \"send_wtsp\": true\n },\n \"custom_headers\": [\n {\n \"label\": \"Custom Header 1\",\n \"value\": \"Value 1\"\n }\n ]\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/v2/doc/{doc_hash_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document_type\": \"invoice\",\n \"document_date\": \"11-06-2024\",\n \"items\": [\n {\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"net_amount\": 100,\n \"total_amount\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"discount_amount\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"custom_columns\": [\n {\n \"label\": \"Custom Field 1\",\n \"value\": \"Value 1\"\n }\n ]\n }\n ],\n \"serial_number\": \"INV123\",\n \"serial_number_v2\": {\n \"prefix\": \"INV\",\n \"doc_number\": 1,\n \"suffix\": \"2024\"\n },\n \"due_date\": \"11-06-2024\",\n \"reference\": \"Reference Text\",\n \"notes\": \"Notes for the document\",\n \"terms\": \"Terms and Conditions\",\n \"extra_discount\": 20,\n \"round_off\": true,\n \"tds_id\": 123,\n \"tcs_id\": 123,\n \"charges_and_deductions\": [\n {\n \"id\": 1,\n \"name\": \"Delivery Charge\",\n \"amount\": 100,\n \"tax_rate\": 18,\n \"type\": \"charge\",\n \"sac_code\": \"1234\"\n }\n ],\n \"is_export\": false,\n \"is_multi_currency\": false,\n \"is_subscription\": false,\n \"subscription_details\": {\n \"start_time\": \"1919-08-17T00:00:00.000Z\",\n \"end_time\": \"1919-08-18T00:00:00.000Z\",\n \"repeat\": 1,\n \"repeat_type\": \"days\",\n \"send_email\": true,\n \"send_sms\": true,\n \"send_wtsp\": true\n },\n \"custom_headers\": [\n {\n \"label\": \"Custom Header 1\",\n \"value\": \"Value 1\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id}")
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 \"document_type\": \"invoice\",\n \"document_date\": \"11-06-2024\",\n \"items\": [\n {\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"net_amount\": 100,\n \"total_amount\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"discount_amount\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"custom_columns\": [\n {\n \"label\": \"Custom Field 1\",\n \"value\": \"Value 1\"\n }\n ]\n }\n ],\n \"serial_number\": \"INV123\",\n \"serial_number_v2\": {\n \"prefix\": \"INV\",\n \"doc_number\": 1,\n \"suffix\": \"2024\"\n },\n \"due_date\": \"11-06-2024\",\n \"reference\": \"Reference Text\",\n \"notes\": \"Notes for the document\",\n \"terms\": \"Terms and Conditions\",\n \"extra_discount\": 20,\n \"round_off\": true,\n \"tds_id\": 123,\n \"tcs_id\": 123,\n \"charges_and_deductions\": [\n {\n \"id\": 1,\n \"name\": \"Delivery Charge\",\n \"amount\": 100,\n \"tax_rate\": 18,\n \"type\": \"charge\",\n \"sac_code\": \"1234\"\n }\n ],\n \"is_export\": false,\n \"is_multi_currency\": false,\n \"is_subscription\": false,\n \"subscription_details\": {\n \"start_time\": \"1919-08-17T00:00:00.000Z\",\n \"end_time\": \"1919-08-18T00:00:00.000Z\",\n \"repeat\": 1,\n \"repeat_type\": \"days\",\n \"send_email\": true,\n \"send_sms\": true,\n \"send_wtsp\": true\n },\n \"custom_headers\": [\n {\n \"label\": \"Custom Header 1\",\n \"value\": \"Value 1\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}Edit a document
curl --request PUT \
--url https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_type": "invoice",
"document_date": "11-06-2024",
"items": [
{
"id": "ITEM123",
"name": "Item Name",
"quantity": 1,
"unit_price": 100,
"price_with_tax": 118,
"net_amount": 100,
"total_amount": 118,
"item_type": "Product",
"tax_rate": 18,
"discount_percent": 10,
"discount_amount": 10,
"description": "Item Description",
"hsn_code": "1234",
"unit": "kg",
"category": "Electronics",
"custom_columns": [
{
"label": "Custom Field 1",
"value": "Value 1"
}
]
}
],
"serial_number": "INV123",
"serial_number_v2": {
"prefix": "INV",
"doc_number": 1,
"suffix": "2024"
},
"due_date": "11-06-2024",
"reference": "Reference Text",
"notes": "Notes for the document",
"terms": "Terms and Conditions",
"extra_discount": 20,
"round_off": true,
"tds_id": 123,
"tcs_id": 123,
"charges_and_deductions": [
{
"id": 1,
"name": "Delivery Charge",
"amount": 100,
"tax_rate": 18,
"type": "charge",
"sac_code": "1234"
}
],
"is_export": false,
"is_multi_currency": false,
"is_subscription": false,
"subscription_details": {
"start_time": "1919-08-17T00:00:00.000Z",
"end_time": "1919-08-18T00:00:00.000Z",
"repeat": 1,
"repeat_type": "days",
"send_email": true,
"send_sms": true,
"send_wtsp": true
},
"custom_headers": [
{
"label": "Custom Header 1",
"value": "Value 1"
}
]
}
'import requests
url = "https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id}"
payload = {
"document_type": "invoice",
"document_date": "11-06-2024",
"items": [
{
"id": "ITEM123",
"name": "Item Name",
"quantity": 1,
"unit_price": 100,
"price_with_tax": 118,
"net_amount": 100,
"total_amount": 118,
"item_type": "Product",
"tax_rate": 18,
"discount_percent": 10,
"discount_amount": 10,
"description": "Item Description",
"hsn_code": "1234",
"unit": "kg",
"category": "Electronics",
"custom_columns": [
{
"label": "Custom Field 1",
"value": "Value 1"
}
]
}
],
"serial_number": "INV123",
"serial_number_v2": {
"prefix": "INV",
"doc_number": 1,
"suffix": "2024"
},
"due_date": "11-06-2024",
"reference": "Reference Text",
"notes": "Notes for the document",
"terms": "Terms and Conditions",
"extra_discount": 20,
"round_off": True,
"tds_id": 123,
"tcs_id": 123,
"charges_and_deductions": [
{
"id": 1,
"name": "Delivery Charge",
"amount": 100,
"tax_rate": 18,
"type": "charge",
"sac_code": "1234"
}
],
"is_export": False,
"is_multi_currency": False,
"is_subscription": False,
"subscription_details": {
"start_time": "1919-08-17T00:00:00.000Z",
"end_time": "1919-08-18T00:00:00.000Z",
"repeat": 1,
"repeat_type": "days",
"send_email": True,
"send_sms": True,
"send_wtsp": True
},
"custom_headers": [
{
"label": "Custom Header 1",
"value": "Value 1"
}
]
}
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({
document_type: 'invoice',
document_date: '11-06-2024',
items: [
{
id: 'ITEM123',
name: 'Item Name',
quantity: 1,
unit_price: 100,
price_with_tax: 118,
net_amount: 100,
total_amount: 118,
item_type: 'Product',
tax_rate: 18,
discount_percent: 10,
discount_amount: 10,
description: 'Item Description',
hsn_code: '1234',
unit: 'kg',
category: 'Electronics',
custom_columns: [{label: 'Custom Field 1', value: 'Value 1'}]
}
],
serial_number: 'INV123',
serial_number_v2: {prefix: 'INV', doc_number: 1, suffix: '2024'},
due_date: '11-06-2024',
reference: 'Reference Text',
notes: 'Notes for the document',
terms: 'Terms and Conditions',
extra_discount: 20,
round_off: true,
tds_id: 123,
tcs_id: 123,
charges_and_deductions: [
{
id: 1,
name: 'Delivery Charge',
amount: 100,
tax_rate: 18,
type: 'charge',
sac_code: '1234'
}
],
is_export: false,
is_multi_currency: false,
is_subscription: false,
subscription_details: {
start_time: '1919-08-17T00:00:00.000Z',
end_time: '1919-08-18T00:00:00.000Z',
repeat: 1,
repeat_type: 'days',
send_email: true,
send_sms: true,
send_wtsp: true
},
custom_headers: [{label: 'Custom Header 1', value: 'Value 1'}]
})
};
fetch('https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id}', 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/v2/doc/{doc_hash_id}",
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([
'document_type' => 'invoice',
'document_date' => '11-06-2024',
'items' => [
[
'id' => 'ITEM123',
'name' => 'Item Name',
'quantity' => 1,
'unit_price' => 100,
'price_with_tax' => 118,
'net_amount' => 100,
'total_amount' => 118,
'item_type' => 'Product',
'tax_rate' => 18,
'discount_percent' => 10,
'discount_amount' => 10,
'description' => 'Item Description',
'hsn_code' => '1234',
'unit' => 'kg',
'category' => 'Electronics',
'custom_columns' => [
[
'label' => 'Custom Field 1',
'value' => 'Value 1'
]
]
]
],
'serial_number' => 'INV123',
'serial_number_v2' => [
'prefix' => 'INV',
'doc_number' => 1,
'suffix' => '2024'
],
'due_date' => '11-06-2024',
'reference' => 'Reference Text',
'notes' => 'Notes for the document',
'terms' => 'Terms and Conditions',
'extra_discount' => 20,
'round_off' => true,
'tds_id' => 123,
'tcs_id' => 123,
'charges_and_deductions' => [
[
'id' => 1,
'name' => 'Delivery Charge',
'amount' => 100,
'tax_rate' => 18,
'type' => 'charge',
'sac_code' => '1234'
]
],
'is_export' => false,
'is_multi_currency' => false,
'is_subscription' => false,
'subscription_details' => [
'start_time' => '1919-08-17T00:00:00.000Z',
'end_time' => '1919-08-18T00:00:00.000Z',
'repeat' => 1,
'repeat_type' => 'days',
'send_email' => true,
'send_sms' => true,
'send_wtsp' => true
],
'custom_headers' => [
[
'label' => 'Custom Header 1',
'value' => 'Value 1'
]
]
]),
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/v2/doc/{doc_hash_id}"
payload := strings.NewReader("{\n \"document_type\": \"invoice\",\n \"document_date\": \"11-06-2024\",\n \"items\": [\n {\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"net_amount\": 100,\n \"total_amount\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"discount_amount\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"custom_columns\": [\n {\n \"label\": \"Custom Field 1\",\n \"value\": \"Value 1\"\n }\n ]\n }\n ],\n \"serial_number\": \"INV123\",\n \"serial_number_v2\": {\n \"prefix\": \"INV\",\n \"doc_number\": 1,\n \"suffix\": \"2024\"\n },\n \"due_date\": \"11-06-2024\",\n \"reference\": \"Reference Text\",\n \"notes\": \"Notes for the document\",\n \"terms\": \"Terms and Conditions\",\n \"extra_discount\": 20,\n \"round_off\": true,\n \"tds_id\": 123,\n \"tcs_id\": 123,\n \"charges_and_deductions\": [\n {\n \"id\": 1,\n \"name\": \"Delivery Charge\",\n \"amount\": 100,\n \"tax_rate\": 18,\n \"type\": \"charge\",\n \"sac_code\": \"1234\"\n }\n ],\n \"is_export\": false,\n \"is_multi_currency\": false,\n \"is_subscription\": false,\n \"subscription_details\": {\n \"start_time\": \"1919-08-17T00:00:00.000Z\",\n \"end_time\": \"1919-08-18T00:00:00.000Z\",\n \"repeat\": 1,\n \"repeat_type\": \"days\",\n \"send_email\": true,\n \"send_sms\": true,\n \"send_wtsp\": true\n },\n \"custom_headers\": [\n {\n \"label\": \"Custom Header 1\",\n \"value\": \"Value 1\"\n }\n ]\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/v2/doc/{doc_hash_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document_type\": \"invoice\",\n \"document_date\": \"11-06-2024\",\n \"items\": [\n {\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"net_amount\": 100,\n \"total_amount\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"discount_amount\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"custom_columns\": [\n {\n \"label\": \"Custom Field 1\",\n \"value\": \"Value 1\"\n }\n ]\n }\n ],\n \"serial_number\": \"INV123\",\n \"serial_number_v2\": {\n \"prefix\": \"INV\",\n \"doc_number\": 1,\n \"suffix\": \"2024\"\n },\n \"due_date\": \"11-06-2024\",\n \"reference\": \"Reference Text\",\n \"notes\": \"Notes for the document\",\n \"terms\": \"Terms and Conditions\",\n \"extra_discount\": 20,\n \"round_off\": true,\n \"tds_id\": 123,\n \"tcs_id\": 123,\n \"charges_and_deductions\": [\n {\n \"id\": 1,\n \"name\": \"Delivery Charge\",\n \"amount\": 100,\n \"tax_rate\": 18,\n \"type\": \"charge\",\n \"sac_code\": \"1234\"\n }\n ],\n \"is_export\": false,\n \"is_multi_currency\": false,\n \"is_subscription\": false,\n \"subscription_details\": {\n \"start_time\": \"1919-08-17T00:00:00.000Z\",\n \"end_time\": \"1919-08-18T00:00:00.000Z\",\n \"repeat\": 1,\n \"repeat_type\": \"days\",\n \"send_email\": true,\n \"send_sms\": true,\n \"send_wtsp\": true\n },\n \"custom_headers\": [\n {\n \"label\": \"Custom Header 1\",\n \"value\": \"Value 1\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getswipe.in/api/partner/v2/doc/{doc_hash_id}")
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 \"document_type\": \"invoice\",\n \"document_date\": \"11-06-2024\",\n \"items\": [\n {\n \"id\": \"ITEM123\",\n \"name\": \"Item Name\",\n \"quantity\": 1,\n \"unit_price\": 100,\n \"price_with_tax\": 118,\n \"net_amount\": 100,\n \"total_amount\": 118,\n \"item_type\": \"Product\",\n \"tax_rate\": 18,\n \"discount_percent\": 10,\n \"discount_amount\": 10,\n \"description\": \"Item Description\",\n \"hsn_code\": \"1234\",\n \"unit\": \"kg\",\n \"category\": \"Electronics\",\n \"custom_columns\": [\n {\n \"label\": \"Custom Field 1\",\n \"value\": \"Value 1\"\n }\n ]\n }\n ],\n \"serial_number\": \"INV123\",\n \"serial_number_v2\": {\n \"prefix\": \"INV\",\n \"doc_number\": 1,\n \"suffix\": \"2024\"\n },\n \"due_date\": \"11-06-2024\",\n \"reference\": \"Reference Text\",\n \"notes\": \"Notes for the document\",\n \"terms\": \"Terms and Conditions\",\n \"extra_discount\": 20,\n \"round_off\": true,\n \"tds_id\": 123,\n \"tcs_id\": 123,\n \"charges_and_deductions\": [\n {\n \"id\": 1,\n \"name\": \"Delivery Charge\",\n \"amount\": 100,\n \"tax_rate\": 18,\n \"type\": \"charge\",\n \"sac_code\": \"1234\"\n }\n ],\n \"is_export\": false,\n \"is_multi_currency\": false,\n \"is_subscription\": false,\n \"subscription_details\": {\n \"start_time\": \"1919-08-17T00:00:00.000Z\",\n \"end_time\": \"1919-08-18T00:00:00.000Z\",\n \"repeat\": 1,\n \"repeat_type\": \"days\",\n \"send_email\": true,\n \"send_sms\": true,\n \"send_wtsp\": true\n },\n \"custom_headers\": [\n {\n \"label\": \"Custom Header 1\",\n \"value\": \"Value 1\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}{
"success": true,
"message": "Message",
"error_code": "",
"errors": {},
"data": {
"hash_id": "SL123",
"serial_number": "SL123",
"irn": "<string>",
"qr_code": "<string>"
}
}doc_hash_id in the request URL and send all the keys with their updated values in the request body, ensuring the document is updated correctly with the provided data.Authorizations
Bearer authentication header of the form Bearer , where is your auth token.
Path Parameters
The hash ID of the document that needs to be updated.
Body
Value should always be the string 'invoice'
invoice, subscription, pro_forma_invoice, estimate, sales_return, purchase_return, delivery_challan "invoice"
DD-MM-YYYY
"11-06-2024"
Array of Products/Services, refer Item Object below for parameters
Show child attributes
Show child attributes
Serial Number (deprecated, please use New Serial Number)
"INV123"
Show child attributes
Show child attributes
{
"prefix": "INV",
"doc_number": 1,
"suffix": "2024"
}Party. If there are any changes made to the party details, we will update those details and any documents linked to this party ID will be updated to reflect the changes.
Show child attributes
Show child attributes
DD-MM-YYYY
"11-06-2024"
Any references you want to add to the doc
"Reference Text"
Notes to show in invoice - please check template in swipe application to see where this is displayed
"Notes for the document"
Terms to show in invoice - please check template in swipe application to see where this is displayed
"Terms and Conditions"
Adjustment on overall invoice, doesn’t effect any tax amounts.
20
Should Round Off total amount
true
Bank Details, it is used to display bank details in document PDFs. No payments are associated with these bank details.
Show child attributes
Show child attributes
You can check the tds id and details mapping from https://developers.getswipe.in/api-reference/references#tds-tax-deducted-at-source
You can check the tcs id and details mapping from https://developers.getswipe.in/api-reference/references#tcs-tax-collected-at-source
Array of Charges and Deductions, refer Additional Charges Deductions Object for parameters
Show child attributes
Show child attributes
Company shipping from Address, refer Shipping Address Object for parameters
Show child attributes
Show child attributes
Company billing Address, refer Billing Address Object for parameters
Show child attributes
Show child attributes
Is Export
false
Is Multi Currency
false
Export Invoice Details
Show child attributes
Show child attributes
Is Subscription
false
Subscription Details
Show child attributes
Show child attributes
Convert Document. Needed only when the document is already created and you want to convert it to another document
Show child attributes
Show child attributes
Document Custom Headers. Custom headers should already be added in Swipe Portal.
Show child attributes
Show child attributes
[
{
"label": "Custom Header 1",
"value": "Value 1"
}
]