API Reference
Welcome to the OdinTrade API reference documentation. Our API enables seamless integration with the OdinTrade protocol for atomic swaps between Bitcoin and EVM chains.Base URL
All API endpoints are relative to this base URL (only testnet is available at the moment):Available Endpoints
Swap Operations
Get Token Swap Details
POST /swap-details
Calculate an estimated exchange rates and amountOut, for token pairs.
Request Body:
Get Maximum Amount Out
POST /max-amount-out
Calculate maximum receivable tokens based on available balance.
Request Body:
Create Swap
POST /create-swap
Initialize a new atomic swap. The user will also provide a signature, which is the timestamp signature made with addressIn to prove that they are the real owner of the address that will lock the funds in chainIn.
If it is not clear why amountOut is required, instead of amountIn, please refer to the Protocol Flow section.
Request Body:
Confirm Swap
POST /confirm-swap/{swapId}
Confirm and execute the swap. The Liquidity Node will check userClaimSigned and userAddressPubkeyOut if chainOut is Bitcoin. Ethereum doesn’t require a signature for the user claim.
Request Body:
HTLC Operations
Create User HTLC
POST /user-create-htlc/{swapId}
Generate HTLC for user’s part of the swap. Required userAddressPubkeyIn if chainIn is Bitcoin.
Request Body:
Confirm User HTLC
POST /user-confirm-htlc/{swapId}
Submit signed HTLC transaction. Required userAddressPubkeyIn if chainIn is Bitcoin.
Request Body:
Status and History
Get Swap Status
GET /swap/{swapId}
Get detailed information about a specific swap.
Response:
Get All Swaps History
GET /all-swaps-history
Retrieve historical swap transactions.
Query Parameters:
addressIn(optional): Filter by input addressaddressOut(optional): Filter by output address
Error Handling
The API uses standard HTTP status codes:200: Success400: Bad Request - Invalid parameters401: Unauthorized - Invalid API key403: Forbidden - Insufficient permissions404: Not Found - Resource doesn’t exist429: Too Many Requests - Rate limit exceeded500: Internal Server Error - Please contact support
