API to create a template
POST https://services.leadconnectorhq.com/invoices/templateAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
altId | string | Yes | 6578278e879ad2646715ba9c | account Id / company Id based on altType |
altType | string | Yes | account | Alt Type Possible values: 'account' |
internal | boolean | No | ||
name | string | Yes | New Template | Name of the template |
businessDetails(object, required)logoUrl(string): Business Logo URL Example:https://example.com/logo.pngname(string): Business Name Example:ABC Corp.phoneNo(string): Business Phone Number Example:+1-214-559-6993address(object): Business Address Example:9931 Beechwood, TXwebsite(string): Business Website Link Example:wwww.example.comcustomValues(string[]): Custom Values
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
currency | string | Yes |
items(object[], required)name(string, required): Invoice Item Name Example:ABC Productdescription(string): Invoice descriptions Example:ABC Corp.productId(string): Product Id Example:6578278e879ad2646715ba9cpriceId(string): Price Id Example:6578278e879ad2646715ba9ccurrency(string, required): Currency Example:USDamount(number, required): Product amount Example:999qty(number, required): Product Quantity Example:1taxes(object[]): Tax_id(string, required)name(string, required)rate(number, required)calculation(string): Possible values: 'exclusive'description(string)taxId(string)
automaticTaxCategoryId(string): Tax category id for calculating automatic tax Example:6578278e879ad2646715ba9cisSetupFeeItem(boolean): Setupfee item, only created when 1st invoice of recurring schedule is generatedtype(string): Price type of the item Possible values: 'one_time', 'recurring' Example:one_timetaxInclusive(boolean): true if item amount is tax inclusive Example:True
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
automaticTaxesEnabled | boolean | No | True | Automatic taxes enabled for the Invoice |
discount(object)value(number): Discount Value Example:10type(string, required): Discount type Possible values: 'percentage', 'fixed' Example:percentagevalidOnProductIds(string[]): Product Ids on which discount is applicable Example:[ '6579751d56f60276e5bd4154' ]
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
termsNotes | string | No | ||
title | string | No | New Template | Template title |
tipsConfiguration | object | No | Configuration for tips on invoices | |
lateFeesConfiguration | object | No | Late fees configuration for the invoices | |
invoiceNumberPrefix | string | No | INV- | prefix for invoice number |
paymentMethods | object | No | Payment Methods for Invoices | |
attachments | string[] | No | attachments for the invoice | |
miscellaneousCharges | object | No | miscellaneous charges for the invoice |
Responses
200 - Successful response
_id(string, required): Template Id Example:6578278e879ad2646715ba9caltId(string, required): Account Id or Agency Id Example:6578278e879ad2646715ba9caltType(string, required): Possible values: 'account'name(string, required): Name of the Template Example:New TemplatebusinessDetails(object, required): Business Detailscurrency(string, required): Currency Example:USDdiscount(object): Discountitems(string[], required): Invoice ItemsinvoiceNumberPrefix(string): prefix for invoice number Example:INV-total(number, required): Total Amount Example:999createdAt(string, required): created at Example:2023-12-12T09:27:42.355ZupdatedAt(string, required): updated at Example:2023-12-12T09:27:42.355Z
{
"_id": "6578278e879ad2646715ba9c",
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"name": "New Template",
"businessDetails": {
"name": "Alex",
"address": {
"addressLine1": "9931 Beechwood",
"city": "St. Houston",
"state": "TX",
"countryCode": "USA",
"postalCode": "559-6993"
},
"phoneNo": "+1-214-559-6993",
"website": "www.example.com"
},
"currency": "USD",
"discount": {
"type": "percentage",
"value": 0
},
"items": [
{
"taxes": [],
"_id": "c6tZZU0rJBf30ZXx9Gli",
"productId": "c6tZZU0rJBf30ZXx9Gli",
"priceId": "c6tZZU0rJBf30ZXx9Gli",
"currency": "USD",
"name": "Macbook Pro",
"qty": 1,
"amount": 999
}
],
"invoiceNumberPrefix": "INV-",
"total": 999,
"createdAt": "2023-12-12T09:27:42.355Z",
"updatedAt": "2023-12-12T09:27:42.355Z"
}400 - Bad Request
{}422 - Unprocessable Entity
{}Example
curl -X POST 'https://services.leadconnectorhq.com/invoices/template' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"internal": true,
"name": "New Template",
"businessDetails": {
"logoUrl": "https://example.com/logo.png",
"name": "ABC Corp.",
"phoneNo": "+1-214-559-6993",
"address": "9931 Beechwood, TX",
"website": "wwww.example.com",
"customValues": [
"string"
]
},
"currency": "string",
"items": [
{
"name": "ABC Product",
"description": "ABC Corp.",
"productId": "6578278e879ad2646715ba9c",
"priceId": "6578278e879ad2646715ba9c",
"currency": "USD",
"amount": 999,
"qty": 1,
"taxes": [
{}
],
"automaticTaxCategoryId": "6578278e879ad2646715ba9c",
"isSetupFeeItem": true,
"type": "one_time",
"taxInclusive": true
}
],
"automaticTaxesEnabled": true,
"discount": {
"value": 10,
"type": "percentage",
"validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
},
"termsNotes": "string",
"title": "New Template",
"invoiceNumberPrefix": "INV-",
"attachments": [
"string"
]
}'const response = await fetch('https://services.leadconnectorhq.com/invoices/template', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "internal": true, "name": "New Template", "businessDetails": {"logoUrl": "https://example.com/logo.png", "name": "ABC Corp.", "phoneNo": "+1-214-559-6993", "address": "9931 Beechwood, TX", "website": "wwww.example.com", "customValues": ["string"]}, "currency": "string", "items": [{"name": "ABC Product", "description": "ABC Corp.", "productId": "6578278e879ad2646715ba9c", "priceId": "6578278e879ad2646715ba9c", "currency": "USD", "amount": 999, "qty": 1, "taxes": [{}], "automaticTaxCategoryId": "6578278e879ad2646715ba9c", "isSetupFeeItem": true, "type": "one_time", "taxInclusive": true}], "automaticTaxesEnabled": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "string", "title": "New Template", "invoiceNumberPrefix": "INV-", "attachments": ["string"]}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/invoices/template',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "internal": true, "name": "New Template", "businessDetails": {"logoUrl": "https://example.com/logo.png", "name": "ABC Corp.", "phoneNo": "+1-214-559-6993", "address": "9931 Beechwood, TX", "website": "wwww.example.com", "customValues": ["string"]}, "currency": "string", "items": [{"name": "ABC Product", "description": "ABC Corp.", "productId": "6578278e879ad2646715ba9c", "priceId": "6578278e879ad2646715ba9c", "currency": "USD", "amount": 999, "qty": 1, "taxes": [{}], "automaticTaxCategoryId": "6578278e879ad2646715ba9c", "isSetupFeeItem": true, "type": "one_time", "taxInclusive": true}], "automaticTaxesEnabled": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "string", "title": "New Template", "invoiceNumberPrefix": "INV-", "attachments": ["string"]},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/invoices/template');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', 'internal': true, 'name': 'New Template', 'businessDetails': {'logoUrl': 'https://example.com/logo.png', 'name': 'ABC Corp.', 'phoneNo': '+1-214-559-6993', 'address': '9931 Beechwood, TX', 'website': 'wwww.example.com', 'customValues': ['string']}, 'currency': 'string', 'items': [{'name': 'ABC Product', 'description': 'ABC Corp.', 'productId': '6578278e879ad2646715ba9c', 'priceId': '6578278e879ad2646715ba9c', 'currency': 'USD', 'amount': 999, 'qty': 1, 'taxes': [{}], 'automaticTaxCategoryId': '6578278e879ad2646715ba9c', 'isSetupFeeItem': true, 'type': 'one_time', 'taxInclusive': true}], 'automaticTaxesEnabled': true, 'discount': {'value': 10, 'type': 'percentage', 'validOnProductIds': '[ '6579751d56f60276e5bd4154' ]'}, 'termsNotes': 'string', 'title': 'New Template', 'invoiceNumberPrefix': 'INV-', 'attachments': ['string']}),
]);
$data = json_decode(curl_exec($ch), true);