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

# Historical Transactions

> This endpoint retrieves historical transactions for a user on the AAVE platform.

It returns a list of transactions including deposits, withdrawals, borrows, and
repayments. Each transaction includes details such as the token, amount, timestamp,
and transaction type. This provides a comprehensive view of the user's historical
activity within the AAVE protocol.

⚠️ Data comes from the official Aave subgraph (
https://github.com/aave/protocol-subgraphs)
and thus this particular endpoint may be less reliable than our other endpoints. ⚠️



## OpenAPI

````yaml /v1/combined_spec.json get /v1/aave/historical_transactions
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/historical_transactions:
    get:
      tags:
        - Aave V3
      summary: Historical Transactions
      description: >-
        This endpoint retrieves historical transactions for a user on the AAVE
        platform.


        It returns a list of transactions including deposits, withdrawals,
        borrows, and

        repayments. Each transaction includes details such as the token, amount,
        timestamp,

        and transaction type. This provides a comprehensive view of the user's
        historical

        activity within the AAVE protocol.


        ⚠️ Data comes from the official Aave subgraph (

        https://github.com/aave/protocol-subgraphs)

        and thus this particular endpoint may be less reliable than our other
        endpoints. ⚠️
      operationId: v1_aave_historical_transactions
      parameters:
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            default: 0
            title: Offset
          description: The offset of the first item to return.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            exclusiveMinimum: 0
            default: 100
            title: Limit
          description: The number of items to return.
        - name: chain
          in: query
          required: true
          schema:
            type: string
            enum:
              - arbitrum
              - base
              - ethereum
            title: Chain
            default: base
        - name: user_address
          in: query
          required: true
          schema:
            type: string
            title: User Address
            default: '0x3254f3b1918637ba924e3F18968Cb74219974b63'
          description: The address of the user to get historical transactions for.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AaveHistoricalTransactionsResponse'
        '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_historical_transactions(chain=models.V1AaveHistoricalTransactionsChain.BASE, user_address="0x3254f3b1918637ba924e3F18968Cb74219974b63", offset=0, limit=100)

                # 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.aaveHistoricalTransactions({
                offset: 0,
                limit: 100,
                chain: "base",
                userAddress: "0x3254f3b1918637ba924e3F18968Cb74219974b63",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    AaveHistoricalTransactionsResponse:
      properties:
        offset:
          type: integer
          title: Offset
          description: >-
            Specifies how many transactions to skip before returning results,
            letting you choose the starting point for the data you want to
            receive.
        limit:
          type: integer
          title: Limit
          description: >-
            Sets the maximum number of transactions to include in the response,
            helping control the size of the returned dataset.
        transactions:
          items:
            oneOf:
              - $ref: '#/components/schemas/Borrow'
              - $ref: '#/components/schemas/LiquidationCall'
              - $ref: '#/components/schemas/RedeemUnderlying'
              - $ref: '#/components/schemas/Repay'
              - $ref: '#/components/schemas/Supply'
              - $ref: '#/components/schemas/SwapBorrowRate'
              - $ref: '#/components/schemas/UsageAsCollateral'
            discriminator:
              propertyName: action
              mapping:
                Borrow:
                  $ref: '#/components/schemas/Borrow'
                LiquidationCall:
                  $ref: '#/components/schemas/LiquidationCall'
                RedeemUnderlying:
                  $ref: '#/components/schemas/RedeemUnderlying'
                Repay:
                  $ref: '#/components/schemas/Repay'
                Supply:
                  $ref: '#/components/schemas/Supply'
                SwapBorrowRate:
                  $ref: '#/components/schemas/SwapBorrowRate'
                UsageAsCollateral:
                  $ref: '#/components/schemas/UsageAsCollateral'
          type: array
          title: Transactions
      type: object
      required:
        - offset
        - limit
        - transactions
      title: AaveHistoricalTransactionsResponse
      description: Response model for getting Aave historical transactions.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Borrow:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        amount:
          type: number
          minimum: 0
          title: Amount
          description: Quantity of token
        borrowRateMode:
          type: integer
          enum:
            - 1
            - 2
          title: Borrowratemode
          description: >-
            The interest rate mode to borrow: 1 represents stable interest rate
            mode. 2 represents variable interest rate mode
          examples:
            - 1
            - 2
        reserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        assetPriceUSD:
          type: number
          minimum: 0
          title: Assetpriceusd
          description: Price of token in USD
        action:
          type: string
          const: Borrow
          title: Action
          description: The type of transaction
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - amount
        - borrowRateMode
        - reserve
        - assetPriceUSD
        - action
        - block
      title: Borrow
    LiquidationCall:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        collateralAmount:
          type: number
          title: Collateralamount
        collateralReserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        principalAmount:
          type: number
          title: Principalamount
        principalReserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        collateralAssetPriceUSD:
          type: number
          title: Collateralassetpriceusd
        borrowAssetPriceUSD:
          type: number
          title: Borrowassetpriceusd
        action:
          type: string
          const: LiquidationCall
          title: Action
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - collateralAmount
        - collateralReserve
        - principalAmount
        - principalReserve
        - collateralAssetPriceUSD
        - borrowAssetPriceUSD
        - action
        - block
      title: LiquidationCall
    RedeemUnderlying:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        amount:
          type: number
          minimum: 0
          title: Amount
          description: Quantity of token
        reserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        assetPriceUSD:
          type: number
          minimum: 0
          title: Assetpriceusd
          description: Price of token in USD
        action:
          type: string
          title: Action
          description: The type of transaction
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - amount
        - reserve
        - assetPriceUSD
        - action
        - block
      title: RedeemUnderlying
    Repay:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        amount:
          type: number
          minimum: 0
          title: Amount
          description: Quantity of token
        reserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        assetPriceUSD:
          type: number
          title: Assetpriceusd
        action:
          type: string
          const: Repay
          title: Action
          description: The type of transaction
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - amount
        - reserve
        - assetPriceUSD
        - action
        - block
      title: Repay
    Supply:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        amount:
          type: number
          minimum: 0
          title: Amount
          description: Quantity of token
        reserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        assetPriceUSD:
          type: number
          minimum: 0
          title: Assetpriceusd
          description: Price of token in USD
        action:
          type: string
          const: Supply
          title: Action
          description: The type of transaction
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - amount
        - reserve
        - assetPriceUSD
        - action
        - block
      title: Supply
    SwapBorrowRate:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        borrowRateModeFrom:
          type: integer
          title: Borrowratemodefrom
        borrowRateModeTo:
          type: integer
          title: Borrowratemodeto
        variableBorrowRate:
          type: integer
          title: Variableborrowrate
        stableBorrowRate:
          type: integer
          title: Stableborrowrate
        reserve:
          $ref: '#/components/schemas/Reserve'
          description: Stores information about Token
        action:
          type: string
          const: SwapBorrowRate
          title: Action
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - borrowRateModeFrom
        - borrowRateModeTo
        - variableBorrowRate
        - stableBorrowRate
        - reserve
        - action
        - block
      title: SwapBorrowRate
    UsageAsCollateral:
      properties:
        id:
          type: string
          title: Id
          description: The id of a historical transaction on aave
        timestamp:
          type: integer
          title: Timestamp
          description: Timestamp in unix time
        txHash:
          type: string
          title: Txhash
          description: >-
            Transaction hash. You can paste these into the search bar on
            etherscan
        fromState:
          type: boolean
          title: Fromstate
        toState:
          type: boolean
          title: Tostate
        reserve:
          $ref: '#/components/schemas/Reserve'
        action:
          type: string
          const: UsageAsCollateral
          title: Action
          description: The type of transaction
        block:
          type: integer
          title: Block
          readOnly: true
      type: object
      required:
        - id
        - timestamp
        - txHash
        - fromState
        - toState
        - reserve
        - action
        - block
      title: UsageAsCollateral
    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
    Reserve:
      properties:
        symbol:
          type: string
          title: Symbol
          description: Symbol of token.
        decimals:
          anyOf:
            - type: integer
            - type: 'null'
          title: Decimals
          description: Number of decimals of token.
        name:
          type: string
          title: Name
          description: Name of token
        underlyingAsset:
          type: string
          title: Underlyingasset
          description: Checksum address of Token.
          examples:
            - '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45'
      type: object
      required:
        - symbol
        - name
        - underlyingAsset
      title: Reserve
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````