Introduction to Web3 APIs
The OKX Web3 API suite provides developers with comprehensive tools for building decentralized applications (DApps) and integrating blockchain functionalities. This documentation covers:
๐ Wallet-as-a-Service (WaaS) solutions
๐ Decentralized exchange (DEX) capabilities
๐ NFT marketplace integrations
๐ DeFi protocol interactions
Core Services Overview
Wallet API
- Account management
- Transaction broadcasting
- On-chain data queries
- Multi-chain support
DEX API
- Token swaps
- Cross-chain bridging
- Limit orders
- Liquidity aggregation
Marketplace API
- NFT trading
- Runes protocol integration
- Ordinals market data
- Collection management
DeFi API
- Yield farming
- Lending protocols
- Staking mechanisms
Technical Specifications
Supported Networks
| Network Type | Examples |
|---|---|
| EVM-Compatible | Ethereum, Polygon, BSC |
| Bitcoin-based | Bitcoin, Litecoin |
| Alternative L1s | Solana, Cosmos |
Getting Started Requirements
- Developer account registration
- API key authentication
- Minimum SDK version requirements
- Testnet sandbox access
Marketplace API Reference
NFT Marketplace Endpoints
#### Collection Management
- `GET /collections` - List all collections
- `POST /collections` - Create new collection
- `GET /collections/{id}` - Retrieve collection details
#### Asset Operations
- `GET /assets` - Query NFT inventory
- `POST /assets/transfer` - Execute NFT transfer
- `GET /assets/{contract}/{tokenId}` - Get NFT metadata
#### Order Processing
- `POST /orders/list` - Create sell order
- `POST /orders/buy` - Execute purchase
- `GET /orders/{orderId}` - Check order statusRunes Protocol Integration
#### Ordinals Management
- `POST /runes/inscribe` - Create new ordinal inscription
- `GET /runes/{inscriptionId}` - Check inscription status
- `POST /runes/transfer` - Transfer ordinal ownership
#### Market Operations
- `GET /runes/market/listing` - View active listings
- `POST /runes/market/bid` - Place purchase bid
- `DELETE /runes/market/cancel` - Remove listingFrequently Asked Questions
Wallet Integration
Q: How do I authenticate API requests?
A: Use JWT tokens generated through OAuth2.0 flow with your API keys.
Q: What's the rate limit for Wallet API?
A: 50 requests/second with burst capacity up to 100 requests.
Marketplace Operations
Q: How are NFT royalties handled?
A: Royalties are automatically distributed according to smart contract terms.
Q: Can I cancel pending transactions?
A: Only before network confirmation - use the transaction replacement API.
DEX Functionality
Q: What's the minimum swap amount?
A: No minimum, but consider gas fees for micro-transactions.
Q: How are cross-chain swaps priced?
A: Using decentralized oracle feeds updated every 15 seconds.
Advanced Features
๐ Smart contract interaction toolkit
๐ Gas optimization algorithms
๐ Multi-sig wallet support
### Error Handling Reference
| Error Code | Description | Resolution |
|------------|--------------------------------------|-------------------------------------|
| 4001 | Invalid chain ID | Verify network parameter |
| 4010 | Insufficient gas | Increase gas limit by 20% |
| 4032 | NFT not transferrable | Check token lock status |
| 5008 | Marketplace maintenance | Retry after indicated downtime |Additional Resources
- API changelog updates
- Smart contract audit reports
- Community developer forums
- Sandbox testing guidelines