### POST /markets/strategy/create Source: https://docs.loopscale.com/api-reference/transactions/strategy/create-strategy Creates a new lending strategy, deposits the initial principal amount, and may return multiple transactions for setup. ```APIDOC ## POST /markets/strategy/create ### Description Creates a new lending strategy, deposits the initial principal amount, and may return multiple transactions when lookup-table setup or external yield account initialization is required. ### Method POST ### Endpoint /markets/strategy/create ### Parameters #### Header Parameters - **payer** (string) - Required - Wallet that pays transaction fees. If you normally use the same wallet as the lender, pass that wallet here. ### Request Body - **principalMint** (string) - Required - Mint address of the principal asset the strategy will lend. - **lender** (string) - Required - Wallet that will own and fund the strategy. - **amount** (number) - Required - Initial principal amount to deposit into the strategy, in native token units. - **originationsEnabled** (boolean) - Optional - Whether the strategy should accept new originations immediately. - **liquidityBuffer** (number) - Optional - Amount of principal to reserve as idle liquidity. - **interestFee** (number) - Optional - Interest fee charged by the strategy, in cBPS. - **originationFee** (number) - Optional - Origination fee charged by the strategy, in cBPS. - **originationCap** (number) - Optional - Maximum amount of principal that can be originated. - **collateralTerms** (array) - Optional - Optional collateral-term presets to initialize on the strategy. - **marketInformation** (string) - Optional - Optional verified market information account to bind to the strategy. - **externalYieldSourceArgs** (object) - Optional - Arguments for external yield sources. ### Request Example ```json { "principalMint": "string", "lender": "string", "amount": 0, "originationsEnabled": true, "liquidityBuffer": 0, "interestFee": 0, "originationFee": 0, "originationCap": 0, "collateralTerms": [ { "apy": 0, "indices": [ { "collateralIndex": 0, "durationIndex": 0 } ] } ], "marketInformation": "string", "externalYieldSourceArgs": { "newExternalYieldSource": 0, "createExternalYieldAccount": true } } ``` ### Response #### Success Response (200) - **message** (string) - Base64-encoded versioned transaction message. - **signatures** (array) - Array of transaction signatures. #### Response Example ```json [ { "message": "string", "signatures": [ { "publicKey": "string", "signature": "string" } ] } ] ``` ``` -------------------------------- ### Retrieve Loop Information Source: https://docs.loopscale.com/api-reference/guides/vault-and-loop-metrics Example request to the Loopscale API to get information about specific loops using their identifiers. You can filter by loop slugs or mint pairs. ```bash curl -X POST https://tars.loopscale.com/v1/markets/loop/info \ -H "Content-Type: application/json" \ -d '{ "identifiers": ["acred-usdg"] }' ``` -------------------------------- ### Create Vault Rewards Schedule OpenAPI Specification Source: https://docs.loopscale.com/api-reference/transactions/vault/create-rewards-schedule This OpenAPI specification defines the POST request for creating a vault rewards schedule. It includes parameters for user wallet, optional payer, and a request body detailing the vault address, deposit amount, reward mint, start and end times, and duration stake weights. Responses include a serialized versioned transaction or error messages. ```yaml openapi: 3.1.3 info: title: Loopscale API version: 1.0.0 servers: - url: https://tars.loopscale.com/v1 description: Loopscale Production Server security: [] paths: /markets/lending_vaults/rewards/schedule/create: post: tags: - Markets summary: Create rewards schedule description: >- Create a new vault rewards schedule and optionally deposit reward tokens into it. operationId: createVaultRewardsSchedule parameters: - name: user-wallet in: header required: true schema: type: string description: Manager wallet address - name: payer in: header required: false schema: type: string description: Optional payer wallet. Defaults to user-wallet when omitted. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateRewardsScheduleRequest' responses: '200': description: Serialized versioned transaction content: application/json: schema: $ref: '#/components/schemas/VersionedTransactionResponse' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/GeneralError' components: schemas: CreateRewardsScheduleRequest: type: object required: - vaultAddress - amountToDeposit - rewardMint - rewardStartTime - rewardEndTime - durationStakeWeights properties: vaultAddress: type: string amountToDeposit: type: integer description: Raw token amount to transfer into the reward schedule. rewardMint: type: string rewardStartTime: type: integer description: Unix timestamp in seconds. rewardEndTime: type: integer description: Unix timestamp in seconds. durationStakeWeights: type: array description: Duration weights in cBPS for all allowed stake durations. minItems: 5 maxItems: 5 items: type: integer VersionedTransactionResponse: type: object required: - message - signatures properties: message: type: string description: Base64-encoded versioned transaction message signatures: type: array items: $ref: '#/components/schemas/VersionedTransactionSignature' VersionedTransactionSignature: type: object required: - publicKey - signature properties: publicKey: type: string signature: type: string responses: BadRequest: description: Bad Request content: text/plain: schema: type: string example: 'Something went wrong: You have an error in your SQL syntax.' GeneralError: description: General Server Error content: text/plain: schema: type: string example: >- Failed to deserialize the JSON body into the target type: missing field `mints` at line 1 column 1. ``` -------------------------------- ### Get Strategies Source: https://docs.loopscale.com/api-reference/data/strategies/get-strategies Returns a list of strategy data matching the filters. Use this endpoint to query strategy-level data directly for computing Vault TVL or APY from raw fields. ```APIDOC ## GET /strategies ### Description Returns a list of strategy data matching the filters. A Strategy is the onchain capital escrow and lending ruleset that sits behind every Vault. It holds deposited capital, deploys it as advanced lending orders on the credit order book according to curator-defined parameters (eligible collateral, rates, durations), and tracks accrued interest and external yield. Use this endpoint to query strategy-level data directly — for example, when computing Vault TVL or APY from raw fields rather than pre-aggregated Vault metadata. ### Method GET ### Endpoint /strategies ### Parameters #### Query Parameters - **filters** (object) - Optional - Filters to apply to the strategy data. Refer to the documentation for available filter options. ### Response #### Success Response (200) - **strategies** (array) - A list of strategy objects, each containing detailed onchain capital escrow and lending rule information. - **strategy** (object) - Represents a single strategy with fields like `id`, `name`, `escrow_details`, `lending_parameters`, `interest_accrued`, `external_yield`. #### Response Example { "strategies": [ { "id": "strategy_123", "name": "Yield Farming Strategy A", "escrow_details": { "total_escrowed": "1000000", "currency": "USD" }, "lending_parameters": { "eligible_collateral": ["ETH", "WBTC"], "min_rate": "5.0", "max_duration_days": 30 }, "interest_accrued": "500", "external_yield": "2.5" } ] } ``` -------------------------------- ### Get Total Looped Assets Source: https://docs.loopscale.com/api-reference/guides/vault-and-loop-metrics Retrieves the total assets deposited into a Loop. The value is returned in a decimal-scaled format. ```javascript const totalLoopedAssets = loopInfo.collateralDeposited; ``` -------------------------------- ### POST /markets/creditbook/create Source: https://docs.loopscale.com/api-reference/transactions/borrow/create-loan Creates a new loan with initial collateral and requested principal borrows, returning both the loan address and the serialized transaction needed to initialize it. ```APIDOC ## POST /markets/creditbook/create ### Description Creates a new loan with initial collateral and requested principal borrows, returning both the loan address and the serialized transaction needed to initialize it. ### Method POST ### Endpoint /markets/creditbook/create ### Parameters #### Header Parameters - **payer** (string) - Required - Wallet that pays transaction fees for the loan creation. ### Request Body - **depositCollateral** (array) - Required - - **borrower** (string) - Required - Wallet address that will own the new loan. - **principalRequested** (array) - Required - - **assetIndexGuidance** (array) - Optional - - **loanNonce** (string) - Optional - Optional nonce override used when deriving the loan PDA. - **isLoop** (boolean) - Optional - Optional flag marking the created loan as a loop position. ### Request Example { "depositCollateral": [ { "collateralAmount": 1000000, "collateralAssetData": {}, "loanCreationParams": {}, "weightMatrixUpdate": [ 0, 0, 0, 0, 0 ] } ], "borrower": "0x1234567890abcdef1234567890abcdef12345678", "principalRequested": [ { "ledgerIndex": 0, "principalAmount": 500000, "principalMint": "0xmintaddress", "strategy": "0xstrategyaddress", "durationIndex": 0, "expectedLoanValues": {} } ], "assetIndexGuidance": [ 0, 1, 2, 3, 4 ], "loanNonce": "some_nonce", "isLoop": false } ### Response #### Success Response (200) - **transaction** (object) - - **loanAddress** (string) - Derived loan PDA created by the transaction. #### Response Example { "transaction": { "message": "base64encodedmessage", "signatures": [ "signature1", "signature2" ] }, "loanAddress": "0xloanaddress" } ``` -------------------------------- ### Documentation Index Source: https://docs.loopscale.com/api-reference/transactions/strategy/update-strategy Fetch the complete documentation index for Loopscale's LLM APIs. ```APIDOC ## GET /websites/loopscale_api-reference/docs/index ### Description Fetches the complete documentation index for Loopscale's LLM APIs. ### Method GET ### Endpoint /websites/loopscale_api-reference/docs/index ### Query Parameters - **url** (string) - Required - The URL to the documentation index file (e.g., https://docs.loopscale.com/llms.txt). ``` -------------------------------- ### POST /markets/creditbook/flash_borrow Source: https://docs.loopscale.com/api-reference/transactions/borrow/flash-borrow Atomically creates a new loan and executes optional CPIs before depositing collateral. Supports deferred collateralization. Returns a transaction message and resulting loan address. ```APIDOC ## POST /markets/creditbook/flash_borrow ### Description Atomically creates a new loan and executes optional CPIs before depositing collateral. Supports deferred collateralization. Returns a transaction message and resulting loan address. ### Method POST ### Endpoint /markets/creditbook/flash_borrow ### Parameters #### Header Parameters - **user-wallet** (string) - Required - Wallet address of the borrowing user #### Request Body - **principalRequested** (array) - Required - List of principal borrow requests - **ledgerIndex** (integer) - Required - Which ledger to borrow into (0–4). Use 0 for most cases. - **principalAmount** (number) - Required - Amount of principal to borrow in lamports - **principalMint** (string) - Required - Mint address of the principal token - **strategy** (string) - Required - Strategy address returned from quote - **durationIndex** (integer) - Required - Duration index for the loan - **expectedLoanValues** (object) - Required - Expected loan values - **depositCollateral** (array) - Required - List of collateral deposits - **cpiIxs** (array) - Optional - Instructions to execute between borrow and deposit steps - **cpiLuts** (array) - Optional - Optional Address Lookup Tables for CPI instructions - **cpiSigners** (array) - Optional - Optional signer keys, not including the user's own, for CPI instructions - **loanAddress** (string) - Optional - If leveraging an existing loan, provide its address - **setupIxs** (array) - Optional - Optional instructions to execute first - **setupLuts** (array) - Optional - Optional Address Lookup Tables for setup instructions - **setupSigners** (array) - Optional - Optional signer keys, not including the user's own, for setup instructions - **unifySetup** (boolean) - Optional - If true, prepends setupIxs to the flash loan transaction; if false (default), returns two transactions (Setup + Flash Loan w/ CPI) ### Request Example ```json { "principalRequested": [ { "ledgerIndex": 0, "principalAmount": 1000000000, "principalMint": "So11111111111111111111111111111111111111112", "strategy": "someStrategyAddress", "durationIndex": 1, "expectedLoanValues": { "amount": 1000000000, "rate": 0.05, "duration": 3600 } } ], "depositCollateral": [], "cpiIxs": [], "cpiLuts": [], "cpiSigners": [], "loanAddress": null, "setupIxs": [], "setupLuts": [], "setupSigners": [], "unifySetup": false } ``` ### Response #### Success Response (200) - **transactions** (array) - List of transaction messages and signatures - **message** (string) - Base64-encoded versioned transaction message - **signatures** (array) - List of public keys and their corresponding signatures - **publicKey** (string) - **signature** (string) - **expectedLoanInfo** (object) - Loan post transaction state used for verification - **loan** (object) - **address** (string) - Onchain loan account #### Response Example ```json { "transactions": [ { "message": "Base64EncodedMessage1", "signatures": [ { "publicKey": "publicKey1", "signature": "signature1" } ] } ], "expectedLoanInfo": { "loan": { "address": "loanAddress1" } } } ``` ``` -------------------------------- ### Create Loan API Source: https://docs.loopscale.com/api-reference/transactions/borrow/create-loan Creates a new loan with initial collateral and requested principal borrows, returning both the loan address and the serialized transaction needed to initialize it. ```APIDOC ## POST /api/loans ### Description Creates a new loan with initial collateral and requested principal borrows. ### Method POST ### Endpoint /api/loans ### Request Body - **collateral** (object) - Required - Details of the initial collateral. - **principal** (object) - Required - Details of the requested principal borrow. ### Response #### Success Response (200) - **loanAddress** (string) - The address of the newly created loan. - **transaction** (string) - The serialized transaction needed to initialize the loan. ``` -------------------------------- ### OpenAPI Specification for Get Vault Depositors Source: https://docs.loopscale.com/api-reference/data/user/get-vault-depositors This OpenAPI 3.1.3 specification defines the POST request for the /markets/lending_vaults/deposits endpoint. It includes schemas for request bodies, responses, and components like VaultDepositorRequest and VaultDepositor. ```yaml openapi: 3.1.3 info: title: Loopscale API version: 1.0.0 servers: - url: https://tars.loopscale.com/v1 description: Loopscale Production Server security: [] paths: /markets/lending_vaults/deposits: post: summary: Get list of Vault depositors description: Fetches a list of users and total balances grouped by Vault. operationId: getVaultDepositors requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/VaultDepositorRequest' responses: '200': $ref: '#/components/responses/VaultDepositorsResponse' '422': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/GeneralError' components: schemas: VaultDepositorRequest: type: object properties: vaultAddresses: type: array items: type: string description: List of vaults to query by, must include this or principalMints. principalMints: type: array items: type: string description: >- List of principal tokens to query by, must include this or vaultAddresses. required: [] VaultDepositor: type: object properties: vaultAddress: type: string description: The Vault the deposits are mapped to userDeposits: type: array items: type: object properties: userAddress: type: string amountSupplied: type: string description: Deposits per user to corresponding Vault responses: VaultDepositorsResponse: description: A list of Vaults and an array of users and their balances in the Vault content: application/json: schema: type: array items: $ref: '#/components/schemas/VaultDepositor' examples: example: value: - vaultAddress: AXanCP4dJHtWd7zY4X7nwxN5t5Gysfy2uG3XTxSmXdaB userDeposits: - userAddress: 2fyUG8mSGgCkh9jDaSHToN4dPrp5x3Bb7boETVMRHR6h amountSupplied: 41214262 BadRequest: description: Bad Request content: text/plain: schema: type: string example: 'Something went wrong: You have an error in your SQL syntax.' GeneralError: description: General Server Error content: text/plain: schema: type: string example: >- Failed to deserialize the JSON body into the target type: missing field `mints` at line 1 column 1. ``` -------------------------------- ### OpenAPI Specification for Get Collateral Holders Source: https://docs.loopscale.com/api-reference/data/user/get-collateral-holders This OpenAPI 3.1.3 specification defines the POST /markets/collateral/holders endpoint. It includes request body schema for collateral mints and optional PDAs, and response schemas for successful retrieval or errors. ```yaml openapi: 3.1.3 info: title: Loopscale API version: 1.0.0 servers: - url: https://tars.loopscale.com/v1 description: Loopscale Production Server security: [] paths: /markets/collateral/holders: post: summary: Get collateral holders description: >- Fetches a list of users and total balances for one or more specified collateral mints. operationId: getCollateralHolders requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CollateralHoldersRequest' responses: '200': $ref: '#/components/responses/CollateralHoldersResponse' '412': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/GeneralError' components: schemas: CollateralHoldersRequest: type: object properties: mints: type: array items: type: string description: List of collateral mint addresses to filter for. pdas: type: boolean description: >- Whether to return the PDAs holding the assets or the end borrower wallet. required: - mints CollateralHolder: type: object properties: collateralMint: type: string totalDeposits: type: number userDeposits: type: object properties: '[address]': type: number description: Deposits per user of corresponding collateral responses: CollateralHoldersResponse: description: A list of collateral holder objects content: application/json: schema: type: array items: $ref: '#/components/schemas/CollateralHolder' examples: example: value: - collateralMint: 6TiBRYFLs9H4wnwEVyqZfPs6bshAM9ZcaS976tDDGuD totalDeposits: 389168.10806099995 userDeposits: G7mjP2Hpj3A5d6f1LTjXUAy8MR8FDTvZcPY79RDhQv: 278911.414198 6Fjoe4udyj6r1ZLk3MDPcFzeDYNWvekSkjNwyEAsWTmTw: 137741.601249 BadRequest: description: Bad Request content: text/plain: schema: type: string example: 'Something went wrong: You have an error in your SQL syntax.' GeneralError: description: General Server Error content: text/plain: schema: type: string example: >- Failed to deserialize the JSON body into the target type: missing field `mints` at line 1 column 1. ``` -------------------------------- ### POST /markets/lending_vaults/rewards/schedule/create Source: https://docs.loopscale.com/api-reference/transactions/vault/create-rewards-schedule Create a new vault rewards schedule and optionally deposit reward tokens into it. ```APIDOC ## POST /markets/lending_vaults/rewards/schedule/create ### Description Create a new vault rewards schedule and optionally deposit reward tokens into it. ### Method POST ### Endpoint /markets/lending_vaults/rewards/schedule/create ### Parameters #### Header Parameters - **user-wallet** (string) - Required - Manager wallet address - **payer** (string) - Optional - Optional payer wallet. Defaults to user-wallet when omitted. #### Request Body - **vaultAddress** (string) - Required - **amountToDeposit** (integer) - Required - Raw token amount to transfer into the reward schedule. - **rewardMint** (string) - Required - **rewardStartTime** (integer) - Required - Unix timestamp in seconds. - **rewardEndTime** (integer) - Required - Unix timestamp in seconds. - **durationStakeWeights** (array) - Required - Duration weights in cBPS for all allowed stake durations. (minItems: 5, maxItems: 5) - items (integer) ### Request Example ```json { "vaultAddress": "string", "amountToDeposit": 0, "rewardMint": "string", "rewardStartTime": 0, "rewardEndTime": 0, "durationStakeWeights": [ 0, 0, 0, 0, 0 ] } ``` ### Response #### Success Response (200) - **message** (string) - Base64-encoded versioned transaction message - **signatures** (array) - Array of signatures for the versioned transaction. - **publicKey** (string) - **signature** (string) #### Response Example ```json { "message": "string", "signatures": [ { "publicKey": "string", "signature": "string" } ] } ``` #### Error Responses - **400** - BadRequest - **500** - GeneralError ``` -------------------------------- ### POST /markets/creditbook/build Source: https://docs.loopscale.com/api-reference/transactions/borrow/build-loan Builds or mutates a loan through a sequence of high-level actions. Supported step types currently include `repay`, `flashBorrow`, and `swapCollateral`. ```APIDOC ## POST /markets/creditbook/build ### Description Builds or mutates a loan through a sequence of high-level actions. Supported step types currently include `repay`, `flashBorrow`, and `swapCollateral`. ### Method POST ### Endpoint /markets/creditbook/build ### Parameters #### Header Parameters - **user-wallet** (string) - Required - Wallet address of the borrower whose loan is being built or updated. - **payer** (string) - Optional - Optional fee payer. Defaults to `user-wallet` when omitted. #### Request Body - **loan** (string) - Optional - Optional existing loan address. Omit to start from a new flash-borrow step. - **steps** (array) - Required - An array of loan build steps. - **type** (string) - Required - The type of step. Enum: `repay`, `flashBorrow`, `swapCollateral`. - **params** (object) - Required - Step payload for the selected type. `repay` uses the repay endpoint shape without the top-level `loan`, `flashBorrow` uses the flash-borrow payload, and `swapCollateral` uses the swap-collateral payload without the top-level `loan`. ### Request Example ```json { "loan": "0x123...", "steps": [ { "type": "repay", "params": { "amount": "1000", "currency": "USDC" } }, { "type": "flashBorrow", "params": { "amount": "500", "currency": "ETH" } } ] } ``` ### Response #### Success Response (200) - **loan** (string) - Resulting loan address after the build flow completes. - **transactions** (array) - The transaction sequence produced by the requested build steps. - **message** (string) - Base64-encoded versioned transaction message - **signatures** (array) - Signatures for the transaction message. - **publicKey** (string) - Public key associated with the signature. - **signature** (string) - The signature itself. #### Response Example ```json { "loan": "0x456...", "transactions": [ { "message": "...", "signatures": [ { "publicKey": "...", "signature": "..." } ] } ] } ``` #### Error Response (400) - **description** (string) - Bad Request #### Error Response (500) - **description** (string) - General Server Error ``` -------------------------------- ### Fetch Lending Vaults Info Source: https://docs.loopscale.com/api-reference/guides/vault-and-loop-metrics Use this cURL command to retrieve information about lending vaults, including rewards, for pagination. ```bash curl -X POST https://tars.loopscale.com/v1/markets/lending_vaults/info \ -H "Content-Type: application/json" \ -d '{ "page": 0, "pageSize": 10, "includeRewards": true }' ``` -------------------------------- ### POST /markets/loans/info Source: https://docs.loopscale.com/api-reference/data/positions/get-loan-info Retrieves a list of loans based on specified filters, supporting pagination and various sorting options. ```APIDOC ## POST /markets/loans/info ### Description Returns a list of loans filtered by request. Results support pagination. ### Method POST ### Endpoint /markets/loans/info ### Parameters #### Request Body - **loanAddresses** (array) - Optional - List of loan addresses - **lenders** (array) - Optional - List of lender public keys - **borrowers** (array) - Optional - List of borrower public keys - **filterType** (number) - Optional - Filter type enum (0 = Active, 1 = Closed, 2 = Refinance Eligible, 3 = Time Based Liquidation Eligible) - **principalMints** (array) - Optional - List of principal mints - **orderFundingType** (integer) - Optional - Funding type enum (0 = Term loan, 2 = Loop) - **page** (integer) - Optional - Pagination number - **pageSize** (integer) - Optional - Pagination size, (max 1000) - **sortDirection** (integer) - Optional - Sort direction enum (0 = asc, 1 = desc) - **sortType** (integer) - Optional - Sort type enum (0 = Next Payment Due, 1 = End Time, 2 = Start Time, 3 = Principal Amount, 4 = Health) - **collateralMints** (array) - Optional - List of collateral mints - **excludeCollateralIdentifiers** (array) - Optional - List of collateral identifiers to hide - **excludePrincipalMints** (array) - Optional - List of principal mints to hide - **assetTypes** (integer) - Optional - Enum for asset type to include (0 = Normal Token, 1 = Staked Solana, 2 = Orca CLMM, 3 = Raydium CLMM, 4 = Meteora DLMM) ### Request Example { "filterType": 0, "page": 1, "pageSize": 10 } ### Response #### Success Response (200) - **totalCount** (number) - Number of loans contained in query - **loanInfos** (array) - List of loan data objects #### Response Example { "totalCount": 1, "loanInfos": [ { "loan": { "id": 123, "address": "string", "loanStatus": 0 }, "loanType": 0 } ] } ``` -------------------------------- ### Deposit into Strategy OpenAPI Specification Source: https://docs.loopscale.com/api-reference/transactions/strategy/deposit-strategy This OpenAPI 3.1.3 specification defines the POST /markets/strategy/deposit endpoint. It requires a User-Wallet header and accepts a JSON body containing the strategy address and deposit amount. Responses include a serialized transaction or error details. ```yaml openapi: 3.1.3 info: title: Loopscale API version: 1.0.0 servers: - url: https://tars.loopscale.com/v1 description: Loopscale Production Server security: [] paths: /markets/strategy/deposit: post: tags: - Markets - Strategy summary: Deposit into strategy description: Deposits additional principal into an existing lending strategy. operationId: depositStrategy parameters: - name: User-Wallet in: header required: true schema: type: string description: Wallet address of the lender depositing into the strategy. - name: payer in: header required: false schema: type: string description: >- Optional fee payer. Defaults to the `User-Wallet` address when omitted. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DepositStrategyRequest' responses: '200': description: Serialized transaction for the strategy deposit. content: application/json: schema: $ref: '#/components/schemas/VersionedTransactionResponse' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/GeneralError' components: schemas: DepositStrategyRequest: type: object required: - strategy - amount properties: strategy: type: string description: Onchain address of the target strategy. amount: type: number description: Amount of principal to deposit, in native token units. VersionedTransactionResponse: type: object required: - message - signatures properties: message: type: string description: Base64-encoded versioned transaction message. signatures: type: array items: $ref: '#/components/schemas/VersionedTransactionSignature' VersionedTransactionSignature: type: object required: - publicKey - signature properties: publicKey: type: string signature: type: string responses: BadRequest: description: Bad Request content: text/plain: schema: type: string example: Invalid strategy address GeneralError: description: General Server Error content: text/plain: schema: type: string example: Failed to deserialize the JSON body into the target type. ``` -------------------------------- ### POST /markets/lending_vaults/timelock/create Source: https://docs.loopscale.com/api-reference/transactions/vault/create-timelocks Create one or more timelock updates for vault collateral, rates, allocation, caps, and settings changes. ```APIDOC ## POST /markets/lending_vaults/timelock/create ### Description Create one or more timelock updates for vault collateral, rates, allocation, caps, and settings changes. ### Method POST ### Endpoint /markets/lending_vaults/timelock/create ### Parameters #### Header Parameters - **user-wallet** (string) - Required - Manager wallet address - **payer** (string) - Optional - Optional payer wallet. Defaults to user-wallet when omitted. #### Request Body - **vaultAddress** (string) - Required - Lending vault address - **collateralUpdates** (object) - Optional - Strategy collateral updates - **updatePrincipalCaps** (object) - Optional - Update principal caps arguments - **editStrategyArgs** (object) - Optional - Edit strategy arguments - **editVaultArgs** (object) - Optional - Edit vault arguments ### Response #### Success Response (200) - **VersionedTransactionsResponse** (array) - Serialized versioned transactions ``` -------------------------------- ### POST /markets/creditbook/repay Source: https://docs.loopscale.com/api-reference/transactions/borrow/repay-loan Repay a loan, with options to partially or fully repay, withdraw collateral, and execute CPI instructions. ```APIDOC ## POST /markets/creditbook/repay ### Description Partially or fully repay an active loan. Allows for the withdrawal of collateral for optional use in CPIs before repayment. ### Method POST ### Endpoint /markets/creditbook/repay ### Parameters #### Request Body - **loan** (string) - Required - Loan address to repay - **collateralWithdrawalParams** (array) - Optional - List of collateral assets to withdraw before repayment - **amount** (number) - Required - Collateral to withdraw (lamports) - **collateralMint** (string) - Required - Mint of collateral to withdraw - **repayParams** (array) - Required - List of principal repayment instructions - **amount** (number) - Required - Amount to repay in lamports - **ledgerIndex** (integer) - Required - Ledger index to apply repayment to (0–4) - **repayAll** (boolean) - Required - **cpiIxs** (array) - Optional - Optional CPI instructions to run between withdrawal and repayment - (object) - Optional - CPI instruction details - **cpiLuts** (array) - Optional - Optional list of address lookup tables - (string) - Optional - **cpiSigners** (array) - Optional - Optional list of signer keypairs - (string) - Optional - **setupIxs** (array) - Optional - Optional instructions to execute first - (object) - Optional - CPI instruction details - **setupLuts** (array) - Optional - Optional Address Lookup Tables - (string) - Optional - **setupSigners** (array) - Optional - Optional signer keys, not including the user's own - (string) - Optional - **unifySetup** (boolean) - Optional - If true, this flag will prepend the setupIxs to the repay transaction, if false (default), this endpoint will return two transactions (Setup + Repay Loan w/ CPI) - **closeIfPossible** (boolean) - Optional - Defaults to true. If true, this flag will append a loan close instruction if the entire loan is empty, otherwise it will skip closing and need to be handled separately. ### Response #### Success Response (200) - **transactions** (array) - Serialized transaction message and signatures - **message** (string) - Base64-encoded versioned transaction message - **signatures** (array) - **publicKey** (string) - **signature** (string) - **expectedLoanInfo** (object) - Loan post transaction state used for verification - **loan** (object) - **address** (string) - Onchain loan account #### Response Example ```json { "transactions": [ { "message": "base64EncodedMessage1", "signatures": [ { "publicKey": "publicKey1", "signature": "signature1" } ] } ], "expectedLoanInfo": { "loan": { "address": "loanAddress1" } } } ``` ``` -------------------------------- ### POST /markets/strategy/infos Source: https://docs.loopscale.com/api-reference/data/strategies/get-strategies Retrieves a list of strategy data matching the specified filters. Supports pagination and filtering by user address, strategy addresses, and principal mints. ```APIDOC ## POST /markets/strategy/infos ### Description Returns a list of strategy data matching the filters. ### Method POST ### Endpoint /markets/strategy/infos ### Parameters #### Request Body - **userAddress** (string) - Optional - Lender's address - **addresses** (array[string]) - Optional - List of strategy onchain addresses to load - **principalMints** (array[string]) - Optional - List of Vault principal mints to select - **page** (integer) - Optional - Pagination offset, sorted by APY - **pageSize** (integer) - Optional - Pagination limit (max 1000) ### Request Example ```json { "userAddress": "0x123...", "addresses": ["0xabc...", "0xdef..."], "principalMints": ["0xghi..."], "page": 0, "pageSize": 100 } ``` ### Response #### Success Response (200) - **strategies** (array[StrategyInfo]) - Array of strategy data - **total** (number) - Total number of strategies for this filter (to inform pagination) #### Response Example ```json { "strategies": [ { "strategy": { "address": "0xabc...", "principalMint": "0xghi...", "tokenBalance": 1000000, "externalYieldAmount": 50000, "currentDeployedAmount": 900000, "outstandingInterestAmount": 50000, "interestPerSecond": 10, "lastAccruedTimestamp": 1678886400 }, "externalYieldInfo": { "apy": 0.05 } } ], "total": 50 } ``` #### Error Response (400) - **description** (string) - Bad Request #### Error Response (500) - **description** (string) - General Server Error ``` -------------------------------- ### POST /markets/creditbook/swap_collateral Source: https://docs.loopscale.com/api-reference/transactions/borrow/swap-collateral Enables safe rebalancing of collateral by withdrawing a selected asset, executing CPIs (e.g. swaps or liquidity provision), and depositing a new asset in its place. ```APIDOC ## POST /markets/creditbook/swap_collateral ### Description Enables safe rebalancing of collateral by withdrawing a selected asset, executing CPIs (e.g. swaps or liquidity provision), and depositing a new asset in its place. ### Method POST ### Endpoint /markets/creditbook/swap_collateral ### Request Body - **loan** (string) - Required - Loan address to modify - **withdrawCollateral** (array) - Required - Amount and mint of the collateral to withdraw - **amount** (number) - Required - Collateral to withdraw (lamports) - **collateralMint** (string) - Required - Mint of collateral to withdraw - **depositCollateral** (array) - Required - Collateral to deposit after intermediate steps - **collateralAmount** (number) - Required - Collateral to deposit (lamports) - **collateralAssetData** (object) - Required - Asset data for deposit - **Spl** (object) - Optional - SPL asset data - [See SPL Asset Data Schema] - **StakedSol** (object) - Optional - Staked SOL asset data - [See Staked SOL Asset Data Schema] - **cpiIxs** (array) - Required - Instructions to run between withdrawal and re-deposit - **programId** (string) - Required - Program ID to call - **accounts** (array) - Required - Accounts for the instruction - **pubkey** (string) - Required - **isSigner** (boolean) - Required - **isWritable** (boolean) - Required - **data** (string) - Required - Base64 or hex-encoded instruction data - **cpiLuts** (array) - Optional - Optional Address Lookup Tables for the transaction - (string) - **cpiSigners** (array) - Optional - Optional keypairs required to initialize accounts - (string) ### Response #### Success Response (200) - **transactions** (array) - Array of versioned transaction messages and signatures - **message** (string) - Base64-encoded versioned transaction message - **signatures** (array) - Signatures for the transaction - **publicKey** (string) - **signature** (string) - **expectedLoanInfo** (object) - Loan post transaction state used for verification - **loan** (object) - **address** (string) - Onchain loan account #### Error Response (400) [See BadRequest Schema] #### Error Response (500) [See GeneralError Schema] ```