Skip to main content
POST
/
v1
/
invoice-receivables
Create invoice
curl --request POST \
  --url https://api.light.inc/v1/invoice-receivables \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json;charset=UTF-8' \
  --data '
{
  "companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceNumber": "<string>",
  "description": "<string>",
  "currency": "USD",
  "paymentType": "BANK_TRANSFER",
  "payeeBankAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceDate": "2023-12-25",
  "dueDate": "2023-12-25",
  "customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "netTerms": 123,
  "poNumber": "<string>",
  "invoiceTemplateAdditionalText": "<string>",
  "areLinesWithTax": true,
  "localCurrencyFxRate": 123,
  "groupCurrencyFxRate": 123,
  "lines": [
    {
      "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "quantity": 1,
      "taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "discount": {
        "type": "PERCENTAGE"
      },
      "priceOverwrite": 123,
      "productNameOverwrite": "<string>",
      "taxAmountOverwrite": 123,
      "avataxCode": "<string>",
      "billingStart": "2023-12-25",
      "billingEnd": "2023-12-25",
      "accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accrualStartDate": "2023-12-25",
      "accrualEndDate": "2023-12-25",
      "customProperties": [
        {
          "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "valueIds": [
            "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          ],
          "inlineValues": [
            "<string>"
          ]
        }
      ]
    }
  ],
  "customProperties": [
    {
      "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "valueIds": [
        "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      ],
      "inlineValues": [
        "<string>"
      ]
    }
  ]
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "amount": 123,
  "paymentType": "BANK_TRANSFER",
  "payeeBankAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceDate": "2023-12-25",
  "dueDate": "2023-12-25",
  "netTerms": 123,
  "customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceTemplateAdditionalText": "<string>",
  "invoiceNumber": "<string>",
  "state": "DRAFT",
  "openedAt": "2023-11-07T05:31:56Z",
  "poNumber": "<string>",
  "description": "<string>",
  "currency": "USD",
  "taxEngineName": "AVATAX",
  "areLinesWithTax": true,
  "localCurrencyFxRate": 123,
  "groupCurrencyFxRate": 123,
  "lines": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoiceReceivableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "quantity": 123,
      "taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "discount": {
        "type": "PERCENTAGE"
      },
      "discountAmount": 123,
      "netAmount": 123,
      "taxAmount": 123,
      "avataxCode": "<string>",
      "billingStart": "2023-12-25",
      "billingEnd": "2023-12-25",
      "priceOverwrite": 123,
      "productNameOverwrite": "<string>",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accrualStartDate": "2023-12-25",
      "accrualEndDate": "2023-12-25",
      "customProperties": [
        {
          "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "groupInternalName": "<string>",
          "values": [
            {
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "groupInternalName": "<string>",
              "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "internalName": "<string>",
              "label": "<string>",
              "context": "<string>",
              "createdAt": "2023-11-07T05:31:56Z",
              "updatedAt": "2023-11-07T05:31:56Z"
            }
          ]
        }
      ]
    }
  ],
  "customProperties": [
    {
      "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "groupInternalName": "<string>",
      "values": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "groupInternalName": "<string>",
          "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "internalName": "<string>",
          "label": "<string>",
          "context": "<string>",
          "createdAt": "2023-11-07T05:31:56Z",
          "updatedAt": "2023-11-07T05:31:56Z"
        }
      ]
    }
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "updatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "failureContext": {
    "name": "<string>",
    "type": "BAD_REQUEST",
    "errors": [
      {
        "type": "<string>",
        "message": "<string>",
        "path": [
          "<string>"
        ],
        "context": {}
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.

Headers

X-Idempotency-Key
string

Body

application/json;charset=UTF-8
companyEntityId
string<uuid>

ID of the company entity

invoiceNumber
string | null

Unique invoice number. If not provided, one will be generated automatically when the invoice is opened.

description
string | null

Invoice description

currency
string | null
Example:

"USD"

paymentType
enum<string> | null

Payment type for the invoice

  • BANK_TRANSFER - Payment via bank transfer. Bank information will be displayed on the invoice
  • STRIPE - Payment via Stripe. A payment link will be sent to the customer

⚠️ This enum is not exhaustive; new values may be added in the future.

Available options:
BANK_TRANSFER,
STRIPE
payeeBankAccountId
string<uuid> | null

ID of the bank account where money should be sent to

invoiceDate
string<date> | null

Date the invoice was issued

dueDate
string<date> | null

Date the invoice payment is due

customerId
string<uuid> | null

ID of the customer

invoiceTemplateId
string<uuid> | null

ID of the invoice template

netTerms
integer<int32> | null

Number of days from the invoice date to when the invoice is due. Setting this will automatically calculate the due date

poNumber
string | null

Purchase order number

invoiceTemplateAdditionalText
string | null

Text that will be added to the additional text section of the invoice template

areLinesWithTax
boolean
default:true

Whether the invoice line amounts are inclusive of tax. True means tax is included in the line amount, false means tax will be added on top

localCurrencyFxRate
number | null

Custom foreign exchange rate for the ledger's local currency. If not provided, Light uses official ECB rates

groupCurrencyFxRate
number | null

Custom foreign exchange rate for the ledger's group currency. If not provided, Light uses official ECB rates

lines
object[] | null

List of invoice line items to create

customProperties
(object | null)[] | null

List of custom properties to set on the invoice or line

List of custom properties to set on the vendor. Replaces the existing set.

Response

default - application/json;charset=UTF-8

default response

id
string<uuid>

Unique identifier for the object

companyId
string<uuid>

ID of the company

contractId
string<uuid> | null

ID of the contract, if this is invoice is linked to a contract

companyEntityId
string<uuid> | null

ID of the entity

amount
integer<int64>

Total invoice amount in cents, with discounts and tax applied

paymentType
enum<string> | null

Payment type for the invoice

  • BANK_TRANSFER - Payment via bank transfer. Bank information will be displayed on the invoice
  • STRIPE - Payment via Stripe. A payment link will be sent to the customer

⚠️ This enum is not exhaustive; new values may be added in the future.

Available options:
BANK_TRANSFER,
STRIPE
payeeBankAccountId
string<uuid> | null

ID of the bank account where money should be sent to

invoiceDate
string<date> | null

Date the invoice was issued

dueDate
string<date> | null

Date the invoice payment is due

netTerms
integer<int32> | null

Number of days from the invoice date to when the invoice is due. Updating this field will automatically set the invoice due date

customerId
string<uuid> | null

ID of the customer

invoiceTemplateId
string<uuid> | null

ID of the invoice template

invoiceTemplateAdditionalText
string | null

Text that will added to the additional text section of the invoice template

invoiceNumber
string | null

Invoice number. This number is guaranteed to be unique and sequential per entity. By default Light will generate this number when the invoice is opened, but you can provide your own custom number when creating or updating a draft invoice

state
enum<string>

The invoice state

  • DRAFT - The invoice is in draft and can be modified. Next valid states are OPEN_IN_PROGRESS or ARCHIVED
  • OPEN_IN_PROGRESS - The invoice is being opened. Next valid state is OPEN or DRAFT
  • OPEN - The invoice is open. Next valid states are PAYMENT_PENDING, PARTIALLY_PAID, PAID or ARCHIVED
  • PAYMENT_PENDING - The payment was initiated by Light and is waiting to be collected. Next valid state is PAID
  • PARTIALLY_PAID - The invoice is partially paid. Next valid state is PAID
  • PAID - The invoice is fully paid
  • ARCHIVED - The invoice is archived and cannot be modified

⚠️ This enum is not exhaustive; new values may be added in the future.

Available options:
DRAFT,
OPEN_IN_PROGRESS,
OPEN,
PAYMENT_PENDING,
PARTIALLY_PAID,
PAID,
ARCHIVED
openedAt
string<date-time> | null

Timestamp when the invoice was opened

poNumber
string | null

Purchase order number

description
string | null

Description of the invoice

currency
string
Example:

"USD"

taxEngineName
enum<string>

Name of the tax engine to be used

  • AVATAX - Avalara AvaTax will be used for tax calculations
  • LIGHT - Light built-in tax engine will be used for tax calculations
  • SPHERE - Sphere tax engine will be used for tax calculations

⚠️ This enum is not exhaustive; new values may be added in the future.

Available options:
AVATAX,
LIGHT,
SPHERE
areLinesWithTax
boolean

Whether the invoice line amount is inclusive of tax or not. True means tax is already included in the line amount and will not be added on top, false means tax will be added on top of the line amount

localCurrencyFxRate
number | null

Custom foreign exchange rate for the ledger's local currency. If not provided Light uses official ECB rates

groupCurrencyFxRate
number | null

Custom foreign exchange rate for the ledger's group currency. If not provided Light uses official ECB rates

lines
object[] | null

List of invoice line items. This is only returned when fetching a single invoice by id

customProperties
(object | null)[] | null

List of custom properties associated with the invoice

Custom properties set on the vendor.

createdAt
string<date-time>

Timestamp when the invoice was created

updatedAt
string<date-time>

Timestamp when the invoice was last updated

updatedBy
string<uuid> | null

ID of the user who last updated the invoice

failureContext
object

Failure context when vendor onboarding fails.