Light APIv1.0.0

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-Key string

Request body

application/json;charset=UTF-8

  • companyEntityId string · uuid

    ID of the entity

  • documentNumber string

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

  • description string

    Description of the customer credit

  • currency string

  • localCurrencyFxRate number

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

  • groupCurrencyFxRate number

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

  • documentDate string · date

    Date when the customer credit was issued

  • documentTemplateId string · uuid

    ID of the document template that the customer credit will use

  • areLinesWithTax boolean

    Whether 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

  • customerId string · uuid

    ID of the customer

  • amount integer · int64

    Total customer credit amount in cents

  • lines array of object

    List of customer credit line items

    • productId string · uuid

      ID of the product

    • quantity number

      Quantity of the product

    • netTransactionAmount object

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

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

        One of D C

    • grossTransactionAmount object

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

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

        One of D C

    • taxTransactionAmount object

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

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

        One of D C

    • description string

      Description of the customer credit line item

    • ledgerTaxId string · uuid

      ID of the tax code

    • ledgerAccountId string · uuid

      ID of the ledger account

    • avataxCode string

      Avalara tax code. Used when the customer credit tax engine is AVATAX

    • customProperties array of object

      List of custom properties associated with the line

      • groupId string · uuid

      • valueIds array of string · uuid

        Catalogue value ids for this group. Required; send [] (with an empty inlineValues) to clear the group. SINGLE_SELECT and MULTI_SELECT groups accept nothing else. See Custom properties on writes.

      • inlineValues array of string

        Literal values for TEXT, NUMERIC, BOOLEAN and DATE groups, as strings (yyyy-MM-dd for dates). Rejected on select groups with CUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.

    • accrualTemplateId string · uuid

      ID of the accrual template

    • accrualStartDate string · date

      Start date for accrual

    • accrualEndDate string · date

      End date for accrual

  • customProperties array of object

    List of custom properties associated with the customer credit

    • groupId string · uuid

    • valueIds array of string · uuid

      Catalogue value ids for this group. Required; send [] (with an empty inlineValues) to clear the group. SINGLE_SELECT and MULTI_SELECT groups accept nothing else. See Custom properties on writes.

    • inlineValues array of string

      Literal values for TEXT, NUMERIC, BOOLEAN and DATE groups, as strings (yyyy-MM-dd for dates). Rejected on select groups with CUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.

Response

  • id string · uuid

    Unique identifier for the object

  • companyId string · uuid

    ID of the company

  • companyEntityId string · uuid

    ID of the entity

  • amount integer · int64

    Total customer credit amount in cents

    The header amount available to allocate, independent of the line totals; the link validations compare against it.

  • customerName string

    Name of the customer

  • customerId string · uuid

    ID of the customer

  • status string

    Status of the customer credit

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

    One of DRAFT APPROVAL_PENDING APPROVED POSTED PARTIALLY_CLEARED CLEARED ARCHIVED

  • description string

    Description of the customer credit

  • currency string

  • documentDate string · date

    Date when the customer credit was issued

  • valuationDate string · date

    Date used when applying foreign exchange rate

  • areLinesWithTax boolean

    Whether 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

  • lines array of object

    List of customer credit line items

    • id string · uuid

      Unique identifier for the object

    • companyId string · uuid

      ID of the company

    • customerCreditId string · uuid

      ID of the customer credit this line belongs to

    • grossTransactionAmount object

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

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

        One of D C

    • netTransactionAmount object

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

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

        One of D C

    • description string

      Description of the customer credit line item

    • ledgerTaxId string · uuid

      ID of the tax code

    • taxTransactionAmount object

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

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

        One of D C

    • ledgerAccountId string · uuid

      ID of the ledger account

    • avataxCode string

      Avalara tax code. Used when the customer credit tax engine is AVATAX

    • productId string · uuid

      ID of the product

    • quantity number

      Quantity of the product

    • createdAt string · date-time

      Timestamp when the customer credit was created

    • updatedAt string · date-time

      Timestamp when the customer credit was last updated

    • accrualTemplateId string · uuid

      ID of the accrual template

    • accrualStartDate string · date

      Start date for accrual

    • accrualEndDate string · date

      End date for accrual

    • accrualDefaultDuration integer · int32

      Default duration for accrual in months

  • createdAt string · date-time

    Timestamp when the customer credit was created

  • updatedAt string · date-time

    Timestamp when the customer credit was last updated

  • updatedBy string · uuid

    ID of the user who last updated the customer credit

  • linkedInvoiceReceivable object

    Invoice payable details

    The linked invoice receivable (the description says payable). null when there are no links or more than one; on the list endpoint also null unless include=INVOICE_RECEIVABLE.

    • id string · uuid

      Unique identifier for the object

    • documentNumber string

      Document number

    • documentDate string · date

      Date the accounting document was issued

    • status string

      Status of the accounting document

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

      One of DRAFT APPROVAL_PENDING APPROVED POSTED PARTIALLY_CLEARED CLEARED ARCHIVED

    • amount integer · int64

      The amount of the accounting document in cents

    • currency string