Amberdata DeFi API

Decentralized finance (DEX and lending) data.

OpenAPI Specification

amberdata-defi-openapi.yaml Raw ↑
openapi: 3.1.0
info:
  title: Defi API
  version: '2'
servers:
  - url: https://api.amberdata.com/defi
security:
  - sec0: []
paths:
  /lending/{protocolId}/protocol:
    get:
      summary: Protocol Lens
      description: >-
        This API retrieves information about all of the actions that occurred on
        the protocol within a certain timespan.
      operationId: defi-lending-protocol-lens
      parameters:
        - name: protocolId
          in: path
          schema:
            type: string
            enum:
              - aavev2
              - aavev3
              - makerdao
              - compoundv2
            default: aavev2
          required: true
        - name: startDate
          in: query
          description: >-
            **[Optional]** Payload only includes data after this date
            (inclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: endDate
          in: query
          description: >-
            **[Optional]** Payload only includes data before this date
            (exclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: size
          in: query
          description: >-
            **[Optional]** Number of records per page. If not specified, the API
            will default to and try to return 1000 actions under
            **payload.data**.
          schema:
            type: integer
            format: int32
        - name: direction
          in: query
          description: >-
            **[Optional]** The order in which to return the results (ascending
            or descending). By default. records are returned in ascending order,
            so the oldest records are returned first.
          schema:
            type: string
            enum:
              - asc
              - desc
        - name: timeFormat
          in: query
          schema:
            type: string
            enum:
              - milliseconds
              - ms
              - iso
              - iso8601
              - hr
              - human_readable
        - name: x-amberdata-blockchain-id
          in: header
          description: >-
            **[Optional]** The id of the blockchain for which you want protocol
            data from. Defaults to `ethereum-mainnet` if not specified. Use the
            [Information
            Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols)
            API to view the supported protocol and blockchain id combinations.
          schema:
            type: string
            enum:
              - ethereum-mainnet
              - polygon-mainnet
              - avalanche-mainnet
              - arbitrum-mainnet
              - optimism-mainnet
            default: polygon-mainnet
        - name: action
          in: query
          description: '**[Optional]** Payload only includes data filtered by the action.'
          schema:
            type: string
            enum:
              - Deposit
              - Withdraw
              - LiquidationCall
              - Repay
              - Borrow
              - FlashLoan
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    default: 0
                  title:
                    type: string
                    example: OK
                  description:
                    type: string
                    example: Successful request
                  payload:
                    type: object
                    properties:
                      metadata:
                        type: object
                        properties:
                          next:
                            type: string
                            example: >-
                              https://api.amberdata.com/defi/lending/aavev2/protocol?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCAJYB28SArmoQIJJIAqEONAzjvBhUoNAKJEaMXlgBmOJL0KUhAW0IAxKBBU4YWEAAsGOmgCVCONDgBGSQhRBoqEQoOE19LAMoBhB7xgcCBgAEV17TABGADZoyIAGAHYATkSSaPjMykIaNDCYCJi4yPSAFkyKyl4qAC8IkABmB2YiJCgwQggAWShmWXlFShktHT1sACteEQcwHABzQsotKjnaeS9A4PzC2ISUjIr4pYgVtaRRXO2sIsiS6PLDgF8gA
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            action:
                              type: string
                              example: UseReserveAsCollateral
                            timestamp:
                              type: string
                              example: 2022-08-21 11:00:03 000
                            blockNumber:
                              type: integer
                              example: 15383603
                              default: 0
                            transactionHash:
                              type: string
                              example: >-
                                0x0bee33572d60aaf827adb727c0db3fc72f78c7c80257c69bafa37c180907666d
                            logIndex:
                              type: integer
                              example: 529
                              default: 0
                            assetId:
                              type: string
                              example: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
                            assetSymbol:
                              type: string
                              example: STETH
                            marketId:
                              type: string
                              example: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5'
                            market:
                              type: string
                              example: main
                            reserveAsCollateralEnabled:
                              type: boolean
                              example: true
                              default: true
                            user:
                              type: string
                              example: '0xb9428f4e0c0c104f89dfd1fd3f4ca89549666666'
      deprecated: false
  /lending/{protocolId}/wallets/{walletAddress}:
    get:
      summary: Wallet Lens
      description: >-
        This API retrieves information about all of the actions taken by a
        specific wallet on the protocol within a certain timespan.
      operationId: defi-lending-wallet-lens
      parameters:
        - name: protocolId
          in: path
          schema:
            type: string
            enum:
              - aavev2
              - aavev3
              - compoundv2
              - makerdao
            default: aavev2
          required: true
        - name: startDate
          in: query
          description: >-
            **[Optional]** Payload only includes data after this date
            (inclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
            default: '2022-09-01'
        - name: endDate
          in: query
          description: >-
            **[Optional]** Payload only includes data before this date
            (exclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
            default: '2022-10-31'
        - name: size
          in: query
          description: >-
            **[Optional]** Number of records per page. If not specified, the API
            will default to and try to return 1000 actions under
            **payload.data**.
          schema:
            type: integer
            format: int32
        - name: direction
          in: query
          description: >-
            **[Optional]** The order in which to return the results (ascending
            or descending). By default. records are returned in ascending order,
            so the oldest records are returned first.
          schema:
            type: string
            enum:
              - asc
              - desc
        - name: timeFormat
          in: query
          description: '**[Optional]** Time format of the timestamps in the return payload.'
          schema:
            type: string
            enum:
              - milliseconds
              - ms
              - iso
              - iso8601
              - hr
              - human_readable
        - name: x-amberdata-blockchain-id
          in: header
          description: >-
            **[Optional]** The id of the blockchain for which you want protocol
            data from. Defaults to `ethereum-mainnet` if not specified. Use the
            [Information
            Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols)
            API to view the supported protocol and blockchain id combinations.
          schema:
            type: string
            enum:
              - ethereum-mainnet
              - polygon-mainnet
              - avalanche-mainnet
              - arbitrum-mainnet
              - optimism-mainnet
        - name: walletAddress
          in: path
          description: The wallet address
          schema:
            type: string
            default: '0x1ec5878ffc42e6d5d80422bdd06cf0712e5611fd'
          required: true
        - name: action
          in: query
          description: '**[Optional]** Payload only includes data filtered by the action.'
          schema:
            type: string
            enum:
              - Deposit
              - Withdraw
              - LiquidationCall
              - Repay
              - Borrow
              - FlashLoan
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    default: 0
                  title:
                    type: string
                    example: OK
                  description:
                    type: string
                    example: Successful request
                  payload:
                    type: object
                    properties:
                      metadata:
                        type: object
                        properties:
                          next:
                            type: string
                            example: >-
                              https://api.amberdata.com/defi/lending/aavev2/wallets/0xe26684de8d5a40a35c3fc15c9328c7f3a523759b?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCAJYB28SArmoQIJJIAqEONAzjvBhUoNAKJEaMXlgBmOJL0KUhAW0IAxKBBU4YWEAAsGOmgCVCONDgBGSQhRBoqEQoOE19LAMoBhB7xgcCBgAEV17TABGADZoyMiSAAYAFmSAZkTMykIaNDCYCJi4hOjkzPLKXioALwiQNIdmIiQoMEIIAFkoZll5RUoZLR09bAArXhEHMBwAc0LKLSoZ2nkvQOD8wtjIxIB2AE5o8qyQReWaeVFczawi%2BJJS48SAXyA
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            action:
                              type: string
                              example: Withdraw
                            timestamp:
                              type: string
                              example: 2022-08-21 11:09:05 000
                            blockNumber:
                              type: integer
                              example: 15383647
                              default: 0
                            transactionHash:
                              type: string
                              example: >-
                                0xc03a13328450f14094551250865c7e3b3f97ccae37a3cc1079efed098033c2b7
                            logIndex:
                              type: integer
                              example: 669
                              default: 0
                            assetId:
                              type: string
                              example: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
                            assetSymbol:
                              type: string
                              example: WETH
                            marketId:
                              type: string
                              example: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5'
                            market:
                              type: string
                              example: main
                            amount:
                              type: number
                              example: 0.4072108498457563
                              default: 0
                            user:
                              type: string
                              example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
                            to:
                              type: string
                              example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
      deprecated: false
  /lending/{protocolId}/assets/{asset}:
    get:
      summary: Asset Lens
      description: >-
        This API retrieves information about all of the actions that occurred
        for a specific asset on the protocol within a certain timespan.
      operationId: defi-lending-asset-lens
      parameters:
        - name: protocolId
          in: path
          schema:
            type: string
            enum:
              - aavev2
              - aavev3
              - compoundv2
              - makerdao
            default: aavev2
          required: true
        - name: startDate
          in: query
          description: >-
            **[Optional]** Payload only includes data after this date
            (inclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: endDate
          in: query
          description: >-
            **[Optional]** Payload only includes data before this date
            (exclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: size
          in: query
          description: >-
            **[Optional]** Number of records per page. If not specified, the API
            will default to and try to return 1000 actions under
            **payload.data**.
          schema:
            type: integer
            format: int32
        - name: direction
          in: query
          description: >-
            **[Optional]** The order in which to return the results (ascending
            or descending). By default. records are returned in ascending order,
            so the oldest records are returned first.
          schema:
            type: string
            enum:
              - asc
              - desc
        - name: timeFormat
          in: query
          description: '**[Optional]** Time format of the timestamps in the return payload.'
          schema:
            type: string
            enum:
              - milliseconds
              - ms
              - iso
              - iso8601
              - hr
              - human_readable
        - name: x-amberdata-blockchain-id
          in: header
          description: >-
            **[Optional]** The id of the blockchain for which you want protocol
            data from. Defaults to `ethereum-mainnet` if not specified. Use the
            [Information
            Protocols](https://docs.amberdata.io/reference/defi-lending-information-protocols)
            API to view the supported protocol and blockchain id combinations.
          schema:
            type: string
            enum:
              - ethereum-mainnet
              - polygon-mainnet
              - avalanche-mainnet
              - arbitrum-mainnet
              - optimism-mainnet
        - name: asset
          in: path
          description: '**[Examples]** `WETH` The token symbol'
          schema:
            type: string
            default: WETH
          required: true
        - name: action
          in: query
          description: >-
            **[Optional]** Payload only includes data filtered by the
            action.<BR>**[Examples]**
            `UseReserveAsCollateral|Deposit|Withdraw|LiquidationCall|Repay|Borrow|FlashLoan`
          schema:
            type: string
            enum:
              - Deposit
              - Withdraw
              - LiquidationCall
              - Repay
              - Borrow
              - FlashLoan
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    default: 0
                  title:
                    type: string
                    example: OK
                  description:
                    type: string
                    example: Successful request
                  payload:
                    type: object
                    properties:
                      metadata:
                        type: object
                        properties:
                          next:
                            type: string
                            example: >-
                              https://api.amberdata.com/defi/lending/aavev2/assets/WETH?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCALY4QDWhMWAdgK5JKUCWz8SraQgEEOAFQg5mAZxzwYXKMwCiRZjClYAZjiRTCleVUIAxKBBpNsAC1Y1mAJUI40OAEZJCFEGi4RCchWYsECEAZQBhLykYWhgAERwYT0wARgA2NJSABgAOFJSAFgBWLNLKQmY0BKSsdMyUkjSC0pbKKS4AL2SQAGYvQSIkKDBCCABZKEEtHT1KTTMLYIArKUUvMBwAc2SUyjMuTZ4dUJiIeMSdjOyAdgBONJaykH3D5h0lSurL%2Bsbmx8ocFI9DB0MEsgAPeBZEh4HA9W6uEgkHqaQg5NBZHBZQhFeAFTQka5ONC3XI9eDXIppeDwMgAXyAA
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            action:
                              type: string
                              example: Withdraw
                            timestamp:
                              type: string
                              example: 2022-08-21 11:09:05 000
                            blockNumber:
                              type: integer
                              example: 15383647
                              default: 0
                            transactionHash:
                              type: string
                              example: >-
                                0xc03a13328450f14094551250865c7e3b3f97ccae37a3cc1079efed098033c2b7
                            logIndex:
                              type: integer
                              example: 669
                              default: 0
                            assetId:
                              type: string
                              example: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
                            assetSymbol:
                              type: string
                              example: WETH
                            marketId:
                              type: string
                              example: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5'
                            market:
                              type: string
                              example: main
                            amount:
                              type: number
                              example: 0.4072108498457563
                              default: 0
                            user:
                              type: string
                              example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
                            to:
                              type: string
                              example: '0xe26684de8d5a40a35c3fc15c9328c7f3a523759b'
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value: '{}'
              schema:
                type: object
                properties: {}
      deprecated: false
  /lending/{protocolId}/governance:
    get:
      summary: Governance Lens
      description: >-
        This API retrieves information about all of the governance actions that
        occurred for the protocol within a certain timespan.
      operationId: defi-lending-governance-lens
      parameters:
        - name: startDate
          in: query
          description: >-
            Payload only includes data after this date
            (inclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
            default: '2022-09-01'
        - name: endDate
          in: query
          description: >-
            Payload only includes data before this date
            (exclusive).<BR>**[Formats]** `seconds | milliseconds |
            iso8601`<BR>**[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
            default: '2022-09-30'
        - name: size
          in: query
          description: Number of records per page
          schema:
            type: integer
            format: int32
        - name: direction
          in: query
          description: >-
            The order in which to return the results (ascending or descending).
            By default. records are returned in descending order, so the most
            recent records are returned first.
          schema:
            type: string
        - name: timeFormat
          in: query
          description: >-
            Time format of the timestamps in the return
            payload.<BR/>**[Defaults]** `milliseconds | ms* | iso | iso8601 | hr
            | human_readable`
          schema:
            type: string
        - name: proposalId
          in: query
          description: The proposal id to filter results by
          schema:
            type: string
        - name: address
          in: query
          description: The wallet address to filter results by
          schema:
            type: string
        - name: support
          in: query
          description: Filter results by votes for or votes against
          schema:
            type: boolean
        - name: protocolId
          in: path
          description: >-
            **Note**: Aave has the same governance regardless of protocol
            version (v2 vs. v3).
          schema:
            type: string
            enum:
              - aavev2
              - aavev3
              - compoundv2
              - makerdao
            default: aavev2
          required: true
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    default: 0
                  title:
                    type: string
                    example: OK
                  description:
                    type: string
                    example: Successful request
                  payload:
                    type: object
                    properties:
                      metadata:
                        type: object
                        properties:
                          next:
                            type: string
                            example: >-
                              https://api.amberdata.com/defi/lending/aavev3/governance?cursor=N4IgRgNg9gxg1jAFgQwJYDsCSATEAuEARhgE5SA2EgBnIFYAzGbY%2BkAGhAAcAnKAF1hQIOfCGTIAbgFMJAZnYg%2BqALZSAYlG7LkfUYgCu29ACUpybMkhSF2VNykwlUdKICCAZQDCCgM59k3HwAIjrWeITkACyEtAAc5ADssrRUqRxS6NghfGERkbJJsgBM5LGpVBw%2BqABeYSDyHPSa2roEAFY%2BzgqcyADmuRyaqL0YyBDu-oHZuVGEVIQJsUXlFSBDI%2BhjAKKZ0-h5BbLFpeUcEMh%2BACoqUn7Iypz7s3GJyWcXfAAyUL2YmVIAD3wRRK7z8AAVeJwoD4xiICLRIiAAL5AA
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            action:
                              type: string
                              example: Proposal
                            proposalId:
                              type: string
                              example: '54'
                            timestamp:
                              type: string
                              example: 2022-01-06 07:07:31 000
                            title:
                              type: string
                              example: Risk Parameter Updates 2021-12-29
                            shortDescription:
                              type: string
                              example: Risk parameter updates
                            ipfsHash:
                              type: string
                              example: QmZc8PLPsfT98kiVuECZDYh4nJgjwSgthNNBNhGz5kCTfZ
                            creator:
                              type: string
                              example: '0x683a4f9915d6216f73d6df50151725036bd26c02'
      deprecated: false
  /lending/protocols/information:
    get:
      summary: Information - Lending Protocols
      description: >-
        This API lists the supported DeFi lending protocols and provides
        snapshots of aggregate metrics.
      operationId: defi-lending-information-protocols
      parameters:
        - name: blockchain
          in: query
          description: The blockchainId or blockchain slug to filter results by
          schema:
            type: string
            enum:
              - ethereum-mainnet
              - polygon-mainnet
              - avalanche-mainnet
              - arbitrum-mainnet
              - optimism-mainnet
        - name: protocol
          in: query
          description: The protocol to filter results by
          schema:
            type: string
            enum:
              - makerdao
              - compound
              - compoundv2
              - aave
              - aavev2
              - aavev3
        - name: endDate
          in: query
          description: >-
            **[Optional]** If provided, returns the associated state of this
            protocol up to the specified date. <BR>**[Examples]** `2023-01-01`
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    default: 0
                  title:
                    type: string
                    example: OK
                  description:
                    type: string
                    example: Successful request
                  payload:
                    type: array
                    items:
                      type: object
                      properties:
                        protocolId:
                          type: string
                          example: aavev2
                        protocolName:
                          type: string
                          example: aave
                        protocolVersion:
                          type: string
                          example: v2
                        blockchain:
                          type: string
                          example: ethereum-mainnet
                        numAssets:
                          type: integer
                          example: 37
                          default: 0
                        totalDepositedUSD:
                          type: number
                          example: 2450326532.6253276
                          default: 0
                        totalCollateralUSD:
                          type: number
                          example: 2411068465.347387
                          default: 0
                        totalBorrowedUSD:
                          type: number
                          example: 601548244.8033507
                          default: 0
      deprecated: false
  /lending/assets/information:
    get:
      summary: Information - Assets in Lending Protocols
      description: >-
        This API lists the supported assets across the available lending
        protocols and provides snapshots of aggregate metrics.
      operationId: defi-lending-information-assets
      parameters:
        - name: blockchain
          in: query
          description: The blockchainId or blockchain slug to filter results by
          schema:
            type: string
            enum:
              - ethereum-mainnet
              - polygon-mainnet
              - avalanche-mainnet
              - arbitrum-mainnet
              - optimism-mainnet
        - name: protocol
          in: query
          description: The protocol to filter results by
          schema:
            type: string
            enum:
              - makerdao
              - compound
              - compoundv2
              - compoundv3
              - aave
              - aavev2
              - aavev3
        - name: asset
          in: query
          description: The asset id or symbol to filter the results by.
          schema:
            type: string
        - name: market
          in: query
          description: The market id or name to filter the results by.
          schema:
            type: string
        - name: endDate
          in: query
          description: >-
            **[Optional]** If provided, returns the associated state of this
            asset up to the specified date since the first transaction involving
            this asset. <BR><BR>If not specified, returns the **current** (now)
            state of the asset since the first transaction involving the asset.
            <BR><BR>**[Examples]** `2023-01-01`
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    default: 0
                  title:
                    type: string
                    example: OK
                  description:
                    type: string
                    example: Successful request
                  payload:
                    type: array
                    items:
                      type: object
                      properties:
                        protocolId:
                          type: string
                          example: aavev2
                        protocolName:
                          type: string
                          example: aave
                        protocolVersion:
                          type: string
                          example: v2
                        blockchain:
                          type: string
                          example: ethereum-mainnet
                        assetId:
                          type: string
                          example: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'
                        assetSymbol:
                          type: string
                          example: WBTC
                        market:
                          type: string
                          example: main
        

# --- truncated at 32 KB (90 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/amberdata/refs/heads/main/openapi/amberdata-defi-openapi.yaml