Quick Start Guide¶
Get up and running with AirChain API in 5 minutes.
Step 1: Create an Account¶
Visit dashboard.airchain.ng/register
Required information: - Email address - Password (min 8 characters) - Full name - Organization (optional)
You'll receive a confirmation email. Click the link to activate your account.
Step 2: Generate API Key¶
- Log in to dashboard.airchain.ng
- Navigate to Settings → API Keys
- Click "Generate New API Key"
- Copy your API key immediately (it won't be shown again)
Important: - API keys expire after 90 days - Free tier: 100 requests/day - Store securely (treat like a password)
Step 3: Make Your First API Call¶
Get All Active Sensors¶
curl -X GET "https://api.airchain.ng/v1/sensors" \
-H "Authorization: Bearer YOUR_API_KEY"
Response:
{
"status": "success",
"count": 950,
"sensors": [
{
"id": "NGR-LOS-YAB-001",
"location": {
"lat": 6.5244,
"lon": 3.3792,
"address": "Yaba, Lagos"
},
"status": "online",
"last_reading": "2025-11-29T14:35:00Z",
"uptime_24h": 0.98
}
]
}
Get Latest Readings¶
curl -X GET "https://api.airchain.ng/v1/readings?sensor_id=NGR-LOS-YAB-001&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
Response:
{
"status": "success",
"sensor_id": "NGR-LOS-YAB-001",
"readings": [
{
"timestamp": "2025-11-29T14:35:00Z",
"pm25": 45.3,
"pm10": 78.2,
"co2": 420,
"temperature": 28.5,
"humidity": 72,
"aqi": 112,
"blockchain_tx": "a3b2c1d4e5f6..."
}
]
}
Step 4: Verify on Blockchain¶
curl -X GET "https://api.airchain.ng/v1/readings/NGR-LOS-YAB-001/verify?timestamp=2025-11-29T14:35:00Z" \
-H "Authorization: Bearer YOUR_API_KEY"
Response:
{
"status": "verified",
"reading_hash": "8a4f2b9c...",
"merkle_root": "d5e3a1b8...",
"cardano_tx": "https://cardanoscan.io/transaction/a3b2c1d4e5f6...",
"verified_at": "2025-11-29T14:35:45Z"
}
Next Steps¶
Code Examples¶
JavaScript¶
const API_KEY = "your_api_key";
fetch("https://api.airchain.ng/v1/sensors", {
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then(res => res.json())
.then(data => console.log(data));
Python¶
import requests
API_KEY = "your_api_key"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get(
"https://api.airchain.ng/v1/sensors",
headers=headers
)
print(response.json())
Troubleshooting¶
401 Unauthorized - Check your API key is correct - Verify key hasn't expired (90-day limit)
429 Too Many Requests - Free tier: 100 requests/day - Wait until limit resets (midnight UTC) - Consider upgrading to Premium
404 Sensor Not Found
- Verify sensor ID format: NGR-LOS-{AREA}-{NUMBER}
- Check sensor is online: /v1/sensors/{sensor_id}/status