Xebra API Documentation

Xebra API Documentation

Introduction

The Xebra API is for creating your Xebra invoices using JSON Payload. The API makes it easy to create web and desktop applications that integrate with your account. Possible uses for it include automatically creating invoices when users sign up on your website.

Quick Start

The column on the right-hand side has a curl call that demonstrates the required Headers and general format of requests to the Xebra API. Requests are authenticated using Auth tokens which you receive in exchange for a code we issue after a logged-in user performs an authorization grant request.

Required Headers

There are two required headers for most calls:

  1. Content-Type: application/JSON

Creating your application on Xebra

Create an account by visiting our sign up page. If you already have a Xebra account, log in by visiting our login page. You can reach out to our support team to have your account put on our partner plan.

How to use API:

  1. Create a dedicated page for the integration on your website
  2. Authenticate Your Xebra Account Using Authenticate API
  3. After Authentication, you will get Auth token, Xebra accounts business Id and registration id
  4. Using these all parameters, you can send data by make_invoice API and will create an invoice automatically for a specific transaction on your application

Authenticate User
										curl -X PUT
										-H  "Content-Type: application/json" 
										-d  `{
										        "username": "[email protected]",
										        "password": "[email protected]",	
										}`
										"https://xebra.in/Api/authentication"
										
										Response:
										1. Success
										{‘Status’:’Success’,” 'message'”:”Authenticated Successfully”, 'bus_id':’2’, 'reg_id':’2’, 'auth_token':’X678Fder45’}
										
										2. Failed
										{‘Status’:’Failed’,”Message”:”Something went wrong”,”error”:”error name”}
										
									
