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

# Protocol Lens

> This API retrieves information about all of the actions that occurred on the protocol within a certain timespan.



## OpenAPI

````yaml get /lending/{protocolId}/protocol
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
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      x-default: API_KEY
      name: x-api-key

````