Health Check
Check if the API is operational and view service status.
Endpoint
GET /api/healthAuthentication
Required: Bearer token
The network (mainnet or testnet) is automatically determined from your bearer token.
# Check health using mainnet bearer token
curl https://YOUR_API_DOMAIN/api/health \
-H "Authorization: Bearer YOUR_MAINNET_BEARER_TOKEN"
# Check health using testnet bearer token
curl https://YOUR_API_DOMAIN/api/health \
-H "Authorization: Bearer YOUR_TESTNET_BEARER_TOKEN"Response
Healthy (200 OK)
{
"status": "healthy",
"timestamp": "2025-11-19T12:00:00Z",
"network": "mainnet",
"service": {
"operational": true,
"balanceSufficient": true,
"balanceWarning": false,
"balance": "24022.992358",
"paused": false
}
}Unhealthy (503 Service Unavailable)
{
"status": "unavailable",
"timestamp": "2025-11-19T12:00:00Z",
"network": "mainnet",
"service": {
"operational": true,
"balanceSufficient": false,
"balanceWarning": true,
"balance": "450.25",
"paused": true
}
}Service Availability: The API returns 503 Unavailable only when the contract is paused. Low balance triggers warnings but does not make the service unavailable - transactions can still succeed if there’s enough balance for that specific transaction.
Response Fields
| Field | Type | Description |
|---|---|---|
status | string | healthy or unavailable (unavailable only when paused) |
network | string | mainnet or testnet - which network was checked |
service.operational | boolean | Whether the API is currently operational |
service.balanceSufficient | boolean | Whether balance is above critical threshold |
service.balanceWarning | boolean | Whether balance is below warning threshold |
service.balance | string | Current MOVE token balance available for distribution |
service.paused | boolean | Whether the contract is paused (no airdrops if true) |
Status Codes
| Code | Meaning |
|---|---|
| 200 | Service is healthy - contract is not paused (may have balance warnings) |
| 503 | Service unavailable - contract is paused (no transactions can be processed) |
Balance Monitoring: Use the service.balance, service.balanceSufficient, and service.balanceWarning fields to monitor the distribution wallet balance. This helps you validate transaction amounts and enforce caps before making airdrop requests.
Code Example
async function checkHealth(bearerToken: string): Promise<boolean> {
const response = await fetch('https://YOUR_API_DOMAIN/api/health', {
headers: {
'Authorization': `Bearer ${bearerToken}`
}
});
const data = await response.json();
console.log(`${data.network} API Status:`, data.status);
console.log('Current Balance:', data.service.balance, 'MOVE');
console.log('Balance Sufficient:', data.service.balanceSufficient);
console.log('Balance Warning:', data.service.balanceWarning);
console.log('Contract Paused:', data.service.paused);
if (data.status === 'healthy') {
// Check balance before processing large batches
if (data.service.balanceWarning) {
console.warn('Warning: Balance is running low');
}
return true;
} else {
console.error(`${data.network} API is unavailable`);
if (data.service.paused) {
console.error('Reason: Contract is paused - no transactions can be processed');
}
return false;
}
}
// Check mainnet before making requests
if (await checkHealth(process.env.MAINNET_BEARER_TOKEN!)) {
await processAirdrop(...);
}
// Check testnet
if (await checkHealth(process.env.TESTNET_BEARER_TOKEN!)) {
await processTestnetAirdrop(...);
}Use Cases
Pre-flight Check with Balance Validation
Verify service is available and has sufficient balance before batch processing:
interface Recipient {
address: string;
amount: string;
}
async function batchAirdrops(recipients: Recipient[], bearerToken: string) {
// Check health and get current balance
const health = await fetch('https://YOUR_API_DOMAIN/api/health', {
headers: {
'Authorization': `Bearer ${bearerToken}`
}
});
const healthData = await health.json();
if (healthData.status !== 'healthy') {
throw new Error(`${healthData.network} API is not available - contract is paused`);
}
// Calculate total amount needed for batch
const totalAmount = recipients.reduce((sum, r) => sum + parseFloat(r.amount), 0);
const currentBalance = parseFloat(healthData.service.balance);
// Validate sufficient balance for entire batch
if (currentBalance < totalAmount) {
throw new Error(
`Insufficient balance: Need ${totalAmount} MOVE, have ${currentBalance} MOVE`
);
}
console.log(`Processing ${recipients.length} airdrops`);
console.log(`Total amount: ${totalAmount} MOVE`);
console.log(`Current balance: ${currentBalance} MOVE`);
console.log(`Remaining after batch: ${currentBalance - totalAmount} MOVE`);
// Process airdrops
for (const recipient of recipients) {
await processAirdrop(recipient.address, recipient.amount, bearerToken);
}
}Best Practice: Check health status before processing large batches of airdrops to avoid wasting time if the service is unavailable.
Network Selection: The health check automatically queries the network (mainnet or testnet) associated with your bearer token. Use your testnet bearer token to check testnet status, or your mainnet bearer token to check mainnet status.
Related
- POST /api/airdrop - Process airdrops
- Transaction Verification - Verify transactions