API / Reference / Customer Credits
Create customer credit
POST
https://api.light.inc/v1/customer-credits
Creates a new customer credit
documentNumber is assigned when the credit is posted, not "when the invoice is opened" as the description says. documentDate is also used as the posting date. lines and areLinesWithTax are required, though lines may be []. Line amounts are { amount, dcSign } objects; for a credit the gross line amount is normally a debit ("dcSign": "D"). Omitted line tax and account fields take the product's defaults for the tax engine in force. Requires a user credential. An X-Idempotency-Key makes retries safe; without one nothing is de-duplicated.
Authorization
Send one of these on every request. See Authentication for how to get credentials.
- API key
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
- Bearer token
Headers
-
X-Idempotency-Keystring
Request body
application/json;charset=UTF-8
-
companyEntityIdstring · uuidID of the entity
-
documentNumberstringUnique customer credit number. If not provided, one will be generated automatically when the invoice is opened.
-
descriptionstringDescription of the customer credit
-
currencystring -
localCurrencyFxRatenumberCustom foreign exchange rate for the ledger's local currency. If not provided Light uses official ECB rates
-
groupCurrencyFxRatenumberCustom foreign exchange rate for the ledger's group currency. If not provided Light uses official ECB rates
-
documentDatestring · dateDate when the customer credit was issued
-
documentTemplateIdstring · uuidID of the document template that the customer credit will use
-
areLinesWithTaxbooleanWhether the customer credit 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
-
customerIdstring · uuidID of the customer
-
amountinteger · int64Total customer credit amount in cents
-
linesarray of objectList of customer credit line items
-
productIdstring · uuidID of the product
-
quantitynumberQuantity of the product
-
netTransactionAmountobject-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
grossTransactionAmountobject-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
taxTransactionAmountobject-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
descriptionstringDescription of the customer credit line item
-
ledgerTaxIdstring · uuidID of the tax code
-
ledgerAccountIdstring · uuidID of the ledger account
-
avataxCodestringAvalara tax code. Used when the customer credit tax engine is AVATAX
-
customPropertiesarray of objectList of custom properties associated with the line
-
groupIdstring · uuid -
valueIdsarray of string · uuidCatalogue value ids for this group. Required; send
[](with an emptyinlineValues) to clear the group.SINGLE_SELECTandMULTI_SELECTgroups accept nothing else. See Custom properties on writes. -
inlineValuesarray of stringLiteral values for
TEXT,NUMERIC,BOOLEANandDATEgroups, as strings (yyyy-MM-ddfor dates). Rejected on select groups withCUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.
-
-
accrualTemplateIdstring · uuidID of the accrual template
-
accrualStartDatestring · dateStart date for accrual
-
accrualEndDatestring · dateEnd date for accrual
-
-
customPropertiesarray of objectList of custom properties associated with the customer credit
-
groupIdstring · uuid -
valueIdsarray of string · uuidCatalogue value ids for this group. Required; send
[](with an emptyinlineValues) to clear the group.SINGLE_SELECTandMULTI_SELECTgroups accept nothing else. See Custom properties on writes. -
inlineValuesarray of stringLiteral values for
TEXT,NUMERIC,BOOLEANandDATEgroups, as strings (yyyy-MM-ddfor dates). Rejected on select groups withCUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.
-
Response
-
idstring · uuidUnique identifier for the object
-
companyIdstring · uuidID of the company
-
companyEntityIdstring · uuidID of the entity
-
amountinteger · int64Total customer credit amount in cents
The header amount available to allocate, independent of the line totals; the link validations compare against it.
-
customerNamestringName of the customer
-
customerIdstring · uuidID of the customer
-
statusstringStatus of the customer credit
⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DRAFTAPPROVAL_PENDINGAPPROVEDPOSTEDPARTIALLY_CLEAREDCLEAREDARCHIVED -
descriptionstringDescription of the customer credit
-
currencystring -
documentDatestring · dateDate when the customer credit was issued
-
valuationDatestring · dateDate used when applying foreign exchange rate
-
areLinesWithTaxbooleanWhether the customer credit 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
-
linesarray of objectList of customer credit line items
-
idstring · uuidUnique identifier for the object
-
companyIdstring · uuidID of the company
-
customerCreditIdstring · uuidID of the customer credit this line belongs to
-
grossTransactionAmountobject-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
netTransactionAmountobject-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
descriptionstringDescription of the customer credit line item
-
ledgerTaxIdstring · uuidID of the tax code
-
taxTransactionAmountobject-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
ledgerAccountIdstring · uuidID of the ledger account
-
avataxCodestringAvalara tax code. Used when the customer credit tax engine is AVATAX
-
productIdstring · uuidID of the product
-
quantitynumberQuantity of the product
-
createdAtstring · date-timeTimestamp when the customer credit was created
-
updatedAtstring · date-timeTimestamp when the customer credit was last updated
-
accrualTemplateIdstring · uuidID of the accrual template
-
accrualStartDatestring · dateStart date for accrual
-
accrualEndDatestring · dateEnd date for accrual
-
accrualDefaultDurationinteger · int32Default duration for accrual in months
-
-
createdAtstring · date-timeTimestamp when the customer credit was created
-
updatedAtstring · date-timeTimestamp when the customer credit was last updated
-
updatedBystring · uuidID of the user who last updated the customer credit
-
linkedInvoiceReceivableobjectInvoice payable details
The linked invoice receivable (the description says payable).
nullwhen there are no links or more than one; on the list endpoint alsonullunlessinclude=INVOICE_RECEIVABLE.-
idstring · uuidUnique identifier for the object
-
documentNumberstringDocument number
-
documentDatestring · dateDate the accounting document was issued
-
statusstringStatus of the accounting document
⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DRAFTAPPROVAL_PENDINGAPPROVEDPOSTEDPARTIALLY_CLEAREDCLEAREDARCHIVED -
amountinteger · int64The amount of the accounting document in cents
-
currencystring
-