Skip to main content
POST
/
markets
/
creditbook
/
create
Create loan
curl --request POST \
  --url https://tars.loopscale.com/v1/markets/creditbook/create \
  --header 'Content-Type: application/json' \
  --header 'payer: <payer>' \
  --data '
{
  "depositCollateral": [
    {
      "collateralAmount": 123,
      "collateralAssetData": {
        "Spl": {
          "mint": "<string>"
        }
      },
      "loanCreationParams": {},
      "weightMatrixUpdate": [
        123
      ]
    }
  ],
  "borrower": "<string>",
  "principalRequested": [
    {
      "ledgerIndex": 123,
      "principalAmount": 123,
      "principalMint": "<string>",
      "strategy": "<string>",
      "durationIndex": 123,
      "expectedLoanValues": {
        "expectedApy": 123,
        "expectedLqt": [
          123
        ]
      }
    }
  ],
  "assetIndexGuidance": [
    123
  ],
  "loanNonce": "<string>",
  "isLoop": true
}
'
{
  "transaction": {
    "message": "<string>",
    "signatures": [
      {
        "publicKey": "<string>",
        "signature": "<string>"
      }
    ]
  },
  "loanAddress": "<string>"
}

Headers

payer
string
required

Wallet that pays transaction fees for the loan creation.

Body

application/json
depositCollateral
object[]
required
borrower
string
required

Wallet address that will own the new loan.

principalRequested
object[]
required
assetIndexGuidance
integer[]

Optional oracle asset ordering hints used by Loopscale when validating a transaction.

loanNonce
string

Optional nonce override used when deriving the loan PDA.

isLoop
boolean

Optional flag marking the created loan as a loop position.

Response

Serialized transaction and derived loan address.

transaction
object
required
loanAddress
string
required

Derived loan PDA created by the transaction.