# API Reference

## Get Quote

> Request a transaction-ready quote for swap and bridge flows.

```json
{"openapi":"3.0.3","info":{"title":"WheelX REST API","version":"1.0.0"},"tags":[{"name":"API Reference","description":"WheelX REST API endpoints."}],"servers":[{"url":"https://api.wheelx.fi/v1","description":"Production"}],"paths":{"/quote":{"post":{"tags":["API Reference"],"summary":"Get Quote","description":"Request a transaction-ready quote for swap and bridge flows.","operationId":"getQuote","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteRequest"}}}},"responses":{"200":{"description":"Quote created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}}}}}},"components":{"schemas":{"QuoteRequest":{"type":"object","required":["from_chain","to_chain","from_token","to_token","from_address","to_address","amount"],"properties":{"from_chain":{"type":"integer","description":"Source chain ID"},"to_chain":{"type":"integer","description":"Destination chain ID"},"from_token":{"type":"string","description":"Source token address"},"to_token":{"type":"string","description":"Destination token address"},"from_address":{"type":"string","description":"Sender address"},"to_address":{"type":"string","description":"Recipient address"},"amount":{"type":"string","description":"Input amount in token base units","pattern":"^[0-9]+$"},"slippage":{"type":"integer","description":"Slippage in basis points style units where `50` means `0.5%`"},"affiliation":{"type":"string","description":"Integrator or referral code","nullable":true},"external_bridge":{"type":"boolean","default":false},"to_platform_id":{"type":"integer","description":"Destination platform ID when applicable"},"quote_only":{"type":"boolean","description":"Optional frontend compatibility flag that may be included in quote requests.","nullable":true}}},"QuoteResponse":{"type":"object","required":["request_id","amount_out","fee","slippage","min_receive","estimated_time","recipient","router_type","price_impact","router","created_at","points"],"properties":{"request_id":{"type":"string"},"amount_out":{"type":"string"},"fee":{"type":"string"},"tx":{"$ref":"#/components/schemas/Tx"},"approve":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ApproveAction"}]},"slippage":{"type":"integer"},"min_receive":{"type":"string"},"estimated_time":{"type":"number"},"recipient":{"type":"string"},"router_type":{"type":"string","enum":["swap","bridge","wrap","unwrap"]},"price_impact":{"$ref":"#/components/schemas/PriceImpactFormatted"},"router":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"points":{"type":"string"},"quote_message":{"type":"string","nullable":true},"routes":{"type":"array","items":{"$ref":"#/components/schemas/RouteInfo"}}}},"Tx":{"type":"object","required":["to","value","data"],"properties":{"to":{"type":"string"},"value":{"type":"string"},"data":{"type":"string"},"chainId":{"type":"integer"},"gas":{"type":"integer"},"maxFeePerGas":{"type":"integer"},"maxPriorityFeePerGas":{"type":"integer"}}},"ApproveAction":{"type":"object","required":["token","spender","amount"],"properties":{"token":{"type":"string"},"spender":{"type":"string"},"amount":{"type":"string"}}},"PriceImpactFormatted":{"type":"object","properties":{"bridge_fee":{"type":"string"},"swap_fee":{"type":"string"},"dst_gas_fee":{"type":"string"},"before_discount_fee":{"type":"string","nullable":true},"discount_percentage":{"type":"string","nullable":true}}},"RouteInfo":{"type":"object","properties":{"name":{"type":"string"},"logo":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string"}}},"ValidationErrorResponse":{"type":"object","properties":{"detail":{"type":"array","items":{"type":"object","properties":{"loc":{"type":"array","items":{"type":"string"}},"msg":{"type":"string"},"type":{"type":"string"}}}}}}}}}
```

## Get Order

