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

# List Connected Vaults

> The operator vaults a market takes liquidity through, read from the chain

Lists the vaults this market takes liquidity through. That is every vault the market admin registered, plus every vault with an active liquidity provider position recorded on this market. The figures are read from the chain, so an issuer that deployed the market sees the set its lender of record connected.

A current market takes outside money only through such a vault. Use this list to offer a client the vaults it can fund the market through, then build the transactions with [Deposit to Vault](/endpoints/lending/deposit-to-vault) and [Redeem from Vault](/endpoints/lending/redeem-from-vault).

A market whose implementation predates vault liquidity answers `useVaultLiquidity: false` and an empty `vaults` list.

## Path Parameters

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

## Which vaults take a deposit

A vault your own instance operates always takes a deposit through this market. Any other vault takes one only when its operator has published it on your network with a risk disclosure. `depositable` gives the answer and `depositRefusal` gives the reason in words. Redemptions are not restricted this way.

The operator's `riskDisclosure` and `riskDisclosureUrl` are returned only for your own vault or a published one. Show them next to the deposit control.

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="useVaultLiquidity" type="boolean">The market switch for just-in-time draws. `false` also on a market whose implementation predates vault liquidity. `null` when it could not be read.</ResponseField>

    <ResponseField name="vaults" type="array">
      One entry per connected vault. A vault that does not answer keeps its entry, with `null` in the fields that could not be read.

      <Expandable>
        <ResponseField name="id" type="string">The vault's Trusset ID. `null` when no operator on Trusset has a record of this vault.</ResponseField>
        <ResponseField name="vaultAddress" type="string">The vault contract, lowercased.</ResponseField>
        <ResponseField name="name" type="string">Vault name, read from the chain, with the stored record as fallback.</ResponseField>
        <ResponseField name="symbol" type="string">Share token symbol, read the same way.</ResponseField>
        <ResponseField name="assetAddress" type="string">The asset the vault holds, lowercased.</ResponseField>
        <ResponseField name="assetMatches" type="boolean">Whether that asset is the market's settlement token (stablecoin). `null` when either could not be read.</ResponseField>
        <ResponseField name="assetDecimals" type="integer">Decimals of the vault's asset, which are also the decimals of its shares. Falls back to the market's borrow asset decimals when the vault does not answer.</ResponseField>
        <ResponseField name="depositsPaused" type="boolean">`true` when the vault operator has paused deposits. Redemptions stay open.</ResponseField>
        <ResponseField name="sharePrice" type="string">Value of one share in the vault's asset, as a decimal string. `"1.0"` for an empty vault.</ResponseField>
        <ResponseField name="totalAssets" type="string">The vault's idle funds plus its value in every market it funds, in the vault's asset.</ResponseField>
        <ResponseField name="identityRegistryAddress" type="string">The register the vault examines its depositors against. `null` when the vault names none.</ResponseField>
        <ResponseField name="registered" type="boolean">Whether the vault is on this market's draw list.</ResponseField>
        <ResponseField name="drawCap" type="string">The cap the vault operator set for this market, as a decimal string in the vault's asset. `"0.0"` means the vault has not consented to draws. Unlike [Get Vault Liquidity](/endpoints/lending/get-vault-liquidity), this is not in base units.</ResponseField>
        <ResponseField name="providerApproved" type="boolean">Whether the market admits the vault as a direct liquidity provider. On a current market it equals `registered`.</ResponseField>
        <ResponseField name="positionValue" type="string">The vault's liquidity provider position in this market, as a decimal string in the market's borrow asset.</ResponseField>
        <ResponseField name="published" type="boolean">Whether the operator has published the vault on your instance's network.</ResponseField>
        <ResponseField name="own" type="boolean">Whether your instance operates the vault.</ResponseField>
        <ResponseField name="depositable" type="boolean">Whether [Deposit to Vault](/endpoints/lending/deposit-to-vault) builds a deposit into this vault for your instance.</ResponseField>
        <ResponseField name="depositRefusal" type="string">Why no deposit is offered, in words. `null` when `depositable` is `true`.</ResponseField>
        <ResponseField name="riskDisclosure" type="string">The operator's risk disclosure text. `null` unless the vault is your own or published.</ResponseField>
        <ResponseField name="riskDisclosureUrl" type="string">Link to the operator's risk disclosure, on the same terms.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  The answer is held for up to 60 seconds per market. A deposit or redemption confirmed through this market clears it. A registration made through this API or a new draw cap does not, so either can take up to a minute to show here.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/connected-vaults" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/connected-vaults`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();

  const offerable = data.vaults.filter(
    (v: { depositable: boolean; depositsPaused: boolean | null; assetMatches: boolean | null }) =>
      v.depositable && v.depositsPaused === false && v.assetMatches === true
  );
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "useVaultLiquidity": true,
      "vaults": [
        {
          "id": "cmssh8t2u0003cghxkx1w1fwd",
          "published": true,
          "vaultAddress": "0x4d0cfe39a3431b145d1a1393d901a36d459a1b13",
          "name": "Trusset Prime Demo Vault",
          "symbol": "TPV",
          "assetAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
          "assetMatches": true,
          "assetDecimals": 6,
          "depositsPaused": false,
          "sharePrice": "1.024318",
          "totalAssets": "302500.0",
          "identityRegistryAddress": "0xe9114c40934f6fb6bb317935156b731f7a86d006",
          "registered": true,
          "drawCap": "500000.0",
          "providerApproved": true,
          "positionValue": "120000.0",
          "own": false,
          "depositable": true,
          "depositRefusal": null,
          "riskDisclosure": "Deposits fund secured loans on the operator's lending markets. Redemptions depend on market utilization and can fill partially.",
          "riskDisclosureUrl": "https://example.com/vault-risk-disclosure.pdf"
        }
      ]
    }
  }
  ```

  ```json Response (Implementation Without Vault Liquidity) theme={null}
  {
    "success": true,
    "data": {
      "useVaultLiquidity": false,
      "vaults": []
    }
  }
  ```

  ```json Error - Unreadable theme={null}
  {
    "success": false,
    "error": {
      "code": "VAULTS_UNREADABLE",
      "message": "The vaults connected to this market could not be read from the chain. Retry in a moment."
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                | HTTP  | Cause                                                                   |
| ------------------- | ----- | ----------------------------------------------------------------------- |
| `NO_MARKET_ADDRESS` | `400` | The market has no on-chain address recorded                             |
| `MISSING_MARKET_ID` | `400` | `marketId` is longer than 100 characters                                |
| `MARKET_NOT_FOUND`  | `404` | No market with this ID on your instance                                 |
| `VAULTS_UNREADABLE` | `503` | The market's vault list could not be read from the chain. Retry shortly |
