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

# Open Loan

> Post stock token collateral and borrow USDC

Opens a new overcollateralized loan. The borrower deposits stock tokens as collateral and receives USDC. The maximum borrow amount is determined by the collateral value multiplied by the market's collateral factor.

Optionally pass a `signedPrice` from the [Sign Price](/endpoints/stock-lending/sign-price) endpoint for an atomic price update.

<Warning>
  Only the `openLoan` call is returned. Approve the market for at least `collateralAmount` of the stock token before broadcasting, or the loan reverts.
</Warning>

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

## Body Parameters

<ParamField body="collateralAmount" type="string" required>Stock tokens to post as collateral (18-decimal, e.g. `"100"`).</ParamField>
<ParamField body="borrowAmount" type="string" required>USDC to borrow (6-decimal, e.g. `"5000"`).</ParamField>

<ParamField body="signedPrice" type="object">
  Optional EIP-712 signed price from the `/sign-price` endpoint.

  <Expandable>
    <ParamField body="price" type="string">Price in raw 6-decimal format.</ParamField>
    <ParamField body="timestamp" type="integer">Signer timestamp.</ParamField>
    <ParamField body="validUntil" type="integer">Signature expiry.</ParamField>
    <ParamField body="signature" type="string">EIP-712 signature hex.</ParamField>
  </Expandable>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.trusset.org/lending-stocks/api/positions/{marketId}/open-loan" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "collateralAmount": "100",
      "borrowAmount": "5000"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "action": "SIGN_TRANSACTION",
      "transaction": { "to": "0x70A0...", "data": "0x..." },
      "functionName": "openLoan"
    }
  }
  ```
</ResponseExample>
