{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/divvy/json-schema/divvy-credit-memo-with-usage-response-dto-schema.json",
  "title": "CreditMemoWithUsageResponseDto",
  "description": "CreditMemo response Dto.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/divvy-credit-memos-api-openapi.yml#/components/schemas/CreditMemoWithUsageResponseDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "BILL-generated ID of the credit memo. The value begins with `ccr`."
    },
    "customerId": {
      "type": "string",
      "description": "BILL-generated ID of the customer. The value begins with `0cu`."
    },
    "referenceNumber": {
      "type": "string",
      "description": "User-generated credit memo number. This value can be in your chosen number scheme."
    },
    "creditDate": {
      "type": "string",
      "description": "Credit memo issued date. This value is in the `yyyy-MM-dd` format.",
      "format": "date"
    },
    "description": {
      "type": "string",
      "description": "Credit memo description"
    },
    "archived": {
      "type": "boolean",
      "description": "Set as `true` if the credit memo is archived"
    },
    "salesTaxItemId": {
      "type": "string",
      "description": "BILL-generated ID of the `SALES_TAX` item. The value begins with `0ii`. The tax rate is applied to all the credit memo line items set as taxable."
    },
    "payToChartOfAccountId": {
      "type": "string",
      "description": "BILL-generated ID of the chart of accounts used when the credit memo is applied to an invoice payment. The value begins with `0ca`."
    },
    "payToBankAccountId": {
      "type": "string",
      "description": "BILL-generated ID of the bank account used when the credit memo is applied to an invoice payment. The value begins with `bac`."
    },
    "amount": {
      "type": "number",
      "description": "Credit memo amount"
    },
    "appliedAmount": {
      "type": "number",
      "description": "Credit memo amount applied to invoices"
    },
    "salesTaxTotal": {
      "type": "number",
      "description": "Credit memo sales tax amount. The value is set based on `salesTaxItemId`."
    },
    "salesTaxPercentage": {
      "type": "number",
      "description": "Credit memo sales tax percentage. The value is set based on `salesTaxItemId`."
    },
    "status": {
      "allOf": [
        {
          "$ref": "#/$defs/CreditStatusDto"
        },
        {
          "description": "Credit memo status."
        }
      ]
    },
    "createdTime": {
      "type": "string",
      "description": "Credit memo created time",
      "format": "date-time"
    },
    "updatedTime": {
      "type": "string",
      "description": "Credit memo updated time",
      "format": "date-time"
    },
    "creditMemoLineItems": {
      "type": "array",
      "description": "Credit memo line item information",
      "items": {
        "$ref": "#/$defs/CreditMemoLineItemResponseDto"
      }
    },
    "classifications": {
      "allOf": [
        {
          "$ref": "#/$defs/InvoiceClassificationsDto"
        },
        {
          "description": "General ledger classifications information for the credit memo"
        }
      ]
    },
    "usage": {
      "type": "array",
      "description": "Credit memo usage information",
      "items": {
        "$ref": "#/$defs/CreditMemoUsageDto"
      }
    }
  },
  "$defs": {
    "CreditMemoLineItemResponseDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "BILL-generated ID of the credit memo line item. The value begins with `cci`."
        },
        "description": {
          "type": "string",
          "description": "Credit memo line item description"
        },
        "price": {
          "type": "number",
          "description": "Credit memo line item unit price. For a credit memo in an international currency (not USD), this value is in the local currency."
        },
        "quantity": {
          "type": "number",
          "description": "Credit memo line item unit quantity"
        },
        "amount": {
          "type": "number",
          "description": "Credit memo line item amount"
        },
        "ratePercent": {
          "type": "number",
          "description": "Credit memo line item rate percent"
        },
        "taxable": {
          "type": "boolean",
          "description": "Set as `true` if the credit memo line item is taxable"
        },
        "classifications": {
          "allOf": [
            {
              "$ref": "#/$defs/InvoiceLineItemClassificationsDto"
            },
            {
              "description": "General ledger classifications information for the credit memo line item"
            }
          ]
        }
      },
      "description": "Credit Memo Create Request Line Item."
    },
    "CreditMemoUsageDto": {
      "type": "object",
      "properties": {
        "invoiceId": {
          "type": "string",
          "description": "BILL-generated ID of the invoice to which the credit memo is applied"
        },
        "amount": {
          "type": "number",
          "description": "Credit memo amount applied to the invoice"
        }
      },
      "description": "CreditMemo usage Dto."
    },
    "CreditStatusDto": {
      "type": "string",
      "description": "Credit Status DTO.",
      "enum": [
        "FULLY_APPLIED",
        "NOT_APPLIED",
        "PARTIALLY_APPLIED",
        "IN_PROCESS",
        "UNDEFINED"
      ]
    },
    "InvoiceClassificationsDto": {
      "type": "object",
      "properties": {
        "accountingClassId": {
          "type": "string",
          "description": "BILL-generated ID of the accounting class. The value begins with `cls`."
        },
        "departmentId": {
          "type": "string",
          "description": "BILL-generated ID of the department. The value begins with `0de`."
        },
        "jobId": {
          "type": "string",
          "description": "BILL-generated ID of the job. The value begins with `job`."
        },
        "locationId": {
          "type": "string",
          "description": "BILL-generated ID of the location. The value begins with `loc`."
        }
      },
      "description": "DTO for Invoice classifications."
    },
    "InvoiceLineItemClassificationsDto": {
      "type": "object",
      "properties": {
        "chartOfAccountId": {
          "type": "string",
          "description": "BILL-generated ID of the chart of accounts. The value begins with `0ca`."
        },
        "accountingClassId": {
          "type": "string",
          "description": "BILL-generated ID of the accounting class. The value begins with `cls`."
        },
        "departmentId": {
          "type": "string",
          "description": "BILL-generated ID of the department. The value begins with `0de`."
        },
        "jobId": {
          "type": "string",
          "description": "BILL-generated ID of the job. The value begins with `job`."
        },
        "locationId": {
          "type": "string",
          "description": "BILL-generated ID of the location. The value begins with `loc`."
        },
        "itemId": {
          "type": "string",
          "description": "BILL-generated ID of the item. The value begins with `0ii`."
        }
      },
      "description": "DTO for Bill Line Item classifications."
    }
  }
}