Create & Send

API to create or update a text2pay invoice

API to create or update a text2pay invoice

POST /invoices/text2pay

Authorization

Send an Authorization: Bearer <token> header with every request.

  • Location-level access token Scopes: invoices.write

Headers

Version header string required

API Version

Allowed values: 2021-07-28

Placeholder: 2021-07-28

Request body

application/json — required

altId string required

location Id / company Id based on altType

altType string (enum) required

Alt Type

Allowed values: location

name string required

Invoice Name

currency string required

Currency code

items object[] required

An array of items for the invoice.

termsNotes string

Terms notes, Also supports HTML markups

title string

Title for the invoice

contactDetails object required
invoiceNumber string

Invoice Number

issueDate string required

Issue date in YYYY-MM-DD format

dueDate string

Due date in YYYY-MM-DD format

sentTo object required
liveMode boolean required
automaticTaxesEnabled boolean

Automatic taxes enabled for the Invoice

paymentSchedule object
lateFeesConfiguration object
tipsConfiguration object
invoiceNumberPrefix string

prefix for invoice number

paymentMethods object
attachments object[]

attachments for the invoice

miscellaneousCharges object
id string

id of invoice to update. If skipped, a new invoice will be created

includeTermsNote boolean

include terms & notes with receipts

action string (enum) required

create invoice in draft mode or send mode

Allowed values: draft send

userId string required

id of user generating invoice

discount object
businessDetails object

Responses

200 Successful response
invoice object required
invoiceUrl string required

preview url of generated invoice

400 Bad Request
statusCode number required
message string required
401 Unauthorized
statusCode number required
message string required
error string required
422 Unprocessable Entity
statusCode number required
message string[] required
error string required

Try it

Request example

