> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Vendor credit object

A Vendor Credit represents a transaction that reduces accounts payable to a vendor, typically due to returned goods.
Each vendor credit has one or more line items specifying credited expense accounts, and zero or more allocations applying portions of the credit to bills.

### Attributes

<ParamField body="id" type="string" required="true">
  Unique identifier for the vendor credit.
</ParamField>

<ParamField body="external_id" type="string">
  Unique ID of the vendor credit in your system for linking purposes. **Idempotency key**.
</ParamField>

<ParamField body="vendor" type="Vendor object" required="true">
  The [Vendor](/api-reference/vendor/vendor) associated with this credit.
</ParamField>

<ParamField body="received_at" type="ISO8601 timestamp" required="true">
  Time when the vendor credit was received.
</ParamField>

<ParamField body="line_items" type="array of VendorCreditLineItem objects" required="true">
  Line items included in this vendor credit. See [Vendor Credit Line Item Object](#vendor-credit-line-item-object) for details.
</ParamField>

<ParamField body="allocations" type="array of VendorCreditAllocation objects">
  Allocations of this vendor credit to bills. See [Vendor Credit Allocation Object](#vendor-credit-allocation-object) for details.
</ParamField>

<ParamField body="created_at" type="ISO8601 timestamp" required="true">
  Time when the vendor credit was created in Layer.
</ParamField>

<ParamField body="updated_at" type="ISO8601 timestamp" required="true">
  Time when the vendor credit was last updated in Layer.
</ParamField>

<ParamField body="deleted_at" type="ISO8601 timestamp">
  Time when the vendor credit was deleted, if applicable.
</ParamField>

<ParamField body="transaction_tags" type="Array of Tags">
  Tags associated with the vendor credit.

  <Expandable title="Tag properties">
    <ResponseField name="key" required="true" type="string">
      The tag's key
    </ResponseField>

    <ResponseField name="value" required="true" type="string">
      The tag's value
    </ResponseField>

    <ResponseField name="created_at" required="true" type="ISO8601 timestamp">
      When the tag was created
    </ResponseField>

    <ResponseField name="updated_at" required="true" type="ISO8601 timestamp">
      When the tag was last updated
    </ResponseField>

    <ResponseField name="deleted_at" type="ISO8601 timestamp">
      When the tag was deleted
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="metadata" type="json object">
  Arbitrary metadata you can include with the vendor credit
</ParamField>

<ParamField body="reference_number" type="string">
  Any (typically user-visible) identifier you would like to associate with the vendor credit. Can be used to filter when listing vendor credits.
</ParamField>

### Vendor Credit Line Item Object

A Vendor Credit Line Item represents an individual expense account being credited by the Vendor Credit.

<ParamField body="id" type="string" required="true">
  Unique identifier for the vendor credit line item.
</ParamField>

<ParamField body="ledger_account" type="SingleApiChartAccount object">
  [Ledger account](/api-reference/ledger/chart#ledger-account-object) associated with this line item. This is what you're specifying with the 'expense\_account\_identifier' in the create parameters.
</ParamField>

<ParamField body="amount" type="integer" required="true">
  Amount for the line item in cents.
</ParamField>

<ParamField body="memo" type="string">
  Description or notes for the line item.
</ParamField>

<ParamField body="metadata" type="json object">
  Arbitrary metadata you can include with the vendor credit line item
</ParamField>

<ParamField body="reference_number" type="string">
  Any (typically user-visible) identifier you would like to associate with the vendor credit line item.
</ParamField>

### Vendor Credit Allocation Object

A Vendor Credit Allocation represents how a portion of a vendor credit is applied to a specific bill. By allocating vendor credits to bills, the amount owed to vendors can be reduced accordingly.

<ParamField body="id" type="string" required="true">
  Unique identifier for the vendor credit allocation.
</ParamField>

<ParamField body="vendor_credit_id" type="string" required="true">
  ID of the vendor credit this allocation belongs to.
</ParamField>

<ParamField body="bill_id" type="string" required="true">
  ID of the bill this allocation is for.
</ParamField>

<ParamField body="amount" type="integer" required="true">
  Amount of the allocation in cents.
</ParamField>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "external_id": "vc001",
      "vendor": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "external_id": "abc123",
        "individual_name": null,
        "company_name": "Vanguard Commercial Real Estate",
        "email": null,
        "mobile_phone": null,
        "office_phone": null,
        "address_string": null,
        "notes": null,
        "status": "ACTIVE",
        "transaction_tags": [
          {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "key": "ExampleTagKey",
            "value": "ExampleTagValue",
            "created_at": "2023-11-07T05:31:56Z",
            "updated_at": "2023-11-07T05:31:56Z",
            "deleted_at": null
          }
        ]
      },
      "received_at": "2023-11-07T05:31:56Z",
      "line_items": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "ledger_account": {
            "id": {
              "type": "AccountId",
              "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
            },
            "name": "Rent",
            "stable_name": {
              "type": "StableName",
              "stable_name": "RENT"
            },
            "normality": "DEBIT",
            "account_type": {
              "value": "EXPENSE",
              "display_name": "Expense"
            },
            "account_subtype": {
              "value": "OPERATING_EXPENSES",
              "display_name": "Operating Expenses"
            }
          },
          "amount": 123,
          "memo": null
        }
      ],
      "allocations": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "vendor_credit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "amount": 123
        }
      ],
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "deleted_at": null,
      "transaction_tags": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "key": "ExampleTagKey",
          "value": "ExampleTagValue",
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "deleted_at": null
        }
      ],
      "metadata": null
    }
  }
  ```
</ResponseExample>
