Mach API Reference
The Mach API provides developers with powerful tools to integrate with the Mach Exchange protocol for cross-chain swaps. This documentation outlines the available endpoints and their usage for seamless integration.API Overview
Mach’s API enables developers to:- Fetch quotes for cross-chain token swaps
- Submit and fill orders for cross-chain swaps
- Track order status and transaction history
- Access market data for supported tokens and chains
- Monitor protocol metrics and liquidity information
API Environments
Mach provides both mainnet and testnet environments:- Mainnet API: For production applications dealing with real assets
- Testnet API: For development and testing without risking real assets
Integration Workflow
A typical integration with Mach involves these key steps:- Fetch Available Tokens and Chains: Get the list of supported tokens and chains from the configuration endpoint
- Request a Quote: Get pricing information for a potential swap
- Execute On-Chain Transaction: Have the user call the
placeTradefunction on the Mach smart contract - Submit the Order: Send the transaction information to Mach’s API to fulfill the cross-chain swap
- Track Order Status: Monitor the status of the order until completion
Error Handling
When integrating with Mach’s API, it’s important to properly handle different types of responses:- 200 OK: Order successfully received and being processed
- 202 Accepted: Order accepted but will take some time to find a match
- 400 Bad Request: Order rejected by the market maker
- 422 Unprocessable Entity: Invalid payload format or parameters
- Network Errors: Connection issues, timeouts, etc.
Authentication
Some API endpoints may require authentication using Bearer tokens. Please contact the Mach team to obtain API credentials if needed.Rate Limiting
The API implements rate limiting to ensure fair usage. Your application should handle rate limit responses (HTTP 429) appropriately by implementing backoff strategies.Getting Started
Explore the API endpoints in the following sections to begin your integration:API Endpoints
Browse available API endpoints for integration
Smart Contract Integration
Learn how to integrate with Mach smart contracts