openapi: 3.0.0 info: title: Pendle V2 API Docs Assets Transactions API description: "\n## Terms used in the documentation/API\n\nBelow are some terms used in the documentation/API:\n\n- Pendle Assets/Tokens: PT, YT, LP, SY\n- Non-Pendle Assets: other tokens that are not Pendle assets, such as USDC, USDT, DAI, etc.\n- Asset ID/Token Id: Is the combination of chain id and token address, e.g. 1-0x5fe30ac5cb1abb0e44cdffb2916c254aeb368650\n- Computing unit: Cost of an API call, this is use to rate limit the API calls. More on it at [our document](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limiting)\n- APY/APR/ROI Format: All APY, APR, and ROI values are returned as decimals. For example, 0.5 means 50%, 0.05 means 5%, 1.2 means 120%\n- Percentage Change Format: All percentage change values (e.g., 24h changes) are returned as decimals. For example, 0.05 means 5% change\n- Logarithmic Values: Some fields like `lnImpliedRate` are natural logarithms. To get the actual rate, use e^(value)\n\n## Recommended way to fetch data\n\nWe have a lot of markets, if you call an API for each market, it will be very slow and you will likely get rate limited. Therefore, in some APIs we support fetch all data at once (example the get all markets data, get all assets data/prices), you could use that to fetch all data at once. They also support filter by asset id, type, so if you don't want to fetch, you can filter it down to the specific ones you want.\n\nFor detailed documentation, visit:\n\n[https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview)\n\n## Support\n\n- We have a telegram for developers to ask about the API at [https://t.me/peepo_the_engineer_bot](https://t.me/peepo_the_engineer_bot)\n- We have an announcement channel for API updates at [https://t.me/pendledevelopers](https://t.me/pendledevelopers), follow it to get the latest updates on the API.\n\n## FAQ\n\n- How to fetch prices for assets?\n * Use [Get asset prices by IDs](#tag/assets/get/v1/prices/assets)\n\n- What if i want real time prices?\n * Price in our systems are calculate every 15 seconds. However, if you want real time prices, use [Swapping price](#tag/sdk/get/v1/sdk/{chainId}/markets/{market}/swapping-prices), it return price for PT/YT when swapping with underlying token and vice versa, we don't have real time prices for other assets.\n\n- Can i use the SDK to get price, instead of using the `swapping-price` endpoint?\n * **Don't use the SDK to get price**, we don't recommend it. SDK endpoints are designed for you to get the calldata for **sending transaction**, not for getting the price. Also, SDK endpoints are very costly and will get rate limited easily if you use it to get price of many tokens. \n\n- How to get token names, expiries, etc?\n * Use [Get asset metadata by IDs](#tag/assets/get/v1/assets/all)\n\n- Do you have historical data, breakdown to minutes?\n * No we don't, all historical data is aggregated to hourly/daily/weekly data.\n" version: '1.0' contact: {} servers: - url: http://127.0.0.1:9000 tags: - name: Transactions paths: /v5/{chainId}/transactions/{address}: get: description: 'Return transactions with: user action (long or short yield, add or remove liquidity), valuation, implied apy. **Pagination**: This endpoint supports cursor-based pagination using `resumeToken`. The response includes a `resumeToken` field that can be used in the next request to fetch the next page of results. This is more efficient than using `skip` for large datasets.' operationId: TransactionsController_transactionsV5 parameters: - name: chainId required: true in: path schema: type: number - name: address required: true in: path schema: type: string - name: type required: false in: query description: 'Transaction type to filter by. Valid values: `TRADES`, `LIQUIDITY`.' schema: $ref: '#/components/schemas/TransactionType' - name: minValue required: false in: query description: Minimum transaction value filter in USD schema: type: number - name: txOrigin required: false in: query description: Address of the transaction executor schema: type: string - name: action required: false in: query description: 'Specific transaction action to filter by. Valid values: `LONG_YIELD`, `SHORT_YIELD`, `ADD_LIQUIDITY`, `REMOVE_LIQUIDITY`.' schema: $ref: '#/components/schemas/TransactionAction' - name: resumeToken required: false in: query description: Resume token for pagination. Use this to continue a previous query. schema: type: string - name: limit required: false in: query description: Maximum number of results to return. The parameter is capped at 1000. schema: default: 10 type: number - name: skip required: false in: query deprecated: true description: Use `resumeToken` instead. schema: type: number responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/TransactionsV5Response' summary: Get market transactions by address tags: - Transactions x-computing-unit: '5' x-retail-api-rank: 6969 /v1/pnl/transactions: get: description: 'Returns the on-chain transaction history for a user address across all Pendle operations. Results are paginated. Use the `resumeToken` from the response to fetch the next page. Data may lag chain tip by a few minutes due to indexing.' operationId: TransactionsController_getTransactions parameters: - name: skip required: false in: query description: Number of results to skip. The parameter is capped at 1000. schema: default: 0 type: number - name: limit required: false in: query description: Maximum number of results to return. The parameter is capped at 1000. schema: default: 10 type: number - name: chainId required: false in: query description: Chain ID schema: type: number - name: user required: true in: query schema: type: string - name: market required: false in: query description: Market address schema: type: string responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/TransactionsResponseEntity' summary: Get user transaction history tags: - Transactions x-computing-unit: '8' x-retail-api-rank: 6969 components: schemas: TransactionsResponseEntity: type: object properties: total: type: number description: Total number of matching transactions results: description: Paginated list of transactions type: array items: $ref: '#/components/schemas/PnLTransactionEntity' required: - total - results PnLTransactionEntity: type: object properties: chainId: type: number description: Chain ID where the transaction occurred market: type: string description: LP market contract address user: type: string description: User wallet address timestamp: format: date-time type: string description: Block timestamp of the transaction action: type: string enum: - addLiquidityDualTokenAndPt - addLiquiditySinglePt - addLiquiditySingleToken - addLiquiditySingleTokenKeepYt - removeLiquidityDualTokenAndPt - removeLiquidityToPt - removeLiquiditySingleToken - mintPy - redeemPy - swapYtToPt - swapPtToYt - redeemYtRewards - redeemYtYield - redeemMarketRewards - buyPt - sellPt - transferPtIn - transferPtOut - buyYt - sellYt - transferYtIn - transferYtOut - transferLpIn - transferLpOut - sellYtLimitOrder - buyYtLimitOrder - sellPtLimitOrder - buyPtLimitOrder description: Type of Pendle operation performed (swap, liquidity, limit order, mint/redeem, transfer, or reward claim) ptData: description: PT token balance change and cost basis for this transaction allOf: - $ref: '#/components/schemas/SpendUnitData' ytData: description: YT token balance change and cost basis for this transaction allOf: - $ref: '#/components/schemas/SpendUnitData' lpData: description: LP token balance change and cost basis for this transaction allOf: - $ref: '#/components/schemas/SpendUnitData' priceInAsset: description: Prices of PT, YT, and LP in the market's accounting asset at the time of the transaction allOf: - $ref: '#/components/schemas/PriceAssetData' profit: description: Profit or loss of the transaction allOf: - $ref: '#/components/schemas/ValuationEntity' txValueAsset: type: number description: Total value of the transaction in asset assetUsd: type: number description: Market asset price in USD assetEth: type: number description: Market asset price in ETH ptExchangeRate: type: number description: PT exchange rate at the time of the transaction effectivePtExchangeRate: type: number description: Effective PT exchange rate of this transaction ptExchangeRateAfter: type: number description: PT exchange rate of market after the transaction txHash: type: string description: Transaction hash required: - chainId - market - user - timestamp - action - ptData - ytData - lpData - priceInAsset - profit - txValueAsset - assetUsd - assetEth - ptExchangeRate TransactionV5Response: type: object properties: id: type: string description: Unique identifier of the transaction market: type: string description: Market address where the transaction occurred timestamp: format: date-time type: string description: Timestamp when the transaction occurred chainId: type: number description: Chain ID where the transaction occurred txHash: type: string description: Transaction hash on the blockchain value: type: number description: Transaction value in USD type: type: string description: Transaction type (e.g., TRADES, ADD_LIQUIDITY, REMOVE_LIQUIDITY) action: type: string description: Transaction action (e.g., BUY_PT, SELL_PT, ADD_LIQUIDITY_DUAL) txOrigin: type: string description: Original transaction sender address impliedApy: type: number description: Weighted average implied APY for this transaction notional: description: Notional amounts traded (only for TRADES type) allOf: - $ref: '#/components/schemas/NotionalV5' required: - id - market - timestamp - chainId - txHash - value - type - action - impliedApy PriceAssetData: type: object properties: pt: type: number description: PT price in the market's accounting asset at the time of the transaction yt: type: number description: YT price in the market's accounting asset at the time of the transaction lp: type: number description: LP price in the market's accounting asset at the time of the transaction required: - pt - yt - lp TransactionAction: type: string enum: - LONG_YIELD - SHORT_YIELD - ADD_LIQUIDITY - REMOVE_LIQUIDITY ValuationEntity: type: object properties: usd: type: number asset: type: number eth: type: number required: - usd - asset - eth TransactionsV5Response: type: object properties: total: type: number description: Total number of transactions available resumeToken: type: string description: Resume token for pagination. Use this to continue a previous query. Use this token in the next request. Can be undefined if the query is at the end of the results. limit: type: number description: Maximum number of results returned skip: type: number description: Number of results skipped for pagination results: description: List of transactions type: array items: $ref: '#/components/schemas/TransactionV5Response' required: - total - limit - skip - results TransactionType: type: string enum: - TRADES - LIQUIDITY NotionalV5: type: object properties: pt: type: number description: Notional amount of PT traded required: - pt SpendUnitData: type: object properties: unit: type: number description: Balance of user in wei spent_v2: description: Total spent to purchase this asset allOf: - $ref: '#/components/schemas/ValuationEntity' required: - unit - spent_v2