Skip to main content
API to create an invoice
POST https://services.leadconnectorhq.com/invoices/

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

altId
string
default:"6578278e879ad2646715ba9c"
required
account Id / company Id based on altType
altType
string
default:"account"
required
Alt Type Posibles valores: ‘account’
name
string
default:"New Invoice"
required
Invoice Name
businessDetails
object
required
currency
string
default:"USD"
required
Currency code
items
object[]
required
An array of items for the invoice.
discount
object
required
termsNotes
string
default:"<p>This is a default terms.</p>"
Terms notes, Also supports HTML markups
title
string
default:"INVOICE"
Title for the invoice
contactDetails
object
required
Contact information to send the invoice to
invoiceNumber
string
default:"1001"
Invoice Number
issueDate
string
default:"2023-01-01"
required
Issue date in YYYY-MM-DD format
dueDate
string
default:"2023-01-14"
Due date in YYYY-MM-DD format
sentTo
object
required
liveMode
boolean
required
automaticTaxesEnabled
boolean
default:"True"
Automatic taxes enabled for the Invoice
paymentSchedule
object
split invoice into payment schedule summing up to full invoice amount
lateFeesConfiguration
object
late fees configuration
tipsConfiguration
object
tips configuration for the invoice
invoiceNumberPrefix
string
default:"INV-"
prefix for invoice number
paymentMethods
object
Payment Methods for Invoices
attachments
object[]
attachments for the invoice
miscellaneousCharges
object
miscellaneous charges for the invoice

Respuestas

_id
string
default:"6578278e879ad2646715ba9c"
required
Invoice Id
status
string
default:"draft"
required
Invoice Status Posibles valores: ‘draft’, ‘sent’, ‘payment_processing’, ‘paid’, ‘void’, ‘partially_paid’
liveMode
boolean
default:"False"
required
Live Mode
amountPaid
number
default:"0"
required
Amount Paid
altId
string
default:"6578278e879ad2646715ba9c"
required
Account Id or Agency Id
altType
string
required
Posibles valores: ‘account’
name
string
default:"New Invoice"
required
Name of the invoice
businessDetails
object
required
Business Details
invoiceNumber
number
default:"19"
required
Invoice Number
currency
string
default:"USD"
required
Currency
contactDetails
object
required
Contact Details
issueDate
string
default:"2023-01-01"
required
Issue date in YYYY-MM-DD format
dueDate
string
default:"2023-01-01"
required
Due date in YYYY-MM-DD format
discount
object
Discount
invoiceItems
string[]
required
Invoice Items
total
number
default:"999"
required
Total Amount
title
string
default:"INVOICE"
required
Title
amountDue
number
default:"999"
required
Total Amount Due
createdAt
string
default:"2023-12-12T09:27:42.355Z"
required
created at
updatedAt
string
default:"2023-12-12T09:27:42.355Z"
required
updated at
automaticTaxesEnabled
boolean
default:"True"
Automatic taxes enabled for the Invoice
automaticTaxesCalculated
boolean
default:"True"
Is Automatic taxes calculated for the Invoice items
paymentSchedule
object
split invoice into payment schedule summing up to full invoice amount
{
  "_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
  },
  "invoiceItems": [
  // truncado: 20 lineas mas
}
{}
{}
{}

Ejemplo

curl -X POST 'https://services.leadconnectorhq.com/invoices/' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "account",
  "name": "New Invoice",
  "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": "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
    }
  ],
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "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
    }
  ]
}'
const response = await fetch('https://services.leadconnectorhq.com/invoices/', {
  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": "New Invoice", "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": "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}], "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "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}]}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'POST',
    'https://services.leadconnectorhq.com/invoices/',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "New Invoice", "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": "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}], "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "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}]},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/invoices/');
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': 'New Invoice', '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': '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}], 'discount': {'value': 10, 'type': 'percentage', 'validOnProductIds': '[ '6579751d56f60276e5bd4154' ]'}, '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}]}),
]);
$data = json_decode(curl_exec($ch), true);