Skip to main content
POST
/
v1
/
customer
Add a customer
curl --request POST \
  --url https://app.getswipe.in/api/partner/v1/customer \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer_id": "123",
  "name": "TATA RATAN",
  "phone": "1234567890",
  "email": "reddi@reddi.reddi",
  "discount": 10,
  "gstin": "27AARCS7202C1ZD",
  "company_name": "GSTN",
  "opening_balance": "1245",
  "credit_limit": 200,
  "billing_address": [
    {
      "state": "State Name",
      "address_line1": "",
      "address_line2": "",
      "pincode": "500075",
      "city": "",
      "country": "India"
    }
  ],
  "shipping_address": [
    {
      "state": "State Name",
      "address_line1": "",
      "address_line2": "",
      "pincode": "500075",
      "city": "",
      "country": "India"
    }
  ],
  "opening_balance_type": 1,
  "dial_code": "91",
  "profile_image": "",
  "pan": "ABCD1234F",
  "notes": "Testing api",
  "cc_emails": "reddi@reddi.reddi,acb.a@bcd.con",
  "status": "Active"
}
'
import requests

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

payload = {
    "customer_id": "123",
    "name": "TATA RATAN",
    "phone": "1234567890",
    "email": "reddi@reddi.reddi",
    "discount": 10,
    "gstin": "27AARCS7202C1ZD",
    "company_name": "GSTN",
    "opening_balance": "1245",
    "credit_limit": 200,
    "billing_address": [
        {
            "state": "State Name",
            "address_line1": "",
            "address_line2": "",
            "pincode": "500075",
            "city": "",
            "country": "India"
        }
    ],
    "shipping_address": [
        {
            "state": "State Name",
            "address_line1": "",
            "address_line2": "",
            "pincode": "500075",
            "city": "",
            "country": "India"
        }
    ],
    "opening_balance_type": 1,
    "dial_code": "91",
    "profile_image": "",
    "pan": "ABCD1234F",
    "notes": "Testing api",
    "cc_emails": "reddi@reddi.reddi,acb.a@bcd.con",
    "status": "Active"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    customer_id: '123',
    name: 'TATA RATAN',
    phone: '1234567890',
    email: 'reddi@reddi.reddi',
    discount: 10,
    gstin: '27AARCS7202C1ZD',
    company_name: 'GSTN',
    opening_balance: '1245',
    credit_limit: 200,
    billing_address: [
      {
        state: 'State Name',
        address_line1: '',
        address_line2: '',
        pincode: '500075',
        city: '',
        country: 'India'
      }
    ],
    shipping_address: [
      {
        state: 'State Name',
        address_line1: '',
        address_line2: '',
        pincode: '500075',
        city: '',
        country: 'India'
      }
    ],
    opening_balance_type: 1,
    dial_code: '91',
    profile_image: '',
    pan: 'ABCD1234F',
    notes: 'Testing api',
    cc_emails: 'reddi@reddi.reddi,acb.a@bcd.con',
    status: 'Active'
  })
};

