# Peach Aggregator API

## Get service status

> Returns the list of available DEX providers and the chainflow sync status\
> for each provider. Use this to check service health and data freshness.<br>

```json
{"openapi":"3.0.3","info":{"title":"Peach Aggregator API","version":"0.1.1"},"tags":[{"name":"Router","description":"Route discovery, quote retrieval, and service status"}],"servers":[{"url":"https://api.peach.ag","description":"Production"}],"paths":{"/router/status":{"get":{"operationId":"getStatus","summary":"Get service status","description":"Returns the list of available DEX providers and the chainflow sync status\nfor each provider. Use this to check service health and data freshness.\n","tags":["Router"],"responses":{"200":{"description":"Service status with provider availability and sync info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}}}}}},"components":{"schemas":{"StatusResponse":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatusData"}}}]},"ApiResponse":{"type":"object","description":"Common response envelope for all API responses.","properties":{"code":{"type":"integer","description":"`200` indicates success; any other value indicates an API-level error."},"msg":{"type":"string","description":"Human-readable status message."}},"required":["code","msg"]},"StatusData":{"type":"object","description":"Service status including available providers and sync state.","properties":{"providers":{"type":"array","description":"List of currently available DEX provider names.","items":{"type":"string","enum":["PANCAKEV2","PANCAKEV3","PANCAKE_INFINITY_CL","UNISWAPV3","UNISWAPV4","DODO","THENA"]}},"chainflows":{"type":"array","description":"Sync status for each provider's data pipeline.","items":{"$ref":"#/components/schemas/ChainflowStatus"}}},"required":["providers","chainflows"]},"ChainflowStatus":{"type":"object","description":"Data sync status for a single provider.","properties":{"provider":{"type":"string","description":"Provider name."},"tx_cursor":{"type":"string","nullable":true,"description":"Current sync transaction cursor. `null` if not yet synced."},"version":{"type":"object","description":"Sync version tracking.","properties":{"latest_block_number":{"type":"integer","description":"Latest synced block number on BSC."},"latest_transaction_index":{"type":"integer","description":"Latest synced transaction index within the block."}},"required":["latest_block_number","latest_transaction_index"]},"update_at":{"type":"integer","description":"Last update timestamp in milliseconds (Unix epoch)."}},"required":["provider","tx_cursor","version","update_at"]}}}}
```

## Find optimal swap routes

> Discovers the best swap route between two tokens. Returns optimized paths\
> across supported DEX protocols with price quotes, gas estimates, and\
> contract addresses needed for transaction building.<br>