Request example
cURL Bash
curl --request POST \
  --url 'https://services.leadconnectorhq.com/invoices/text2pay' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Version: 2021-07-28' \
  --header 'Content-Type: application/json' \
  --data '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "location",
  "name": "New Invoice",
  "currency": "USD",
  "items": [
    {
      "name": "ABC Product",
      "description": "ABC Corp.",
      "productId": "6578278e879ad2646715ba9c",
      "priceId": "6578278e879ad2646715ba9c",
      "currency": "USD",
      "amount": 999,
      "qty": 1,
      "taxes": [
        {
          "_id": "string",
          "name": "string",
          "rate": 0,
          "calculation": "exclusive",
          "description": "string",
          "taxId": "string"
        }
      ],
      "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
      "isSetupFeeItem": true,
      "type": "one_time",
      "taxInclusive": true
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "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"
    ]
  },
  "invoiceNumber": "1001",
  "issueDate": "2023-01-01",
  "dueDate": "2023-01-14",
  "sentTo": {
    "email": [
      "alex@example.com"
    ],
    "emailCc": [
      "alex@example.com"
    ],
    "emailBcc": [
      "alex@example.com"
    ],
    "phoneNo": [
      "+1-214-559-6993"
    ]
  },
  "liveMode": true,
  "automaticTaxesEnabled": true,
  "paymentSchedule": {
    "type": "percentage",
    "schedules": [
      "string"
    ]
  },
  "lateFeesConfiguration": {
    "enable": true,
    "value": 10,
    "type": "fixed",
    "frequency": {
      "intervalCount": 10,
      "interval": "day"
    },
    "grace": {
      "intervalCount": 10,
      "interval": "day"
    },
    "maxLateFees": {
      "type": "fixed",
      "value": "10"
    }
  },
  "tipsConfiguration": {
    "tipsPercentage": [
      5,
      10,
      15
    ],
    "tipsEnabled": true
  },
  "invoiceNumberPrefix": "INV-",
  "paymentMethods": {
    "stripe": {
      "enableBankDebitOnly": false
    }
  },
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "type": "string",
      "size": 10000
    }
  ],
  "miscellaneousCharges": {
    "charges": [
      [
        "value"
      ]
    ],
    "collectedMiscellaneousCharges": 10,
    "paidCharges": [
      {
        "name": "Processing Fee",
        "charge": 10,
        "amount": 10,
        "_id": "673d01d7d547648a8dab6211"
      }
    ]
  },
  "id": "string",
  "includeTermsNote": true,
  "action": "draft",
  "userId": "string",
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "businessDetails": {
    "logoUrl": "https://example.com/logo.png",
    "name": "ABC Corp.",
    "phoneNo": "+1-214-559-6993",
    "address": {
      "addressLine1": "9931 Beechwood",
      "addressLine2": "Beechwood",
      "city": "St. Houston",
      "state": "TX",
      "countryCode": "US",
      "postalCode": "559-6993"
    },
    "website": "wwww.example.com",
    "customValues": [
      "string"
    ]
  }
}'
JavaScript JavaScript
const response = await fetch('https://services.leadconnectorhq.com/invoices/text2pay', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Version': '2021-07-28',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "altId": "6578278e879ad2646715ba9c",
    "altType": "location",
    "name": "New Invoice",
    "currency": "USD",
    "items": [
      {
        "name": "ABC Product",
        "description": "ABC Corp.",
        "productId": "6578278e879ad2646715ba9c",
        "priceId": "6578278e879ad2646715ba9c",
        "currency": "USD",
        "amount": 999,
        "qty": 1,
        "taxes": [
          {
            "_id": "string",
            "name": "string",
            "rate": 0,
            "calculation": "exclusive",
            "description": "string",
            "taxId": "string"
          }
        ],
        "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
        "isSetupFeeItem": true,
        "type": "one_time",
        "taxInclusive": true
      }
    ],
    "termsNotes": "<p>This is a default terms.</p>",
    "title": "INVOICE",
    "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"
      ]
    },
    "invoiceNumber": "1001",
    "issueDate": "2023-01-01",
    "dueDate": "2023-01-14",
    "sentTo": {
      "email": [
        "alex@example.com"
      ],
      "emailCc": [
        "alex@example.com"
      ],
      "emailBcc": [
        "alex@example.com"
      ],
      "phoneNo": [
        "+1-214-559-6993"
      ]
    },
    "liveMode": true,
    "automaticTaxesEnabled": true,
    "paymentSchedule": {
      "type": "percentage",
      "schedules": [
        "string"
      ]
    },
    "lateFeesConfiguration": {
      "enable": true,
      "value": 10,
      "type": "fixed",
      "frequency": {
        "intervalCount": 10,
        "interval": "day"
      },
      "grace": {
        "intervalCount": 10,
        "interval": "day"
      },
      "maxLateFees": {
        "type": "fixed",
        "value": "10"
      }
    },
    "tipsConfiguration": {
      "tipsPercentage": [
        5,
        10,
        15
      ],
      "tipsEnabled": true
    },
    "invoiceNumberPrefix": "INV-",
    "paymentMethods": {
      "stripe": {
        "enableBankDebitOnly": false
      }
    },
    "attachments": [
      {
        "id": "6241712be68f7a98102ba272",
        "name": "Electronics.pdf",
        "url": "https://example.com/digital-delivery",
        "type": "string",
        "size": 10000
      }
    ],
    "miscellaneousCharges": {
      "charges": [
        [
          "value"
        ]
      ],
      "collectedMiscellaneousCharges": 10,
      "paidCharges": [
        {
          "name": "Processing Fee",
          "charge": 10,
          "amount": 10,
          "_id": "673d01d7d547648a8dab6211"
        }
      ]
    },
    "id": "string",
    "includeTermsNote": true,
    "action": "draft",
    "userId": "string",
    "discount": {
      "value": 10,
      "type": "percentage",
      "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
    },
    "businessDetails": {
      "logoUrl": "https://example.com/logo.png",
      "name": "ABC Corp.",
      "phoneNo": "+1-214-559-6993",
      "address": {
        "addressLine1": "9931 Beechwood",
        "addressLine2": "Beechwood",
        "city": "St. Houston",
        "state": "TX",
        "countryCode": "US",
        "postalCode": "559-6993"
      },
      "website": "wwww.example.com",
      "customValues": [
        "string"
      ]
    }
  })
});

const data = await response.json();
console.log(data);
Python Python
import requests

url = "https://services.leadconnectorhq.com/invoices/text2pay"

headers = {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN",
    "Version": "2021-07-28",
    "Content-Type": "application/json"
}