> Query a single order by \`request\_id\`.

```json
{"openapi":"3.0.3","info":{"title":"WheelX REST API","version":"1.0.0"},"tags":[{"name":"API Reference","description":"WheelX REST API endpoints."}],"servers":[{"url":"https://api.wheelx.fi/v1","description":"Production"}],"paths":{"/order/{request_id}":{"get":{"tags":["API Reference"],"summary":"Get Order","description":"Query a single order by `request_id`.","operationId":"getOrder","parameters":[{"name":"request_id","in":"path","required":true,"description":"Order ID returned by `POST /quote`","schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$"}}],"responses":{"200":{"description":"Order found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"OrderResponse":{"type":"object","required":["order_id","from_chain","from_token","from_address","from_amount","to_chain","to_token","to_address","to_amount","open_tx_hash","open_block","open_timestamp","status","points"],"properties":{"order_id":{"type":"string"},"from_chain":{"type":"integer"},"from_token":{"type":"string"},"from_token_info":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"from_address":{"type":"string"},"from_amount":{"type":"string"},"to_chain":{"type":"integer"},"to_token":{"type":"string"},"to_token_info":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"to_address":{"type":"string"},"to_amount":{"type":"string"},"open_tx_hash":{"type":"string"},"open_block":{"type":"integer"},"open_timestamp":{"type":"string","format":"date-time"},"fill_tx_hash":{"type":"string","nullable":true},"fill_block":{"type":"integer","nullable":true},"fill_timestamp":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["Open","Filled","Failed","Refund"]},"points":{"type":"string"},"reward_type":{"type":"string","nullable":true},"reward_value":{"type":"object","nullable":true},"routes":{"type":"array","items":{"type":"string"}},"to_platform_id":{"type":"integer","nullable":true}}},"TokenInfo":{"type":"object","properties":{"symbol":{"type":"string"},"name":{"type":"string"},"decimals":{"type":"integer"},"address":{"type":"string"},"chain_id":{"type":"integer"},"logo":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}}}},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string"}}}}}}
```

## Get Orders

> Retrieve historical order records for one or more wallet addresses.

```json
{"openapi":"3.0.3","info":{"title":"WheelX REST API","version":"1.0.0"},"tags":[{"name":"API Reference","description":"WheelX REST API endpoints."}],"servers":[{"url":"https://api.wheelx.fi/v1","description":"Production"}],"paths":{"/orders":{"get":{"tags":["API Reference"],"summary":"Get Orders","description":"Retrieve historical order records for one or more wallet addresses.","operationId":"getOrders","parameters":[{"name":"address","in":"query","required":true,"description":"One or more wallet addresses","explode":true,"schema":{"type":"array","items":{"type":"string"}}},{"name":"network","in":"query","required":false,"schema":{"type":"string","enum":["mainnet","testnet"],"default":"mainnet"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":5}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Orders returned successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrdersByAddressResponse"}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"OrdersByAddressResponse":{"type":"object","required":["orders","total"],"properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/OrderResponse"}},"total":{"type":"integer"}}},"OrderResponse":{"type":"object","required":["order_id","from_chain","from_token","from_address","from_amount","to_chain","to_token","to_address","to_amount","open_tx_hash","open_block","open_timestamp","status","points"],"properties":{"order_id":{"type":"string"},"from_chain":{"type":"integer"},"from_token":{"type":"string"},"from_token_info":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"from_address":{"type":"string"},"from_amount":{"type":"string"},"to_chain":{"type":"integer"},"to_token":{"type":"string"},"to_token_info":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"to_address":{"type":"string"},"to_amount":{"type":"string"},"open_tx_hash":{"type":"string"},"open_block":{"type":"integer"},"open_timestamp":{"type":"string","format":"date-time"},"fill_tx_hash":{"type":"string","nullable":true},"fill_block":{"type":"integer","nullable":true},"fill_timestamp":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["Open","Filled","Failed","Refund"]},"points":{"type":"string"},"reward_type":{"type":"string","nullable":true},"reward_value":{"type":"object","nullable":true},"routes":{"type":"array","items":{"type":"string"}},"to_platform_id":{"type":"integer","nullable":true}}},"TokenInfo":{"type":"object","properties":{"symbol":{"type":"string"},"name":{"type":"string"},"decimals":{"type":"integer"},"address":{"type":"string"},"chain_id":{"type":"integer"},"logo":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}}}},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string"}}}}}}
```
