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

# Positions - per Token

> This endpoint retrieves the user's position for a specific token on the AAVE
platform.

It provides key financial metrics including the current aToken balance, current
stable debt, current variable debt, principal stable debt, principal variable debt,
stable borrow rate, stable borrow rate for new loans, variable borrow rate, and
liquidity rate. These metrics are calculated by aggregating data across all open
positions held by the user for the specified token, offering a detailed view of
their financial standing within the AAVE ecosystem.



## OpenAPI

````yaml /v1/combined_spec.json get /v1/aave/user_position_per_token
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/aave/user_position_per_token:
    get:
      tags:
        - Aave V3
      summary: Positions - per Token
      description: >-
        This endpoint retrieves the user's position for a specific token on the
        AAVE

        platform.


        It provides key financial metrics including the current aToken balance,
        current

        stable debt, current variable debt, principal stable debt, principal
        variable debt,

        stable borrow rate, stable borrow rate for new loans, variable borrow
        rate, and

        liquidity rate. These metrics are calculated by aggregating data across
        all open

        positions held by the user for the specified token, offering a detailed
        view of

        their financial standing within the AAVE ecosystem.
      operationId: v1_aave_user_position_per_token
      parameters:
        - name: chain
          in: query
          required: true
          schema:
            type: string
            enum:
              - arbitrum
              - base
              - ethereum
            title: Chain
            default: base
        - name: block
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Block
          description: Optional block number (defaults to latest).
        - name: user
          in: query
          required: true
          schema:
            type: string
            title: User
            default: '0x3254f3b1918637ba924e3F18968Cb74219974b63'
          description: The user to fetch the token-specific position of.
        - name: token
          in: query
          required: true
          schema:
            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'
            default: USDC
          description: The symbol or address of the asset to fetch the user's position on..
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AaveUserPositionPerTokenResponse'
        '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.aave_v3.aave_user_position_per_token(chain=models.V1AaveUserPositionPerTokenChain.BASE, user="0x3254f3b1918637ba924e3F18968Cb74219974b63", 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.aaveV3.aaveUserPositionPerToken({
                chain: "base",
                user: "0x3254f3b1918637ba924e3F18968Cb74219974b63",
                token: "USDC",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    AaveUserPositionPerTokenResponse:
      properties:
        token_balance:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Token Balance
          description: >-
            The balance of AAVE aTokens (interest-bearing representations of
            your deposits).
        stable_debt:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Stable Debt
          description: The amount of the user's debt with a fixed interest rate.
        variable_debt:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Variable Debt
          description: The amount of the user's debt with a variable interest rate.
        principal_stable_debt:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Principal Stable Debt
          description: >-
            The amount of the user's debt that was part of the initial principal
            of all
                    loans with a stable interest rate.
        principal_variable_debt:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Principal Variable Debt
          description: >-
            The amount of the user's debt that was part of the initial principal
            of all
                    loans with a variable interest rate. This is the value stored by AAVE, which may be slightly
                    inaccurate, but reflects what AAVE believes you initially paid.
        stable_borrow_rate:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Stable Borrow Rate
          description: >-
            The current average annualised interest rate for all your stable
            loans in
                    this pool.
        stable_borrow_rate_for_new_loans:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Stable Borrow Rate For New Loans
          description: The annualised interest rate you would pay on a new stable loan.
        variable_borrow_rate:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Variable Borrow Rate
          description: >-
            The current annualised interest rate for variable rate loans in this
            pool.
                    (This applies to both current and new loans.)
        liquidity_rate:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Liquidity Rate
          description: The annualised interest rate for deposited supplies.
      type: object
      required:
        - token_balance
        - stable_debt
        - variable_debt
        - principal_stable_debt
        - principal_variable_debt
        - stable_borrow_rate
        - stable_borrow_rate_for_new_loans
        - variable_borrow_rate
        - liquidity_rate
      title: AaveUserPositionPerTokenResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````