API to cancel a scheduled invoice by schedule id
POST https://services.leadconnectorhq.com/invoices/schedule/{scheduleId}/cancel
Authorization
Path parameters
Body
Responses
200 - Successful response
_id (string, required): Schedule Id Example: 6578278e879ad2646715ba9c
status (object, required): Schedule Status Example: draft
liveMode (boolean, required): Live Mode Example: False
altId (string, required): Account Id or Agency Id Example: 6578278e879ad2646715ba9c
altType (string, required): Possible values: 'account'
name (string, required): Name of the invoice Example: New Invoice
schedule (object)
rrule (object)
intervalType (string, required): Possible values: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', 'secondly' Example: monthly
interval (number, required): Example: 2
startDate (string, required): Start date in YYYY-MM-DD format Example: 2023-01-01
startTime (string): Start time in HH:mm:ss format Example: 20:45:00
endDate (string): End date in YYYY-MM-DD format Example: 2029-11-01
endTime (string): End time in HH:mm:ss format Example: 18:45:00
dayOfMonth (number): -1, 1, 2, 3, ..., 27, 28 Example: 15
dayOfWeek (string): Possible values: 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su' Example: mo
numOfWeek (number): -1, 1, 2, 3, 4 Example: -1
monthOfYear (string): Possible values: 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' Example: jan
count (number): Max number of task executions Example: 10
daysBefore (number): Execute task number of days before Example: 5
useStartAsPrimaryUserAccepted (boolean): Start as primary user accepted date Example: True
endType (string): End type like after, by, count Example: by
invoices (object[], required): List of invoices
_id (string, required): Invoice Id Example: 6578278e879ad2646715ba9c
status (string, required): Invoice Status Possible values: 'draft', 'sent', 'payment_processing', 'paid', 'void', 'partially_paid' Example: draft
liveMode (boolean, required): Live Mode Example: False
amountPaid (number, required): Amount Paid Example: 0
altId (string, required): Account Id or Agency Id Example: 6578278e879ad2646715ba9c
altType (string, required): Possible values: 'account'
name (string, required): Name of the invoice Example: New Invoice
businessDetails (object, required): Business Details
invoiceNumber (number, required): Invoice Number Example: 19
currency (string, required): Currency Example: USD
contactDetails (object, required): Contact Details
issueDate (string, required): Issue date in YYYY-MM-DD format Example: 2023-01-01
dueDate (string, required): Due date in YYYY-MM-DD format Example: 2023-01-01
discount (object): Discount
invoiceItems (string[], required): Invoice Items
total (number, required): Total Amount Example: 999
title (string, required): Title Example: INVOICE
amountDue (number, required): Total Amount Due Example: 999
createdAt (string, required): created at Example: 2023-12-12T09:27:42.355Z
updatedAt (string, required): updated at Example: 2023-12-12T09:27:42.355Z
automaticTaxesEnabled (boolean): Automatic taxes enabled for the Invoice Example: True
automaticTaxesCalculated (boolean): Is Automatic taxes calculated for the Invoice items Example: True
paymentSchedule (object): split invoice into payment schedule summing up to full invoice amount
businessDetails (object, required): Business Details
currency (string, required): Currency Example: USD
contactDetails (object, required): Contact Details
discount (object): Discount
items (string[], required): Invoice Items
total (number, required): Total Amount Example: 999
title (string, required): Title Example: INVOICE
termsNotes (string, required): Terms notes Example: Confidential
compiledTermsNotes (string, required): Compiled terms notes Example: Confidential
createdAt (string, required): created at Example: 2023-12-12T09:27:42.355Z
updatedAt (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
401 - Unauthorized
422 - Unprocessable Entity
Example
curl -X POST 'https://services.leadconnectorhq.com/invoices/schedule/YOUR_scheduleId/cancel' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"altId": "6578278e879ad2646715ba9c",
"altType": "account"
}'
const response = await fetch('https://services.leadconnectorhq.com/invoices/schedule/YOUR_scheduleId/cancel', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account"}),
});
const data = await response.json();
import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/invoices/schedule/YOUR_scheduleId/cancel',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"altId": "6578278e879ad2646715ba9c", "altType": "account"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/invoices/schedule/YOUR_scheduleId/cancel');
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'}),
]);
$data = json_decode(curl_exec($ch), true);