API to create an invoice Schedule
POST https://services.leadconnectorhq.com/invoices/scheduleAuthorization
| 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' |
name | string | Yes |
contactDetails(object, required)id(string, required): Contact ID Example:6578278e879ad2646715ba9cname(string, required): Contact Name Example:AlexphoneNo(string, required): Contact Phone Number Example:+1234567890email(string, required): Contact Email Example:alex@example.comadditionalEmails(object[]): Secondary email addresses for the contact to be savedemail(string, required): Example:alex@example.com
companyName(string): Contact Company Name Example:ABC Corp.address(object)addressLine1(string): Address Line 1 Example:9931 BeechwoodaddressLine2(string): Address Line 2 Example:Beechwoodcity(string): City Example:St. Houstonstate(string): State Example:TXcountryCode(string): Country Code Example:USpostalCode(string): Postal Code Example:559-6993
customFields(string[]): Custom Values
schedule(object, required)executeAt(string)rrule(object)intervalType(string, required): Possible values: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', 'secondly' Example:monthlyinterval(number, required): Example:2startDate(string, required): Start date in YYYY-MM-DD format Example:2023-01-01startTime(string): Start time in HH:mm:ss format Example:20:45:00endDate(string): End date in YYYY-MM-DD format Example:2029-11-01endTime(string): End time in HH:mm:ss format Example:18:45:00dayOfMonth(number): -1, 1, 2, 3, ..., 27, 28 Example:15dayOfWeek(string): Possible values: 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su' Example:monumOfWeek(number): -1, 1, 2, 3, 4 Example:-1monthOfYear(string): Possible values: 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' Example:jancount(number): Max number of task executions Example:10daysBefore(number): Execute task number of days before Example:5useStartAsPrimaryUserAccepted(boolean): Start as primary user accepted date Example:TrueendType(string): End type like after, by, count Example:by
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
liveMode | boolean | Yes |
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, required)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 | ||
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(object[]): attachments for the invoiceid(string, required): Id of the file selected Example:6241712be68f7a98102ba272name(string, required): Name of the file Example:Electronics.pdfurl(string, required): URL of the file Example:https://example.com/digital-deliverytype(string, required): Type of the filesize(number, required): Size of the file Example:10000
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
miscellaneousCharges | object | No | miscellaneous charges for the invoice |
Responses
200 - Successful response
_id(string, required): Schedule Id Example:6578278e879ad2646715ba9cstatus(object, required): Schedule Status Example:draftliveMode(boolean, required): Live Mode Example:FalsealtId(string, required): Account Id or Agency Id Example:6578278e879ad2646715ba9caltType(string, required): Possible values: 'account'name(string, required): Name of the invoice Example:New Invoiceschedule(object)executeAt(string)rrule(object)intervalType(string, required): Possible values: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', 'secondly' Example:monthlyinterval(number, required): Example:2startDate(string, required): Start date in YYYY-MM-DD format Example:2023-01-01startTime(string): Start time in HH:mm:ss format Example:20:45:00endDate(string): End date in YYYY-MM-DD format Example:2029-11-01endTime(string): End time in HH:mm:ss format Example:18:45:00dayOfMonth(number): -1, 1, 2, 3, ..., 27, 28 Example:15dayOfWeek(string): Possible values: 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su' Example:monumOfWeek(number): -1, 1, 2, 3, 4 Example:-1monthOfYear(string): Possible values: 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' Example:jancount(number): Max number of task executions Example:10daysBefore(number): Execute task number of days before Example:5useStartAsPrimaryUserAccepted(boolean): Start as primary user accepted date Example:TrueendType(string): End type like after, by, count Example:by
invoices(object[], required): List of invoices_id(string, required): Invoice Id Example:6578278e879ad2646715ba9cstatus(string, required): Invoice Status Possible values: 'draft', 'sent', 'payment_processing', 'paid', 'void', 'partially_paid' Example:draftliveMode(boolean, required): Live Mode Example:FalseamountPaid(number, required): Amount Paid Example:0altId(string, required): Account Id or Agency Id Example:6578278e879ad2646715ba9caltType(string, required): Possible values: 'account'name(string, required): Name of the invoice Example:New InvoicebusinessDetails(object, required): Business DetailsinvoiceNumber(number, required): Invoice Number Example:19currency(string, required): Currency Example:USDcontactDetails(object, required): Contact DetailsissueDate(string, required): Issue date in YYYY-MM-DD format Example:2023-01-01dueDate(string, required): Due date in YYYY-MM-DD format Example:2023-01-01discount(object): DiscountinvoiceItems(string[], required): Invoice Itemstotal(number, required): Total Amount Example:999title(string, required): Title Example:INVOICEamountDue(number, required): Total Amount Due Example:999createdAt(string, required): created at Example:2023-12-12T09:27:42.355ZupdatedAt(string, required): updated at Example:2023-12-12T09:27:42.355ZautomaticTaxesEnabled(boolean): Automatic taxes enabled for the Invoice Example:TrueautomaticTaxesCalculated(boolean): Is Automatic taxes calculated for the Invoice items Example:TruepaymentSchedule(object): split invoice into payment schedule summing up to full invoice amount
businessDetails(object, required): Business Detailscurrency(string, required): Currency Example:USDcontactDetails(object, required): Contact Detailsdiscount(object): Discountitems(string[], required): Invoice Itemstotal(number, required): Total Amount Example:999title(string, required): Title Example:INVOICEtermsNotes(string, required): Terms notes Example:ConfidentialcompiledTermsNotes(string, required): Compiled terms notes Example:ConfidentialcreatedAt(string, required): created at Example:2023-12-12T09:27:42.355ZupdatedAt(string, required): updated at Example:2023-12-12T09:27:42.355Z
{
"_id": "6578278e879ad2646715ba9c",
"status": "draft",
"liveMode": false,
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"name": "New Invoice",
"schedule": {
"executeAt": "string",
"rrule": {
"intervalType": "monthly",
"interval": 2,
"startDate": "2023-01-01",
"startTime": "20:45:00",
"endDate": "2029-11-01",
"endTime": "18:45:00",
"dayOfMonth": 15,
"dayOfWeek": "mo",
"numOfWeek": -1,
"monthOfYear": "jan",
"count": 10,
"daysBefore": 5,
"useStartAsPrimaryUserAccepted": true,
"endType": "by"
}
},
"invoices": [
{
"_id": "6578278e879ad2646715ba9c",
"status": "draft",
"liveMode": false,
"amountPaid": 0,
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"name": "New Invoice",
"businessDetails": {
"name": "Alex",
"address": {
"addressLine1": "9931 Beechwood",
// truncado: 94 lineas mas
}400 - Bad Request
{}422 - Unprocessable Entity
{}Example
curl -X POST 'https://services.leadconnectorhq.com/invoices/schedule' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"name": "string",
"contactDetails": {
"id": "6578278e879ad2646715ba9c",
"name": "Alex",
"phoneNo": "+1234567890",
"email": "alex@example.com",
"additionalEmails": [
{
"email": "alex@example.com"
}
],
"companyName": "ABC Corp.",
"address": {
"addressLine1": "9931 Beechwood",
"addressLine2": "Beechwood",
"city": "St. Houston",
"state": "TX",
"countryCode": "US",
"postalCode": "559-6993"
},
"customFields": [
"string"
]
},
"schedule": {
"executeAt": "string",
"rrule": {
"intervalType": "monthly",
"interval": 2,
"startDate": "2023-01-01",
"startTime": "20:45:00",
"endDate": "2029-11-01",
"endTime": "18:45:00",
"dayOfMonth": 15,
"dayOfWeek": "mo",
"numOfWeek": -1,
"monthOfYear": "jan",
"count": 10,
"daysBefore": 5,
"useStartAsPrimaryUserAccepted": true,
"endType": "by"
}
},
"liveMode": true,
"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": "string",
"invoiceNumberPrefix": "INV-",
"attachments": [
{
"id": "6241712be68f7a98102ba272",
"name": "Electronics.pdf",
"url": "https://example.com/digital-delivery",
"type": "string",
"size": 10000
}
]
}'const response = await fetch('https://services.leadconnectorhq.com/invoices/schedule', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "string", "contactDetails": {"id": "6578278e879ad2646715ba9c", "name": "Alex", "phoneNo": "+1234567890", "email": "alex@example.com", "additionalEmails": [{"email": "alex@example.com"}], "companyName": "ABC Corp.", "address": {"addressLine1": "9931 Beechwood", "addressLine2": "Beechwood", "city": "St. Houston", "state": "TX", "countryCode": "US", "postalCode": "559-6993"}, "customFields": ["string"]}, "schedule": {"executeAt": "string", "rrule": {"intervalType": "monthly", "interval": 2, "startDate": "2023-01-01", "startTime": "20:45:00", "endDate": "2029-11-01", "endTime": "18:45:00", "dayOfMonth": 15, "dayOfWeek": "mo", "numOfWeek": -1, "monthOfYear": "jan", "count": 10, "daysBefore": 5, "useStartAsPrimaryUserAccepted": true, "endType": "by"}}, "liveMode": true, "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": "string", "invoiceNumberPrefix": "INV-", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}]}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/invoices/schedule',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "string", "contactDetails": {"id": "6578278e879ad2646715ba9c", "name": "Alex", "phoneNo": "+1234567890", "email": "alex@example.com", "additionalEmails": [{"email": "alex@example.com"}], "companyName": "ABC Corp.", "address": {"addressLine1": "9931 Beechwood", "addressLine2": "Beechwood", "city": "St. Houston", "state": "TX", "countryCode": "US", "postalCode": "559-6993"}, "customFields": ["string"]}, "schedule": {"executeAt": "string", "rrule": {"intervalType": "monthly", "interval": 2, "startDate": "2023-01-01", "startTime": "20:45:00", "endDate": "2029-11-01", "endTime": "18:45:00", "dayOfMonth": 15, "dayOfWeek": "mo", "numOfWeek": -1, "monthOfYear": "jan", "count": 10, "daysBefore": 5, "useStartAsPrimaryUserAccepted": true, "endType": "by"}}, "liveMode": true, "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": "string", "invoiceNumberPrefix": "INV-", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}]},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/invoices/schedule');
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', 'name': 'string', 'contactDetails': {'id': '6578278e879ad2646715ba9c', 'name': 'Alex', 'phoneNo': '+1234567890', 'email': 'alex@example.com', 'additionalEmails': [{'email': 'alex@example.com'}], 'companyName': 'ABC Corp.', 'address': {'addressLine1': '9931 Beechwood', 'addressLine2': 'Beechwood', 'city': 'St. Houston', 'state': 'TX', 'countryCode': 'US', 'postalCode': '559-6993'}, 'customFields': ['string']}, 'schedule': {'executeAt': 'string', 'rrule': {'intervalType': 'monthly', 'interval': 2, 'startDate': '2023-01-01', 'startTime': '20:45:00', 'endDate': '2029-11-01', 'endTime': '18:45:00', 'dayOfMonth': 15, 'dayOfWeek': 'mo', 'numOfWeek': -1, 'monthOfYear': 'jan', 'count': 10, 'daysBefore': 5, 'useStartAsPrimaryUserAccepted': true, 'endType': 'by'}}, 'liveMode': true, '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': 'string', 'invoiceNumberPrefix': 'INV-', 'attachments': [{'id': '6241712be68f7a98102ba272', 'name': 'Electronics.pdf', 'url': 'https://example.com/digital-delivery', 'type': 'string', 'size': 10000}]}),
]);
$data = json_decode(curl_exec($ch), true);