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

# Get Markets

> Query a list of markets you can borrow from.

Each market has one unique token that can be borrowed against one unique token that
can be used as collateral.



## OpenAPI

````yaml /v1/combined_spec.json get /v1/morpho/markets
openapi: 3.1.0
info:
  title: Compass API
  description: Compass Labs DeFi API
  version: 0.0.1
servers:
  - url: https://api.compasslabs.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/morpho/markets:
    get:
      tags:
        - Morpho
      summary: Get Markets
      description: >-
        Query a list of markets you can borrow from.


        Each market has one unique token that can be borrowed against one unique
        token that

        can be used as collateral.
      operationId: v1_morpho_markets
      parameters:
        - name: chain
          in: query
          required: true
          schema:
            type: string
            enum:
              - arbitrum
              - base
              - ethereum
            title: Chain
            default: base
        - name: collateral_token
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                title: Token
                description: >-
                  A token identifier - either a supported symbol (e.g., USDC,
                  WETH) or a valid Ethereum address (0x...)
                examples:
                  - USDC
                  - WETH
                  - '0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8'
              - type: 'null'
            title: Collateral Token
            default: USDC
          description: >-
            Symbol or address of the collateral token to filter markets by.
            Optional parameter.
        - name: loan_token
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                title: Token
                description: >-
                  A token identifier - either a supported symbol (e.g., USDC,
                  WETH) or a valid Ethereum address (0x...)
                examples:
                  - USDC
                  - WETH
                  - '0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8'
              - type: 'null'
            title: Loan Token
            default: WETH
          description: >-
            Symbol or address of the loan token to filter markets by. Optional
            parameter.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MorphoGetMarketsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from compass_api_sdk import CompassAPI, models


            with CompassAPI(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as compass_api:

                res = compass_api.morpho.morpho_markets(chain=models.V1MorphoMarketsChain.BASE, collateral_token="USDC", loan_token="USDC")

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { CompassApiSDK } from "@compass-labs/api-sdk";

            const compassApiSDK = new CompassApiSDK({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await compassApiSDK.morpho.morphoMarkets({
                chain: "base",
                collateralToken: "USDC",
                loanToken: "USDC",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    MorphoGetMarketsResponse:
      properties:
        markets:
          items:
            $ref: '#/components/schemas/MorphoMarket'
          type: array
          title: Markets
          description: ' A list of markets matching the query.'
      type: object
      required:
        - markets
      title: MorphoGetMarketsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MorphoMarket:
      properties:
        uniqueKey:
          type: string
          title: Uniquekey
        lltv:
          type: integer
          title: Lltv
        oracleAddress:
          type: string
          title: Oracleaddress
        irmAddress:
          type: string
          title: Irmaddress
        state:
          $ref: >-
            #/components/schemas/compass__api_backend__v1__models__morpho__read__response__get_markets__MarketState
        weeklyApys:
          $ref: '#/components/schemas/WeeklyApys'
        collateralAsset:
          anyOf:
            - $ref: >-
                #/components/schemas/compass__api_backend__v1__models__morpho__read__response__get_markets__Asset
            - type: 'null'
        loanAsset:
          $ref: >-
            #/components/schemas/compass__api_backend__v1__models__morpho__read__response__get_markets__Asset
      type: object
      required:
        - uniqueKey
        - lltv
        - oracleAddress
        - irmAddress
        - state
        - weeklyApys
        - loanAsset
      title: MorphoMarket
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    compass__api_backend__v1__models__morpho__read__response__get_markets__MarketState:
      properties:
        borrowApy:
          type: number
          title: Borrowapy
        borrowAssets:
          type: integer
          title: Borrowassets
        borrowAssetsUsd:
          anyOf:
            - type: number
            - type: 'null'
          title: Borrowassetsusd
        supplyApy:
          type: number
          title: Supplyapy
        supplyAssets:
          type: integer
          title: Supplyassets
        supplyAssetsUsd:
          anyOf:
            - type: number
            - type: 'null'
          title: Supplyassetsusd
        fee:
          type: number
          title: Fee
        utilization:
          type: number
          title: Utilization
      type: object
      required:
        - borrowApy
        - borrowAssets
        - borrowAssetsUsd
        - supplyApy
        - supplyAssets
        - supplyAssetsUsd
        - fee
        - utilization
      title: MarketState
    WeeklyApys:
      properties:
        supplyApy:
          type: number
          title: Supplyapy
        netSupplyApy:
          type: number
          title: Netsupplyapy
        borrowApy:
          type: number
          title: Borrowapy
        netBorrowApy:
          type: number
          title: Netborrowapy
      type: object
      required:
        - supplyApy
        - netSupplyApy
        - borrowApy
        - netBorrowApy
      title: WeeklyApys
    compass__api_backend__v1__models__morpho__read__response__get_markets__Asset:
      properties:
        address:
          type: string
          title: Address
        symbol:
          type: string
          title: Symbol
        name:
          type: string
          title: Name
        decimals:
          type: integer
          title: Decimals
      type: object
      required:
        - address
        - symbol
        - name
        - decimals
      title: Asset
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````