openapi: 3.0.0 info: title: Pendle V2 API Docs Assets Limit Orders 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: Limit Orders paths: /v2/limit-orders: get: description: "This endpoint is for analytics purpose, if you want to analyze the limit orders data, this endpoint return all the orders that have been made, including the ones that have been cancelled or fully filled. \n\nThe results could be very large, so each time we returns at most 1000 orders, you can use the resumeToken to fetch the next page. \n\nTo get limit order for filling, use the [Get limit orders to match by YT address​](#tag/limit-orders/get/v1/limit-orders/takers/limit-orders) endpoint!" operationId: LimitOrdersController_getAllLimitOrders parameters: - name: chainId required: false in: query description: Chain id to filter by, leave blank to fetch all chains. schema: type: number - name: limit required: false in: query description: Maximum number of results to return. The parameter is capped at 1000. schema: default: 100 type: number - name: maker required: false in: query description: Maker address to filter orders by schema: type: string - name: yt required: false in: query description: Market address to filter orders by schema: type: string - name: timestamp_start required: false in: query schema: format: date-time type: string - name: timestamp_end required: false in: query schema: format: date-time type: string - name: resumeToken required: false in: query description: Resume token for pagination schema: type: string responses: '200': description: Returns limit orders with resume token content: application/json: schema: $ref: '#/components/schemas/LimitOrdersV2Response' summary: Get all limit orders for analytics tags: - Limit Orders x-computing-unit: '3' x-retail-api-rank: 6969 /v2/limit-orders/archived: get: description: 'This have the same interface and usecase as the endpoint above, but it returns the archived orders When an order is not fillable anymore, we **might** archive it to save storage space, to fetch it, use this endpoint. So to fetch full limit orders in history, using this and the endpoint above. Not all orders are archived, it depends on some conditions.' operationId: LimitOrdersController_getAllArchivedLimitOrders parameters: - name: chainId required: false in: query description: Chain id to filter by, leave blank to fetch all chains. schema: type: number - name: limit required: false in: query description: Maximum number of results to return. The parameter is capped at 1000. schema: default: 100 type: number - name: maker required: false in: query description: Maker address to filter orders by schema: type: string - name: yt required: false in: query description: Market address to filter orders by schema: type: string - name: timestamp_start required: false in: query schema: format: date-time type: string - name: timestamp_end required: false in: query schema: format: date-time type: string - name: resumeToken required: false in: query description: Resume token for pagination schema: type: string responses: '200': description: Returns archived limit orders with resume token content: application/json: schema: $ref: '#/components/schemas/LimitOrdersV2Response' summary: Get all archived limit orders for analytics tags: - Limit Orders x-computing-unit: '3' x-retail-api-rank: 6969 /v1/limit-orders/makers/limit-orders: get: description: 'Returns the active and historical limit orders placed by a specific user in a market. Supports richer filtering than the analytics endpoint (e.g. by YT, status, market). A user can have at most 50 open orders per market, so pagination is typically unnecessary here. For full cross-user analytics with cursor-based pagination, use [Get all limit orders](#tag/limit-orders/get/v2/limit-orders) instead.' operationId: LimitOrdersController_getMakerLimitOrder 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 100. schema: default: 10 type: number - name: chainId required: true in: query description: ChainId schema: type: number - name: maker required: true in: query description: Maker's address schema: type: string - name: yt required: false in: query description: Order's YT address schema: type: string - name: type required: false in: query description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' schema: enum: - 0 - 1 - 2 - 3 type: number - name: isActive required: false in: query description: isActive=true to get all maker's active orders, isActive=false otherwise and do not set isActive if you want to fetch all maker's orders schema: type: boolean responses: '201': description: Returns limit orders content: application/json: schema: $ref: '#/components/schemas/LimitOrdersResponse' summary: Get user limit orders in market tags: - Limit Orders x-computing-unit: '3' x-retail-api-rank: 6969 post: description: 'Submit a signed limit order to the Pendle order book. Once created, the order is visible to takers and will be filled against incoming swaps at or better than the specified implied APY. Before calling this, generate the order payload via [Generate limit order data](#tag/limit-orders/post/v1/limit-orders/makers/generate-limit-order-data), sign it with your wallet, and include the signature in the request body. Common rejection reasons: the YT or market is not whitelisted for limit orders, the order has already expired, or the signature is invalid.' operationId: LimitOrdersController_createOrder parameters: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateLimitOrderDto' responses: '201': description: Returns created limit order content: application/json: schema: $ref: '#/components/schemas/LimitOrderResponse' '400': description: Validation failed content: application/json: schema: $ref: '#/components/schemas/HttpErrorResponse' '422': description: Validation failed - unsupported token content: application/json: schema: $ref: '#/components/schemas/HttpErrorResponse' summary: Create limit order tags: - Limit Orders x-computing-unit: '3' x-retail-api-rank: 1 /v1/limit-orders/makers/generate-limit-order-data: post: description: 'Generate the EIP-712 typed data payload for a limit order. Sign the returned data with the maker''s private key, then submit the order via [Create limit order](#tag/limit-orders/post/v1/limit-orders/makers/limit-orders). The generated order specifies the YT address, direction (long or short yield), size, and implied APY target. The order remains valid until it is either fully filled, cancelled, or expired.' operationId: LimitOrdersController_generateLimitOrderData parameters: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/GenerateLimitOrderDataDto' responses: '201': description: Return generated limit order data content: application/json: schema: $ref: '#/components/schemas/GenerateLimitOrderDataResponse' '400': description: Validation failed content: application/json: schema: $ref: '#/components/schemas/HttpErrorResponse' summary: Generate limit order data for signing tags: - Limit Orders x-computing-unit: '3' x-retail-api-rank: 2 /v1/limit-orders/makers/generate-scaled-order-data: post: description: 'Generate a batch of limit orders spread across a price (implied APY) range for signing. Scaled orders distribute your total size across multiple price levels, providing better market depth than a single large order. Sign each generated order individually, then submit them via [Create limit order](#tag/limit-orders/post/v1/limit-orders/makers/limit-orders). Useful for market-making strategies.' operationId: LimitOrdersController_generateScaledLimitOrderData parameters: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/GenerateScaledOrderDataDto' responses: '201': description: Return generated limit order data content: application/json: schema: $ref: '#/components/schemas/GenerateScaledOrderResponse' summary: Generate list of limit orders (scaled) for signing tags: - Limit Orders x-computing-unit: '3' x-retail-api-rank: 6969 /v1/limit-orders/takers/limit-orders: get: description: 'Returns the best-matching active limit orders for a given YT address, sorted by implied APY for efficient taker fill selection. The response includes full order structs and maker signatures ready to pass directly to the Pendle limit order contract for on-chain settlement. Only active orders (unfilled, uncancelled, unexpired) are returned. For analytics and full order history (including filled/cancelled), use [Get all limit orders](#tag/limit-orders/get/v2/limit-orders) instead.' operationId: LimitOrdersController_getTakerLimitOrders 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 100. schema: default: 10 type: number - name: chainId required: true in: query description: ChainId schema: type: number - name: yt required: true in: query description: Order's YT address schema: type: string - name: type required: true in: query description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' schema: enum: - 0 - 1 - 2 - 3 type: number - name: sortBy required: false in: query schema: enum: - Implied Rate type: string - name: sortOrder required: false in: query schema: enum: - asc - desc type: string responses: '200': description: Limit orders data for takers content: application/json: schema: $ref: '#/components/schemas/LimitOrdersTakerResponse' '400': description: Validation failed content: application/json: schema: $ref: '#/components/schemas/HttpErrorResponse' summary: Get limit orders to match by YT address tags: - Limit Orders x-computing-unit: '5' x-retail-api-rank: 3 /v2/limit-orders/book/{chainId}: get: description: 'Returns the consolidated order book for a market, aggregating both limit orders and AMM liquidity depth into a unified view. The book is split into two sides: - **longYieldEntries**: available liquidity for buying YT (long yield positions), ordered by ascending implied APY - **shortYieldEntries**: available liquidity for selling YT (short yield positions), ordered by descending implied APY Each entry shows the implied APY price level, combined limit order size, and AMM depth at that level.' operationId: LimitOrdersController_getLimitOrderBookV2 parameters: - name: chainId required: true in: path schema: type: number - name: limit required: false in: query description: Maximum number of results to return. The parameter is capped at 200. schema: default: 10 type: number - name: precisionDecimal required: true in: query description: 'Min: 0, Max: 3, returned impliedApy will have precision upto 10^{-precisionDecimal}%' schema: type: number - name: market required: true in: query description: Market address schema: type: string - name: includeAmm required: false in: query description: Include AMM orders in the order book schema: type: boolean responses: '200': description: Returns order book content: application/json: schema: $ref: '#/components/schemas/OrderBookV2Response' summary: Get order book v2 tags: - Limit Orders x-computing-unit: '5' x-retail-api-rank: 3 components: schemas: HttpErrorResponse: type: object properties: message: type: string statusCode: type: number error: type: string required: - message - statusCode - error OrderFilledStatusResponse: type: object properties: netInputFromMaker: type: string description: BigInt string of netInputFromMaker, the unit is the same as making amount netOutputToMaker: type: string description: BigInt string of netOutputToMaker, the unit is SY if the order is PT_FOR_TOKEN or YT_FOR_TOKEN, otherwise, the unit it PT or YT depends on type of order feeAmount: type: string description: BigInt string of feeAmount, in SY notionalVolume: type: string description: BigInt string of notionalVolume, in SY required: - netInputFromMaker - netOutputToMaker - feeAmount - notionalVolume LimitOrdersTakerResponse: type: object properties: total: type: number limit: type: number skip: type: number results: type: array items: $ref: '#/components/schemas/LimitOrderTakerResponse' required: - total - limit - skip - results LimitOrdersV2Response: type: object properties: total: type: number limit: type: number results: type: array items: $ref: '#/components/schemas/LimitOrderResponse' resumeToken: type: string required: - total - limit - results - resumeToken OrderBookV2EntryResponse: type: object properties: impliedApy: type: number description: Order's implied apy, rounded to precision limitOrderSize: format: int64 type: integer description: Bigint string of entry size, in PT/YT amounts to fill this entry ammSize: format: int64 type: integer description: Bigint string of entry size, in AMM LP tokens (if applicable) required: - impliedApy - limitOrderSize GenerateScaledOrderResponse: type: object properties: orders: description: List of generated limit orders type: array items: $ref: '#/components/schemas/GenerateLimitOrderDataResponse' required: - orders CreateLimitOrderDto: type: object properties: chainId: type: number description: Chain Id signature: type: string description: Signature of order, signed by maker salt: type: string description: BigInt string of salt expiry: type: string description: BigInt string of expiry nonce: type: string description: BigInt string of nonce type: type: number enum: - 0 - 1 - 2 - 3 description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' token: type: string description: Token used by user to make order yt: type: string description: YT address maker: type: string description: Maker address receiver: type: string description: Receiver address makingAmount: type: string description: BigInt string of making amount lnImpliedRate: type: string description: BigInt string of lnImpliedRate failSafeRate: type: string description: BigInt string of failSafeRate permit: type: string description: Bytes string for permit required: - chainId - signature - salt - expiry - nonce - type - token - yt - maker - receiver - makingAmount - lnImpliedRate - failSafeRate - permit GenerateLimitOrderDataDto: type: object properties: chainId: type: number description: Chain Id YT: type: string description: YT address orderType: type: number enum: - 0 - 1 - 2 - 3 description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' token: type: string description: Input token if type is TOKEN_FOR_PT or TOKEN_FOR_YT, output token otherwise maker: type: string description: Maker address makingAmount: type: string description: BigInt string of making amount, the amount of token if the order is TOKEN_FOR_PT or TOKEN_FOR_YT, otherwise the amount of PT or YT impliedApy: type: number description: Implied APY of this limit order expiry: type: string description: Timestamp of order's expiry, in seconds required: - chainId - YT - orderType - token - maker - makingAmount - impliedApy - expiry LimitOrderResponse: type: object properties: id: type: string description: Hash of the order signature: type: string description: Signature of order, signed by maker chainId: type: number description: Chain id salt: type: string description: BigInt string of salt. Salt is a random generated number to distinguish between orders.Because of some technical reason, this number must be dividable by 12421 expiry: type: string description: BigInt string of expiry, in second nonce: type: string description: BigInt string of nonce type: type: number enum: - 0 - 1 - 2 - 3 description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' token: type: string description: Token used by user to make order yt: type: string description: YT address maker: type: string description: Maker address receiver: type: string description: Receiver address makingAmount: type: string description: BigInt string of making amount, the amount of token if the order is TOKEN_FOR_PT or TOKEN_FOR_YT, otherwise the amount of PT or YT currentMakingAmount: type: string description: BigInt string of remaining making amount, the unit is the same as makingAmount lnImpliedRate: type: string description: BigInt string of lnImpliedRate. Natural logarithm of the implied rate failSafeRate: type: string description: BigInt string of failSafeRate permit: type: string description: Bytes string for permit orderFilledStatus: description: Order filled status allOf: - $ref: '#/components/schemas/OrderFilledStatusResponse' isActive: type: boolean isCanceled: type: boolean createdAt: format: date-time type: string orderState: description: Order state allOf: - $ref: '#/components/schemas/OrderStateResponse' fullyExecutedTimestamp: format: date-time type: string description: Fully filled timestamp canceledTimestamp: format: date-time type: string description: Canceled timestamp latestEventTimestamp: format: date-time type: string description: Timestamp of latest event sy: type: string description: SY address pt: type: string description: PT address makerBalance: type: string description: Min(maker balance, maker allowance). How much token the maker has available to use for this order failedMintSy: type: boolean description: Simulate result of the order to mint sy failedMintSyReason: type: string description: Error reason of the order to mint sy orderBookBalance: type: string description: Bigint string of amount shown on order book makingToken: type: string description: Making token address takingToken: type: string description: Taking token address status: type: string enum: - FILLABLE - PARTIAL_FILLABLE - FAILED_TRANSFER_TOKEN - EMPTY_MAKER_BALANCE - CANCELLED - FULLY_FILLED - EXPIRED description: LimitOrderStatus required: - id - signature - chainId - salt - expiry - nonce - type - token - yt - maker - receiver - makingAmount - currentMakingAmount - lnImpliedRate - failSafeRate - permit - orderFilledStatus - isActive - isCanceled - createdAt - sy - pt - makerBalance - failedMintSy - failedMintSyReason - orderBookBalance - makingToken - takingToken - status OrderBookV2Response: type: object properties: longYieldEntries: type: array items: $ref: '#/components/schemas/OrderBookV2EntryResponse' shortYieldEntries: type: array items: $ref: '#/components/schemas/OrderBookV2EntryResponse' required: - longYieldEntries - shortYieldEntries LimitOrdersResponse: type: object properties: total: type: number limit: type: number skip: type: number results: type: array items: $ref: '#/components/schemas/LimitOrderResponse' required: - total - limit - skip - results GenerateScaledOrderDataDto: type: object properties: chainId: type: number description: Chain Id YT: type: string description: YT address orderType: type: number enum: - 0 - 1 - 2 - 3 description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' token: type: string description: Input token if type is TOKEN_FOR_PT or TOKEN_FOR_YT, output token otherwise maker: type: string description: Maker address makingAmount: type: string description: BigInt string of making amount, the amount of token if the order is TOKEN_FOR_PT or TOKEN_FOR_YT, otherwise the amount of PT or YT lowerImpliedApy: type: number description: Lower implied APY of this scaled order upperImpliedApy: type: number description: Upper implied APY of this scaled order orderCount: type: number description: Upper implied APY of this scaled order sizeDistribution: type: string enum: - flat - ascending - descending description: Scaled Order Distribution Type { } expiry: type: string description: Timestamp of order's expiry, in seconds required: - chainId - YT - orderType - token - maker - makingAmount - lowerImpliedApy - upperImpliedApy - orderCount - sizeDistribution - expiry LimitOrderTakerResponse: type: object properties: order: $ref: '#/components/schemas/LimitOrderResponse' makingAmount: type: string description: Amount to be used to fill the order, the unit is the same as the unit of limit order' making amount netFromTaker: type: string description: Amount from taker need to fully fill this order, the unit is SY if the market order is TOKEN_FOR_PT or TOKEN_FOR_YT, otherwise, the unit it PT or YT depends on type of order netToTaker: type: string description: Actual making amount to taker, the unit is SY if the market order is PT_FOR_TOKEN or YT_FOR_TOKEN, otherwise, the unit it PT or YT depends on type of order required: - order - makingAmount - netFromTaker - netToTaker GenerateLimitOrderDataResponse: type: object properties: chainId: type: number description: Chain id YT: type: string description: YT address salt: type: string description: BigInt string of salt. Salt is a random generated number to distinguish between orders.Because of some technical reason, this number must be dividable by 12421 expiry: type: string description: Limit order expiry, in string nonce: type: string description: Nonce of the limit order, this will help the maker to cancel all the limit order they created token: type: string description: Input token if type is TOKEN_FOR_PT or TOKEN_FOR_YT, output token otherwise orderType: type: number enum: - 0 - 1 - 2 - 3 description: 'LimitOrderType { 0 : TOKEN_FOR_PT, 1 : PT_FOR_TOKEN, 2 : TOKEN_FOR_YT, 3 : YT_FOR_TOKEN }' failSafeRate: type: string description: BigInt string of failSafeRate maker: type: string description: Maker's address receiver: type: string description: Maker's address makingAmount: type: string description: BigInt string of making amount, the amount of token if the order is TOKEN_FOR_PT or TOKEN_FOR_YT, otherwise the amount of PT or YT permit: type: string description: '' lnImpliedRate: format: int64 type: integer description: ln(impliedRate) * 10**18, returned as bigint string required: - chainId - YT - salt - expiry - nonce - token - orderType - failSafeRate - maker - receiver - makingAmount - permit - lnImpliedRate OrderStateResponse: type: object properties: orderType: type: string exchangeRate: type: string psAmountToTaker: type: string psAmountFromTaker: type: string ysAmountToTaker: type: string ysAmountFromTaker: type: string fee: type: string psRate: type: number ysRate: type: number netToMakerIfFullyFilled: type: string description: In SY if the order is PY for token netFromMakerIfFullyFilled: type: string description: The difference with currentMakingAmount is that this is in SY if currentMakingAmount in tokenIn notionalVolume: type: string matchableAmount: type: string notionalVolumeUSD: type: number required: - orderType - exchangeRate - psAmountToTaker - psAmountFromTaker - ysAmountToTaker - ysAmountFromTaker - fee - psRate - ysRate - netToMakerIfFullyFilled - netFromMakerIfFullyFilled - notionalVolume - matchableAmount - notionalVolumeUSD