API to create or update a text2pay invoice

http
POST https://services.leadconnectorhq.com/invoices/text2pay

Authorization

NameTypeRequiredExampleDescription
AuthorizationstringYesBearer token generated from the Leadway portal. See Authentication.
VersionstringYes2021-07-28API version.

Body

NameTypeRequiredExampleDescription
altIdstringYes6578278e879ad2646715ba9caccount Id / company Id based on altType
altTypestringYesaccountAlt Type Possible values: 'account'
namestringYesNew InvoiceInvoice Name
currencystringYesUSDCurrency code
  • items (object[], required): An array of items for the invoice.

    • name (string, required): Invoice Item Name Example: ABC Product

    • description (string): Invoice descriptions Example: ABC Corp.

    • productId (string): Product Id Example: 6578278e879ad2646715ba9c

    • priceId (string): Price Id Example: 6578278e879ad2646715ba9c

    • currency (string, required): Currency Example: USD

    • amount (number, required): Product amount Example: 999

    • qty (number, required): Product Quantity Example: 1

    • taxes (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: 6578278e879ad2646715ba9c

    • isSetupFeeItem (boolean): Setupfee item, only created when 1st invoice of recurring schedule is generated

    • type (string): Price type of the item Possible values: 'one_time', 'recurring' Example: one_time

    • taxInclusive (boolean): true if item amount is tax inclusive Example: True

NameTypeRequiredExampleDescription
termsNotesstringNo<p>This is a default terms.</p>Terms notes, Also supports HTML markups
titlestringNoINVOICETitle for the invoice
contactDetailsobjectYesContact information to send the invoice to
invoiceNumberstringNo1001Invoice Number
issueDatestringYes2023-01-01Issue date in YYYY-MM-DD format
dueDatestringNo2023-01-14Due date in YYYY-MM-DD format
  • sentTo (object, required)

    • email (string[], required): Email Address

    • emailCc (string[]): cc to be kept in any sent out emails

    • emailBcc (string[]): bcc to be kept in any sent out emails

    • phoneNo (string[]): Contact Phone Number

NameTypeRequiredExampleDescription
liveModebooleanYes
automaticTaxesEnabledbooleanNoTrueAutomatic taxes enabled for the Invoice
paymentScheduleobjectNosplit invoice into payment schedule summing up to full invoice amount
lateFeesConfigurationobjectNolate fees configuration
tipsConfigurationobjectNotips configuration for the invoice
invoiceNumberPrefixstringNoINV-prefix for invoice number
paymentMethodsobjectNoPayment Methods for Invoices
  • attachments (object[]): attachments for the invoice

    • id (string, required): Id of the file selected Example: 6241712be68f7a98102ba272

    • name (string, required): Name of the file Example: Electronics.pdf

    • url (string, required): URL of the file Example: https://example.com/digital-delivery

    • type (string, required): Type of the file

    • size (number, required): Size of the file Example: 10000

NameTypeRequiredExampleDescription
miscellaneousChargesobjectNomiscellaneous charges for the invoice
idstringNoid of invoice to update. If skipped, a new invoice will be created
includeTermsNotebooleanNoTrueinclude terms & notes with receipts
actionstringYesdraftcreate invoice in draft mode or send mode Possible values: 'draft', 'send'
userIdstringYesid of user generating invoice
  • discount (object)

    • value (number): Discount Value Example: 10

    • type (string, required): Discount type Possible values: 'percentage', 'fixed' Example: percentage

    • validOnProductIds (string[]): Product Ids on which discount is applicable Example: [ '6579751d56f60276e5bd4154' ]

  • businessDetails (object)

    • logoUrl (string): Business Logo URL Example: https://example.com/logo.png

    • name (string): Business Name Example: ABC Corp.

    • phoneNo (string): Business Phone Number Example: +1-214-559-6993

    • address (object): Business Address Example: 9931 Beechwood, TX

    • website (string): Business Website Link Example: wwww.example.com

    • customValues (string[]): Custom Values

Responses

200 - Successful response
  • invoice (object, required)

    • _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

  • invoiceUrl (string, required): preview url of generated invoice

json
{
  "invoice": {
    "_id": "6578278e879ad2646715ba9c",
    "status": "draft",
    "liveMode": false,
    "amountPaid": 0,
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "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
    },
  // truncado: 23 lineas mas
}
400 - Bad Request
json
{}
401 - Unauthorized
json
{}
422 - Unprocessable Entity
json
{}

Example

curl -X POST 'https://services.leadconnectorhq.com/invoices/text2pay' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "account",
  "name": "New Invoice",
  "currency": "USD",
  "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
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "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,
  "invoiceNumberPrefix": "INV-",
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "type": "string",
      "size": 10000
    }
  ],
  "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": "9931 Beechwood, TX",
    "website": "wwww.example.com",
    "customValues": [
      "string"
    ]
  }
}'

Last updated October 26, 2026

Was this page helpful?