# Create customer credit

> Creates a new customer credit

`POST https://api.light.inc/v1/customer-credits`

## Note

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

- API key
- Bearer token

See https://light.inc/docs/getting-started/authentication.

## Header parameters

- `X-Idempotency-Key` (string)

## Request body

`application/json;charset=UTF-8`

- `lines.netTransactionAmount.amount` — Unsigned integer in minor units. The direction is in `dcSign`; a negative value is rejected.
- `lines.grossTransactionAmount.amount` — Unsigned integer in minor units. The direction is in `dcSign`; a negative value is rejected.
- `lines.taxTransactionAmount.amount` — Unsigned integer in minor units. The direction is in `dcSign`; a negative value is rejected.
- `lines.customProperties.valueIds` — Catalog 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](/docs/getting-started/pagination-filtering-errors#custom-properties-on-writes).
- `lines.customProperties.inlineValues` — 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](/docs/getting-started/pagination-filtering-errors#custom-properties-on-writes).
- `customProperties.valueIds` — Catalog 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](/docs/getting-started/pagination-filtering-errors#custom-properties-on-writes).
- `customProperties.inlineValues` — 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](/docs/getting-started/pagination-filtering-errors#custom-properties-on-writes).

```json
{
  "companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "documentNumber": "string",
  "description": "string",
  "currency": "USD",
  "localCurrencyFxRate": 0,
  "groupCurrencyFxRate": 0,
  "documentDate": "2026-01-15",
  "postingDate": "2026-01-15",
  "documentTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "areLinesWithTax": true,
  "customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "amount": 100000,
  "lines": [
    {
      "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "quantity": 0,
      "netTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "grossTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "taxTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "description": "string",
      "ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "avataxCode": "string",
      "customProperties": [
        {
          "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "valueIds": [
            "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          ],
          "inlineValues": [
            "string"
          ]
        }
      ],
      "accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accrualStartDate": "2026-01-15",
      "accrualEndDate": "2026-01-15"
    }
  ],
  "customProperties": [
    {
      "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "valueIds": [
        "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      ],
      "inlineValues": [
        "string"
      ]
    }
  ]
}
```

Values above are generated from the schema: the shapes and types are real, the values are placeholders, and fields that exclude each other are all shown. Do not send it unchanged.

## Response

- `amount` — The header amount available to allocate, independent of the line totals; the link validations compare against it.
- `lines.grossTransactionAmount.amount` — Unsigned integer in minor units. The direction is in `dcSign`; a negative value is rejected.
- `lines.netTransactionAmount.amount` — Unsigned integer in minor units. The direction is in `dcSign`; a negative value is rejected.
- `lines.taxTransactionAmount.amount` — Unsigned integer in minor units. The direction is in `dcSign`; a negative value is rejected.
- `linkedInvoiceReceivable` — The linked **invoice receivable** (the description says payable). Omitted when there are no links or more than one; on the list endpoint also omitted unless `include=INVOICE_RECEIVABLE`.

```json
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "amount": 100000,
  "customerName": "string",
  "customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "DRAFT",
  "description": "string",
  "currency": "USD",
  "documentDate": "2026-01-15",
  "postingDate": "2026-01-15",
  "valuationDate": "2026-01-15",
  "areLinesWithTax": true,
  "lines": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "customerCreditId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "grossTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "netTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "description": "string",
      "ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "taxTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "avataxCode": "string",
      "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "quantity": 0,
      "createdAt": "2026-01-15T09:30:00Z",
      "updatedAt": "2026-01-15T09:30:00Z",
      "accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accrualStartDate": "2026-01-15",
      "accrualEndDate": "2026-01-15",
      "accrualDefaultDuration": 0
    }
  ],
  "createdAt": "2026-01-15T09:30:00Z",
  "updatedAt": "2026-01-15T09:30:00Z",
  "updatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "paymentReference": "string",
  "linkedInvoiceReceivable": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "documentNumber": "string",
    "documentDate": "2026-01-15",
    "postingDate": "2026-01-15",
    "status": "DRAFT",
    "amount": 100000,
    "currency": "USD"
  }
}
```

Values above are generated from the schema: the shapes and types are real, the values are placeholders.

## Code

```bash
# Set LIGHT_IDEMPOTENCY_KEY to a key saved for this operation; reuse it on retries.
curl -X POST "https://api.light.inc/v1/customer-credits" \
  -H "Authorization: Basic YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: ${LIGHT_IDEMPOTENCY_KEY:?Set a saved key for this operation}" \
  -d '{
  "companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "documentNumber": "string",
  "description": "string",
  "currency": "USD",
  "localCurrencyFxRate": 0,
  "groupCurrencyFxRate": 0,
  "documentDate": "2026-01-15",
  "postingDate": "2026-01-15",
  "documentTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "areLinesWithTax": true,
  "customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "amount": 100000,
  "lines": [
    {
      "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "quantity": 0,
      "netTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "grossTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "taxTransactionAmount": {
        "amount": 100000,
        "dcSign": "D"
      },
      "description": "string",
      "ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "avataxCode": "string",
      "customProperties": [
        {
          "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "valueIds": [
            "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          ],
          "inlineValues": [
            "string"
          ]
        }
      ],
      "accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "accrualStartDate": "2026-01-15",
      "accrualEndDate": "2026-01-15"
    }
  ],
  "customProperties": [
    {
      "groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "valueIds": [
        "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      ],
      "inlineValues": [
        "string"
      ]
    }
  ]
}'
```

---

Full page: https://light.inc/docs/api-reference/v1--customer-credits/create-customer-credit · Index: https://light.inc/docs/llms.txt
