> ## 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.

# Get Provider Balance

> Read a liquidity provider position from the market contract

Returns one provider's LP position. The endpoint reads the market contract directly and falls back to stored values only if the chain read fails. The `source` field tells you which path produced the response.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>
<ParamField path="provider" type="string" required>Provider wallet address, 0x-prefixed with 40 hex characters.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="shares" type="string">LP shares held, formatted at 18 decimals. Pass this to [Remove Liquidity](/endpoints/external-securities-lending/remove-liquidity).</ResponseField>
    <ResponseField name="currentValue" type="string">What the shares are worth now, in borrow asset units, including accrued interest.</ResponseField>
    <ResponseField name="deposited" type="string">Amount originally deposited, in borrow asset units. The difference against `currentValue` is the provider's earnings.</ResponseField>
    <ResponseField name="source" type="string">`onchain` when read from the contract, `database` when the read failed and stored values were served instead.</ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  When `source` is `database` the figures are the last recorded values, not live. `currentValue` in that case mirrors the deposited amount and excludes accrued interest. Do not settle against a `database` response.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities/api/positions/{marketId}/provider-balance/0x111...222" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities/api/positions/${marketId}/provider-balance/${provider}`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  if (data.source === 'onchain') {
    const earned = Number(data.currentValue) - Number(data.deposited);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response - On-Chain theme={null}
  {
    "success": true,
    "data": {
      "shares": "250000.000000000000000000",
      "currentValue": "252140.860000",
      "deposited": "250000.000000",
      "source": "onchain"
    }
  }
  ```

  ```json Response - Database Fallback theme={null}
  {
    "success": true,
    "data": {
      "deposited": "250000",
      "shares": "250000",
      "currentValue": "250000",
      "source": "database"
    }
  }
  ```
</ResponseExample>
