{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/canopyservicing-com/json-schema/canopyservicing-com-installment-loan-response-schema.json",
  "title": "InstallmentLoanResponse",
  "description": "Response schema for an installment loan.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/canopyservicing-com-installment-loans-api-openapi.yml#/components/schemas/InstallmentLoanResponse",
  "properties": {
    "loan_id": {
      "type": "string",
      "title": "Loan Id",
      "description": "The Loan's ID.",
      "hidden": false
    },
    "original_amount_cents": {
      "type": "integer",
      "title": "Original Amount Cents",
      "description": "The initial amount of the loan (in cents).",
      "hidden": false
    },
    "currency": {
      "type": "string",
      "title": "Currency",
      "description": "The ISO 4217 3-letter currency code of the loan.",
      "default": "USD",
      "hidden": false
    },
    "description": {
      "type": "string",
      "title": "Description",
      "description": "The loan's description."
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        }
      ],
      "title": "Metadata",
      "description": "The metadata field can be used to store any loan metadata (for example, to link the loan to external systems/transactions).",
      "hidden": false
    },
    "effective_at": {
      "type": "string",
      "title": "Effective At",
      "description": "The `Date-Time` at which the loan is recorded on the account.",
      "hidden": false
    },
    "created_at": {
      "type": "string",
      "title": "Created At",
      "description": "The `Date-Time` at which the loan was created on the account.",
      "hidden": false
    },
    "account_id": {
      "type": "string",
      "title": "Account Id",
      "description": "The ID of the account that owns this loan.",
      "hidden": false
    },
    "line_of_credit_id": {
      "type": "string",
      "title": "Line Of Credit Id",
      "description": "The ID of the line of credit to which this loan is associated."
    },
    "unpaid_amounts_breakdown": {
      "$ref": "#/$defs/BalanceBreakdownCentsOutput",
      "description": "The unpaid balances associated with the loan.",
      "hidden": false
    },
    "paid_amounts_breakdown": {
      "$ref": "#/$defs/BalanceBreakdownCentsOutput",
      "description": "The paid balances associated to the loan.",
      "hidden": false
    },
    "restructured_to_loan_id": {
      "type": "string",
      "title": "Restructured To Loan Id",
      "description": "The ID of the loan into which the current loan was restructured."
    },
    "restructured_at": {
      "type": "string",
      "title": "Restructured At",
      "description": "The `Date-Time` at which the loan was restructured."
    },
    "restructured_from_loan_ids": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Restructured From Loan Ids",
      "description": "The IDs of the loans that were restructured into the this loan.",
      "hidden": false
    },
    "interest_rate_percent": {
      "type": "number",
      "title": "Interest Rate Percent",
      "description": "The annual interest rate percentage. For example, 3.45% will be returned as 3.45.",
      "hidden": false
    }
  },
  "type": "object",
  "required": [
    "loan_id",
    "original_amount_cents",
    "metadata",
    "effective_at",
    "created_at",
    "account_id",
    "unpaid_amounts_breakdown",
    "paid_amounts_breakdown",
    "restructured_from_loan_ids",
    "interest_rate_percent"
  ],
  "$defs": {
    "BalanceBreakdownCentsOutput": {
      "properties": {
        "principal_amount_cents": {
          "type": "integer",
          "title": "Principal Amount Cents"
        },
        "interest_amount_cents": {
          "type": "integer",
          "title": "Interest Amount Cents"
        },
        "fee_amount_cents": {
          "type": "integer",
          "title": "Fee Amount Cents"
        },
        "total_cents": {
          "type": "integer",
          "title": "Total Cents",
          "readOnly": true
        }
      },
      "type": "object",
      "required": [
        "principal_amount_cents",
        "interest_amount_cents",
        "fee_amount_cents",
        "total_cents"
      ],
      "title": "BalanceBreakdownCentsOutput",
      "description": "Balance Breakdown exposed to customers in API responses"
    }
  }
}