payload = {
    "altId": "6578278e879ad2646715ba9c",
    "altType": "location",
    "name": "New Invoice",
    "currency": "USD",
    "items": [
        {
            "name": "ABC Product",
            "description": "ABC Corp.",
            "productId": "6578278e879ad2646715ba9c",
            "priceId": "6578278e879ad2646715ba9c",
            "currency": "USD",
            "amount": 999,
            "qty": 1,
            "taxes": [
                {
                    "_id": "string",
                    "name": "string",
                    "rate": 0,
                    "calculation": "exclusive",
                    "description": "string",
                    "taxId": "string"
                }
            ],
            "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
            "isSetupFeeItem": True,
            "type": "one_time",
            "taxInclusive": True
        }
    ],
    "termsNotes": "<p>This is a default terms.</p>",
    "title": "INVOICE",
    "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"
        ]
    },
    "invoiceNumber": "1001",
    "issueDate": "2023-01-01",
    "dueDate": "2023-01-14",
    "sentTo": {
        "email": [
            "alex@example.com"
        ],
        "emailCc": [
            "alex@example.com"
        ],
        "emailBcc": [
            "alex@example.com"
        ],
        "phoneNo": [
            "+1-214-559-6993"
        ]
    },
    "liveMode": True,
    "automaticTaxesEnabled": True,
    "paymentSchedule": {
        "type": "percentage",
        "schedules": [
            "string"
        ]
    },
    "lateFeesConfiguration": {
        "enable": True,
        "value": 10,
        "type": "fixed",
        "frequency": {
            "intervalCount": 10,
            "interval": "day"
        },
        "grace": {
            "intervalCount": 10,
            "interval": "day"
        },
        "maxLateFees": {
            "type": "fixed",
            "value": "10"
        }
    },
    "tipsConfiguration": {
        "tipsPercentage": [
            5,
            10,
            15
        ],
        "tipsEnabled": True
    },
    "invoiceNumberPrefix": "INV-",
    "paymentMethods": {
        "stripe": {
            "enableBankDebitOnly": False
        }
    },
    "attachments": [
        {
            "id": "6241712be68f7a98102ba272",
            "name": "Electronics.pdf",
            "url": "https://example.com/digital-delivery",
            "type": "string",
            "size": 10000
        }
    ],
    "miscellaneousCharges": {
        "charges": [
            [
                "value"
            ]
        ],
        "collectedMiscellaneousCharges": 10,
        "paidCharges": [
            {
                "name": "Processing Fee",
                "charge": 10,
                "amount": 10,
                "_id": "673d01d7d547648a8dab6211"
            }
        ]
    },
    "id": "string",
    "includeTermsNote": True,
    "action": "draft",
    "userId": "string",
    "discount": {
        "value": 10,
        "type": "percentage",
        "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
    },
    "businessDetails": {
        "logoUrl": "https://example.com/logo.png",
        "name": "ABC Corp.",
        "phoneNo": "+1-214-559-6993",
        "address": {
            "addressLine1": "9931 Beechwood",
            "addressLine2": "Beechwood",
            "city": "St. Houston",
            "state": "TX",
            "countryCode": "US",
            "postalCode": "559-6993"
        },
        "website": "wwww.example.com",
        "customValues": [
            "string"
        ]
    }
}

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

print(response.json())

Response example — 200

Response example
200 response JSON
{
  "invoice": {
    "_id": "6578278e879ad2646715ba9c",
    "status": "draft",
    "liveMode": false,
    "amountPaid": 0,
    "altId": "6578278e879ad2646715ba9c",
    "altType": "location",
    "name": "New Invoice",
    "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"
    },
    "invoiceNumber": "19",
    "currency": "USD",
    "contactDetails": {
      "id": "c6tZZU0rJBf30ZXx9Gli",
      "phoneNo": "+1-214-559-6993",
      "email": "alex@example.com",
      "customFields": [],
      "name": "Alex",
      "address": {
        "countryCode": "US"
      }
    },
    "issueDate": "2023-01-01",
    "dueDate": "2023-01-01",
    "discount": {
      "type": "percentage",
      "value": 0
    },
    "invoiceItems": [
      {
        "taxes": [],
        "_id": "c6tZZU0rJBf30ZXx9Gli",
        "productId": "c6tZZU0rJBf30ZXx9Gli",
        "priceId": "c6tZZU0rJBf30ZXx9Gli",
        "currency": "USD",
        "name": "Macbook Pro",
        "qty": 1,
        "amount": 999
      }
    ],
    "total": 999,
    "title": "INVOICE",
    "amountDue": 999,
    "createdAt": "2023-12-12T09:27:42.355Z",
    "updatedAt": "2023-12-12T09:27:42.355Z",
    "automaticTaxesEnabled": true,
    "automaticTaxesCalculated": true,
    "paymentSchedule": {}
  },
  "invoiceUrl": "string"
}