Skip to main content

Starknet API Overview

Welcome to the Starknet API documentation. Our API provides powerful endpoints for finding optimal trading routes and executing swaps on Base network.

Starknet URL

Common Concepts

Authentication

No authentication is required for the API endpoints.

Rate Limiting

Please refer to our Rate Limit documentation for details about rate limiting.

Common Token Addresses

Here are some commonly used token addresses on Starknet:

Response Codes

Available Endpoints

Route

Find the optimal trading route through Fibrous’ liquidity pools to maximize output and minimize slippage.

Execute

Generate calldata for the Fibrous router contract to execute the swap.

Calldata

Get the calldata for executing the swap transaction.

Best Practices

Slippage Protection

  • Always set a reasonable slippage value (0.1% - 1% for stable pairs)
  • Use higher slippage for volatile pairs or low liquidity tokens
  • Monitor price impact to ensure favorable trades

Gas Optimization

  • Use the direct parameter for simple swaps between major tokens
  • Set excludeProtocols to skip specific protocols if needed
  • Consider batch swaps for multiple transactions

Error Handling

  • Always check the success field in responses
  • Implement proper error handling in your code
  • Monitor transaction status after execution

Quick Start Example

Here’s a complete example of how to perform a swap using our API:
  1. First, get the optimal route:
  1. Then, get the execution calldata:
  1. Finally, execute the transaction using the returned calldata with your preferred Web3 library.

Need Help?