> For the complete documentation index, see [llms.txt](https://rooster-protocol.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rooster-protocol.gitbook.io/docs/developers/call-data-api.md).

# Call Data API

## Generate swap call data for Rooster Protocol

> Endpoint to generate the necessary call data for executing a token swap on the Rooster Protocol.

```json
{"openapi":"3.0.0","info":{"title":"Rooster Protocol Swap API","version":"v1"},"servers":[{"url":"http://api.rooster-protocol.xyz/api"}],"paths":{"/swap/callData":{"post":{"summary":"Generate swap call data for Rooster Protocol","description":"Endpoint to generate the necessary call data for executing a token swap on the Rooster Protocol.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputTokenAddress":{"type":"string","description":"Address of the input token. Use '0x0000000000000000000000000000000000000000' for the native gas token."},"outputTokenAddress":{"type":"string","description":"Address of the output token."},"recipientAddress":{"type":"string","description":"Address of the recipient of the output tokens."},"amount":{"type":"string","description":"Amount of the input token to swap (in its smallest unit, e.g., Wei)."},"slippage":{"type":"number","format":"float","description":"Optional. Slippage tolerance percentage (e.g., 3 for 3%). Defaults to a predefined value."},"amountOutMinimum":{"type":"string","description":"Optional. Minimum amount of output tokens expected (in Wei). If not provided, it will be calculated based on the slippage."}},"required":["inputTokenAddress","outputTokenAddress","recipientAddress","amount"]}}}},"responses":{"200":{"description":"Successfully generated swap call data.","content":{"application/json":{"schema":{"type":"object","properties":{"callData":{"type":"string","description":"Call data to be sent to the router contract."},"to":{"type":"string","description":"Address of the router contract."},"value":{"type":"string","description":"Value (in Wei) to be sent with the transaction (usually 0, except when swapping with gas token)."},"expectedOutput":{"type":"string","description":"Estimated amount of output tokens the user will receive."},"amountOutMinimum":{"type":"string","description":"Minimum amount of output tokens the user should receive after slippage (in Wei)."},"slippage":{"type":"number","format":"float","description":"The final slippage used for the calculation."},"status":{"type":"integer","description":"HTTP status code (200 for success)."}}}}}},"400":{"description":"Bad request. Missing parameters or invalid input.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message."},"status":{"type":"integer","description":"HTTP status code (400 for error)."}}}}}}}}}}}
```