```json
{"openapi":"3.0.3","info":{"title":"Peach Aggregator API","version":"0.1.1"},"tags":[{"name":"Router","description":"Route discovery, quote retrieval, and service status"}],"servers":[{"url":"https://api.peach.ag","description":"Production"}],"paths":{"/router/find_routes":{"get":{"operationId":"findRoutes","summary":"Find optimal swap routes","description":"Discovers the best swap route between two tokens. Returns optimized paths\nacross supported DEX protocols with price quotes, gas estimates, and\ncontract addresses needed for transaction building.\n","tags":["Router"],"parameters":[{"name":"from","in":"query","required":true,"description":"Input token contract address. Use `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`\nfor native BNB.\n","schema":{"type":"string"}},{"name":"target","in":"query","required":true,"description":"Output token contract address. Use `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`\nfor native BNB.\n","schema":{"type":"string"}},{"name":"amount","in":"query","required":true,"description":"Raw token amount as a string (in smallest unit, e.g. wei).","schema":{"type":"string"}},{"name":"by_amount_in","in":"query","required":false,"description":"When `true` (default), the `amount` parameter is the input amount and the API\nreturns the expected output amount. When `false`, the `amount` is the desired\noutput amount and the API returns the required input.\n","schema":{"type":"boolean","default":true}},{"name":"depth","in":"query","required":false,"description":"Maximum number of hops in the route. Higher values find more complex routes but take longer.","schema":{"type":"integer","default":3,"minimum":1,"maximum":5}},{"name":"split_count","in":"query","required":false,"description":"Number of trade splits for optimization. Higher values may find better prices.","schema":{"type":"integer","default":20,"minimum":1}},{"name":"providers","in":"query","required":false,"description":"Comma-separated list of DEX providers to include.\nAvailable providers: `PANCAKEV2`, `PANCAKEV3`, `PANCAKE_INFINITY_CL`,\n`UNISWAPV3`, `UNISWAPV4`, `DODO`, `THENA`.\nDefaults to all providers.\n","schema":{"type":"string"}},{"name":"v","in":"query","required":false,"description":"Client version identifier.","schema":{"type":"integer","default":1001500}}],"responses":{"200":{"description":"Successful route discovery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FindRouteResponse"}}}}}}}},"components":{"schemas":{"FindRouteResponse":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FindRouteData"}}}]},"ApiResponse":{"type":"object","description":"Common response envelope for all API responses.","properties":{"code":{"type":"integer","description":"`200` indicates success; any other value indicates an API-level error."},"msg":{"type":"string","description":"Human-readable status message."}},"required":["code","msg"]},"FindRouteData":{"type":"object","description":"Route discovery result with optimal paths, amounts, and contract addresses.","properties":{"request_id":{"type":"string","description":"Unique request identifier. Used internally by the SDK for quote tracking."},"amount_in":{"type":"string","description":"Total input amount (raw, in smallest unit)."},"amount_out":{"type":"string","description":"Total output amount (raw, in smallest unit)."},"deviation_ratio":{"type":"string","description":"Price deviation ratio indicating price impact."},"paths":{"type":"array","description":"Individual swap paths that make up the route.","items":{"$ref":"#/components/schemas/RoutePath"}},"contracts":{"$ref":"#/components/schemas/ContractAddresses"},"gas":{"type":"integer","description":"Estimated gas consumption for the swap."}},"required":["request_id","amount_in","amount_out","deviation_ratio","paths","contracts","gas"]},"RoutePath":{"type":"object","description":"A single swap path through a specific liquidity pool.","properties":{"pool":{"type":"string","description":"Pool contract address."},"provider":{"type":"string","description":"DEX provider name.","enum":["PANCAKEV2","PANCAKEV3","PANCAKE_INFINITY_CL","UNISWAPV3","UNISWAPV4","DODO","THENA"]},"adapter":{"type":"string","description":"Adapter contract address for this protocol."},"token_in":{"type":"string","description":"Input token address for this path segment."},"token_out":{"type":"string","description":"Output token address for this path segment."},"direction":{"type":"boolean","description":"`true` = token0 to token1; `false` = token1 to token0."},"fee_rate":{"type":"string","description":"Pool fee rate as a decimal string (e.g., `\"0.0005\"` = 0.05%)."},"amount_in":{"type":"string","description":"Input amount for this path segment."},"amount_out":{"type":"string","description":"Output amount for this path segment."},"extra_data":{"type":"string","nullable":true,"description":"Protocol-specific extra data (hex encoded). Used by adapters during execution."}},"required":["pool","provider","adapter","token_in","token_out","direction","fee_rate","amount_in","amount_out"]},"ContractAddresses":{"type":"object","description":"Contract addresses needed for transaction building.","properties":{"router":{"type":"string","description":"PeachAggregator router contract address. Use as the `to` address for swap transactions."},"adapters":{"type":"object","description":"Map of provider name to adapter contract address.","additionalProperties":{"type":"string"}}},"required":["router","adapters"]}}}}
```

<a href="https://gitbookio.github.io/onboarding-template-images/gitbook-petstore.yaml" class="button primary" data-icon="arrow-up-right-from-square">View OpenAPI spec</a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.peach.ag/api-reference/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