fetch('https://app.getswipe.in/api/partner/v1/customer', 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/customer",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'customer_id' => '123',
    'name' => 'TATA RATAN',
    'phone' => '1234567890',
    'email' => 'reddi@reddi.reddi',
    'discount' => 10,
    'gstin' => '27AARCS7202C1ZD',
    'company_name' => 'GSTN',
    'opening_balance' => '1245',
    'credit_limit' => 200,
    'billing_address' => [
        [
                'state' => 'State Name',
                'address_line1' => '',
                'address_line2' => '',
                'pincode' => '500075',
                'city' => '',
                'country' => 'India'
        ]
    ],
    'shipping_address' => [
        [
                'state' => 'State Name',
                'address_line1' => '',
                'address_line2' => '',
                'pincode' => '500075',
                'city' => '',
                'country' => 'India'
        ]
    ],
    'opening_balance_type' => 1,
    'dial_code' => '91',
    'profile_image' => '',
    'pan' => 'ABCD1234F',
    'notes' => 'Testing api',
    'cc_emails' => 'reddi@reddi.reddi,acb.a@bcd.con',
    '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/customer"

	payload := strings.NewReader("{\n  \"customer_id\": \"123\",\n  \"name\": \"TATA RATAN\",\n  \"phone\": \"1234567890\",\n  \"email\": \"reddi@reddi.reddi\",\n  \"discount\": 10,\n  \"gstin\": \"27AARCS7202C1ZD\",\n  \"company_name\": \"GSTN\",\n  \"opening_balance\": \"1245\",\n  \"credit_limit\": 200,\n  \"billing_address\": [\n    {\n      \"state\": \"State Name\",\n      \"address_line1\": \"\",\n      \"address_line2\": \"\",\n      \"pincode\": \"500075\",\n      \"city\": \"\",\n      \"country\": \"India\"\n    }\n  ],\n  \"shipping_address\": [\n    {\n      \"state\": \"State Name\",\n      \"address_line1\": \"\",\n      \"address_line2\": \"\",\n      \"pincode\": \"500075\",\n      \"city\": \"\",\n      \"country\": \"India\"\n    }\n  ],\n  \"opening_balance_type\": 1,\n  \"dial_code\": \"91\",\n  \"profile_image\": \"\",\n  \"pan\": \"ABCD1234F\",\n  \"notes\": \"Testing api\",\n  \"cc_emails\": \"reddi@reddi.reddi,acb.a@bcd.con\",\n  \"status\": \"Active\"\n}")

	req, _ := http.NewRequest("POST", 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.post("https://app.getswipe.in/api/partner/v1/customer")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"customer_id\": \"123\",\n  \"name\": \"TATA RATAN\",\n  \"phone\": \"1234567890\",\n  \"email\": \"reddi@reddi.reddi\",\n  \"discount\": 10,\n  \"gstin\": \"27AARCS7202C1ZD\",\n  \"company_name\": \"GSTN\",\n  \"opening_balance\": \"1245\",\n  \"credit_limit\": 200,\n  \"billing_address\": [\n    {\n      \"state\": \"State Name\",\n      \"address_line1\": \"\",\n      \"address_line2\": \"\",\n      \"pincode\": \"500075\",\n      \"city\": \"\",\n      \"country\": \"India\"\n    }\n  ],\n  \"shipping_address\": [\n    {\n      \"state\": \"State Name\",\n      \"address_line1\": \"\",\n      \"address_line2\": \"\",\n      \"pincode\": \"500075\",\n      \"city\": \"\",\n      \"country\": \"India\"\n    }\n  ],\n  \"opening_balance_type\": 1,\n  \"dial_code\": \"91\",\n  \"profile_image\": \"\",\n  \"pan\": \"ABCD1234F\",\n  \"notes\": \"Testing api\",\n  \"cc_emails\": \"reddi@reddi.reddi,acb.a@bcd.con\",\n  \"status\": \"Active\"\n}")
  .asString();
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"customer_id\": \"123\",\n  \"name\": \"TATA RATAN\",\n  \"phone\": \"1234567890\",\n  \"email\": \"reddi@reddi.reddi\",\n  \"discount\": 10,\n  \"gstin\": \"27AARCS7202C1ZD\",\n  \"company_name\": \"GSTN\",\n  \"opening_balance\": \"1245\",\n  \"credit_limit\": 200,\n  \"billing_address\": [\n    {\n      \"state\": \"State Name\",\n      \"address_line1\": \"\",\n      \"address_line2\": \"\",\n      \"pincode\": \"500075\",\n      \"city\": \"\",\n      \"country\": \"India\"\n    }\n  ],\n  \"shipping_address\": [\n    {\n      \"state\": \"State Name\",\n      \"address_line1\": \"\",\n      \"address_line2\": \"\",\n      \"pincode\": \"500075\",\n      \"city\": \"\",\n      \"country\": \"India\"\n    }\n  ],\n  \"opening_balance_type\": 1,\n  \"dial_code\": \"91\",\n  \"profile_image\": \"\",\n  \"pan\": \"ABCD1234F\",\n  \"notes\": \"Testing api\",\n  \"cc_emails\": \"reddi@reddi.reddi,acb.a@bcd.con\",\n  \"status\": \"Active\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "Customer added successfully"
}
{
  "success": false,
  "error_code": "INVALID_CUSTOMER_ID",
  "message": "Error Message",
  "errors": "List of errors"
}
{
  "success": false,
  "error_code": "INVALID_CUSTOMER_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
customer_id
string
required

Your Customer ID

Example:

"123"

name
string
required

Customer name

Example:

"TATA RATAN"

phone
string

Phone number

Example:

"1234567890"

email
string

Email address

Example:

"reddi@reddi.reddi"

discount
integer

Discount

Example:

10

gstin
string

GSTIN

Pattern: ^(|[0-9A-Z]{15})$
Example:

"27AARCS7202C1ZD"

company_name
string

Company name

Example:

"GSTN"

opening_balance
string

Opening balance

Example:

"1245"

credit_limit
integer

Credit limit

Example:

200

billing_address
object[]

List of billing addresses

shipping_address
object[]

List of shipping addresses

opening_balance_type
integer

Credit[0] / Debit[1]

Example:

1

dial_code
string

Dial code

Example:

"91"

profile_image
string

Profile image URL

Example:

""

pan
string

PAN

Example:

"ABCD1234F"

notes
string

Notes

Example:

"Testing api"

cc_emails
string

CC email addresses

Example:

"reddi@reddi.reddi,acb.a@bcd.con"

status
string

Status

Example:

"Active"

Response

Success

success
boolean

Success flag

Example:

true

message
string

Response message

Example:

"Customer added successfully"