Making Invoice
										curl -X PUT
										-H  "Content-Type: application/json" 
										-d {'reg_id':’1’,
										'bus_id'  :’1’,
										'gst_id'  :’9’,
										'inv_document_type' :"Sales Invoice",
										'cust_id':’3’,
										'inv_invoice_date'  :”2021-4-12”,
										'inv_nature_type' :”onetime,
										'inv_export_type'   : “0”,
										'inv_dollar_number':’1’,
										'inv_inr_value':”1”,
										'inv_export_currency'  : “47”,
										'inv_gst_id'   : “14”,
										'inv_place_of_supply'  :“27”,
										'inv_billing_country'   : “101”,
										'inv_billing_state'   : “27”,
										'inv_billing_address'  : “501,building, D.N road ,Mumbai”,
										'inv_po_no'   : “1111”,
										'inv_po_date'  :”2021-4-12”,
										'inv_discount_total:”0”,
										'inv_taxable_total':”1000”,
										'inv_igst_total'”:0”,
										'inv_cgst_total':”90”,
										'inv_sgst_total':”90”,
										'inv_grant_total':”1180”,
										‘inv_item’:{
										[0]:{  
											'service_id'   :  ‘1’,
											'invl_particulars'   :“computer”,
											'invl_hsn_sac_no'   : “1111”,
											'invl_quantity'   : “1”
											'invl_rate'  :  “1000”,
											'invl_discount'   : “0”,
											'invl_taxable_amt':“1000”,
											'invl_igst':”0”,
											'invl_igst_amt':”0”,
											'invl_sgst':”9”,
											'invl_sgst_amt':”90”,
											'invl_cgst':”9”,
											'invl_cgst_amt”:”90”,
											'invl_amount':”1180”,
											'invl_service_type':1,
										}
										}
										}`
										"https://xebra.in/Api/make_invoice"
										
										Response:
									1. Success
									{‘Status’:’Success’,”Message”:”Invoice Created Successfully”}
										
									2. Failed
									{‘Status’:’Failed’,”Message”:”Something went wrong”,”error”:”error name”}
									
Authenticate User
										url =  " https://xebra.in/Api/authentication " 
										headers = { 'Authorization':'Content-Type': 'application/json' }
										payload = { "username": "[email protected]",
										"password": "[email protected]",
										}
										res = requests.put(url, data=json.dumps(payload), headers=headers)
										
										Response:
										1. Success
										{‘Status’:’Success’,” 'message'”:”Authenticated Successfully”, 'bus_id':’2’, 'reg_id':’2’, 'auth_token':’X678Fder45’}
										
										2. Failed
										{‘Status’:’Failed’,”Message”:”Something went wrong”,”error”:”error name”}
									
Making Invoice
										url =  " https://xebra.in/Api/make_invoice " 
										headers = { 'Authorization':'Content-Type': 'application/json' }
										payload = { 
										'reg_id':’1’,
										'bus_id'  :’1’,
										'gst_id'  :’9’,
										'inv_document_type' :"Sales Invoice",
										'cust_id':’3’,
										'inv_invoice_date'  :”2021-4-12”,
										'inv_nature_type' :”onetime,
										'inv_export_type'   : “0”,
										'inv_dollar_number':’1’,
										'inv_inr_value':”1”,
										'inv_export_currency'  : “47”,
										'inv_gst_id'   : “14”,
										'inv_place_of_supply'  :“27”,
										'inv_billing_country'   : “101”,
										'inv_billing_state'   : “27”,
										'inv_billing_address'  : “501,building, D.N road ,Mumbai”,
										'inv_po_no'   : “1111”,
										'inv_po_date'  :”2021-4-12”,
										'inv_discount_total:”0”,
										'inv_taxable_total':”1000”,
										'inv_igst_total'”:0”,
										'inv_cgst_total':”90”,
										'inv_sgst_total':”90”,
										'inv_grant_total':”1180”,
										‘inv_item’:{
											[0]:{  
												'service_id'   :  ‘1’,
												'invl_particulars'   :“computer”,
												'invl_hsn_sac_no'   : “1111”,
												'invl_quantity'   : “1”
												'invl_rate'  :  “1000”,
												'invl_discount'   : “0”,
												'invl_taxable_amt':“1000”,
												'invl_igst':”0”,
												'invl_igst_amt':”0”,
												'invl_sgst':”9”,
												'invl_sgst_amt':”90”,
												'invl_cgst':”9”,
												'invl_cgst_amt”:”90”,
												'invl_amount':”1180”,
												'invl_service_type':1,
											}
										}
									}
									res = requests.put(url, data=json.dumps(payload), headers=headers)
									
									Response:
									1. Success
									{‘Status’:’Success’,”Message”:”Invoice Created Successfully”}
										
									2. Failed
									{‘Status’:’Failed’,”Message”:”Something went wrong”,”error”:”error name”}
									
Authenticate User
										$url =  " https://xebra.in/Api/authentication " 
										$data = array( "username"=> "[email protected]", }
										"password"=>"[email protected]",
										);
										$ch= curl_init($url);
										$payload = json_encode($data);
										curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
										curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
										curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
										curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
										curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json'));
										$output = curl_exec($ch);
										
										Response:
										1. Success
										{‘Status’:’Success’,” 'message'”:”Authenticated Successfully”, 'bus_id':’2’, 'reg_id':’2’, 'auth_token':’X678Fder45’}
										
										2. Failed
										{‘Status’:’Failed’,”Message”:”Something went wrong”,”error”:”error name”}

									
Making Invoice
										$url =  " https://xebra.in/Api/make_invoice " 
										$data = array( 
										'reg_id'=>’1’,
										'bus_id'  =>’1’,
										'gst_id'  =>’9’,
										'inv_document_type' =>"Sales Invoice",
										'cust_id'=>’3’,
										'inv_invoice_date'  =>”2021-4-12”,
										'inv_nature_type' =>”onetime,
										'inv_export_type'   => “0”,
										'inv_dollar_number'=>’1’,
										'inv_inr_value'=>”1”,
										'inv_export_currency'  => “47”,
										'inv_gst_id'   => “14”,
										'inv_place_of_supply'  =>“27”,
										'inv_billing_country'   =>“101”,
										'inv_billing_state'   =>“27”,
										'inv_billing_address'  => “501,building, D.N road ,Mumbai”,
										'inv_po_no'   =>“1111”,
										'inv_po_date'  =>”2021-4-12”,
										'inv_discount_total=>”0”,
										'inv_taxable_total'=>”1000”,
										'inv_igst_total'=>”0”,
										'inv_cgst_total'=>”90”,
										'inv_sgst_total'=>”90”,
										'inv_grant_total'=>”1180”,
										‘inv_item’:array(
											[0]=>array( 
												'service_id'   =>  ‘1’,
												'invl_particulars'   =>“computer”,
												'invl_hsn_sac_no'  => “1111”,
												'invl_quantity'  => “1”
												'invl_rate'  => “1000”,
												'invl_discount'   => “0”,
												'invl_taxable_amt'=>“1000”,
												'invl_igst'=>”0”,
												'invl_igst_amt'=>”0”,
												'invl_sgst'=>”9”,
												'invl_sgst_amt'=>”90”,
												'invl_cgst'=>”9”,
												'invl_cgst_amt”=>”90”,
												'invl_amount'=>”1180”,
												'invl_service_type'=>1,
											)
										)
									);

									$ch= curl_init($url);
									$payload = json_encode($data);
									curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
									curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
									curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
									curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
									curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json'));
									$output = curl_exec($ch);
									
									Response:
									1. Success
									{‘Status’:’Success’,”Message”:”Invoice Created Successfully”}
										
									2. Failed
									{‘Status’:’Failed’,”Message”:”Something went wrong”,”error”:”error name”}
									

MSME and Start-up founders who have already partnered with us