API Referance
Overview
This documentation covers all available endpoints, their parameters, and response formats.
Base URL
All API endpoints are accessible through the following base URL:
http://test-may-us-01.windnetwork.ai:3000/api
Authentication
Currently, the API does not require authentication for public endpoints.
API Endpoints
Health & Status
Health Check
httpGET /health
Returns the health status of the API server.
Response:
json{ "status": "ok", "version": "1.0.0", "timestamp": "2024-03-21T12:00:00Z" }
Service Status
httpGET /status
Returns detailed status information about the service.
Response:
json{ "status": "running", "uptime": "24h", "version": "1.0.0", "node_info": { "node_id": "node-0", "node_type": "indexer", "peer_count": 5 } }
Metrics
httpGET /metrics
Returns service metrics in Prometheus format.
Block Endpoints
Latest Block
httpGET /blocks/latest
Returns information about the latest processed block.
Response:
json{ "slot": 123456789, "blockhash": "hash123...", "parent_slot": 123456788, "timestamp": "2024-03-21T12:00:00Z", "transactions": 150 }
Block by Slot
httpGET /blocks/{slot}
Returns information about a specific block by slot number.
Parameters:
slot
(path parameter): The slot number to query
Transaction Endpoints
Transaction by Signature
httpGET /transaction/{signature}
Returns detailed information about a specific transaction.
Parameters:
signature
(path parameter): The transaction signature to query
Response:
json{ "signature": "sig123...", "slot": 123456789, "success": true, "fee": 5000, "accounts": ["acc1...", "acc2..."], "timestamp": "2024-03-21T12:00:00Z" }
Recent Transactions
httpGET /transactions/recent
Returns a list of recent transactions.
Query Parameters:
limit
(optional): Number of transactions to return (default: 100)before
(optional): Return transactions before this signatureafter
(optional): Return transactions after this signature
Account Endpoints
Account Information
httpGET /account/{pubkey}
Returns detailed information about a specific account.
Parameters:
pubkey
(path parameter): The account public key to query
Response:
json{ "pubkey": "pubkey123...", "lamports": 1000000000, "owner": "owner123...", "executable": false, "rent_epoch": 123 }
Account Balance
httpGET /account/{pubkey}/balance
Returns the current balance of an account.
Parameters:
pubkey
(path parameter): The account public key to query
Account Tokens
httpGET /account/{pubkey}/tokens
Returns all tokens owned by an account.
Parameters:
pubkey
(path parameter): The account public key to query
Program Accounts
httpGET /accounts/program/{program_id}
Returns all accounts owned by a specific program.
Parameters:
program_id
(path parameter): The program ID to query
WebSocket Endpoints
Account Updates
httpWS /ws/accounts
WebSocket endpoint for real-time account updates.
Message Format:
json{ "type": "account_update", "pubkey": "pubkey123...", "lamports": 1000000000, "timestamp": "2024-03-21T12:00:00Z" }
Error Responses
All endpoints may return the following error responses:
400 Bad Request
json{ "error": "Invalid request parameters", "details": "Detailed error message" }
404 Not Found
json{ "error": "Resource not found", "details": "The requested resource does not exist" }
500 Internal Server Error
json{ "error": "Internal server error", "details": "An unexpected error occurred" }
Rate Limiting
The API implements rate limiting to ensure fair usage. Current limits:
- 100 requests per minute per IP address
- 1000 requests per hour per IP address
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1616323200
Best Practices
- Error Handling: Always implement proper error handling for API responses
- Rate Limiting: Implement exponential backoff when hitting rate limits
- WebSocket: Use WebSocket connections for real-time data instead of polling
- Caching: Cache responses when appropriate to reduce API calls
Examples
TypeScript Example
typescriptimport { WindClient } from '@windnetwork/sdk'; const client = new WindClient('http://test-may-us-01.windnetwork.ai:3000/api'); // Get latest block const latestBlock = await client.getLatestBlock(); // Get account information const accountInfo = await client.getAccount('pubkey123...'); // Subscribe to account updates client.subscribeToAccounts((update) => { console.log('Account update:', update); });
Python Example
pythonimport requests BASE_URL = 'http://test-may-us-01.windnetwork.ai:3000/api' # Get latest block response = requests.get(f'{BASE_URL}/blocks/latest') latest_block = response.json() # Get account information response = requests.get(f'{BASE_URL}/account/pubkey123...') account_info = response.json()
Support
For API support or to report issues, please contact:
- Email: vivek@windnetwork.ai
- Telegram Group (Early acess and support): @wind_network