Production: https://api.disasterwatch.com/v1
Development: http://localhost:3000/v1
All API endpoints require authentication using JWT tokens. Include the token in the Authorization header:
Authorization: Bearer <your_jwt_token>GET /disastersQuery Parameters:
lat(number): Latitude for location-based filteringlng(number): Longitude for location-based filteringradius(number): Search radius in kilometerstype(string): Disaster type (earthquake, flood, fire, etc.)severity(string): Minimum severity level (low, medium, high, critical)start_date(ISO date): Filter disasters after this dateend_date(ISO date): Filter disasters before this date
Response:
{
"disasters": [
{
"id": "string",
"type": "string",
"severity": "string",
"location": {
"lat": number,
"lng": number,
"address": "string"
},
"description": "string",
"created_at": "string",
"updated_at": "string",
"status": "string"
}
],
"meta": {
"total": number,
"page": number,
"per_page": number
}
}POST /disastersRequest Body:
{
"type": "string",
"severity": "string",
"location": {
"lat": number,
"lng": number,
"address": "string"
},
"description": "string",
"media": [
{
"type": "string",
"url": "string"
}
]
}GET /weatherQuery Parameters:
lat(number): Latitudelng(number): Longitudeunits(string): 'metric' or 'imperial'
Response:
{
"current": {
"temp": number,
"feels_like": number,
"humidity": number,
"wind_speed": number,
"conditions": "string"
},
"forecast": [
{
"date": "string",
"temp_high": number,
"temp_low": number,
"conditions": "string"
}
]
}GET /emergency/facilitiesQuery Parameters:
lat(number): Latitudelng(number): Longitudetype(string): Facility type (hospital, fire_station, police, shelter)radius(number): Search radius in kilometers
Response:
{
"facilities": [
{
"id": "string",
"name": "string",
"type": "string",
"location": {
"lat": number,
"lng": number,
"address": "string"
},
"phone": "string",
"operating_hours": "string",
"distance": number
}
]
}POST /usersRequest Body:
{
"email": "string",
"password": "string",
"name": "string",
"phone": "string",
"emergency_contacts": [
{
"name": "string",
"relationship": "string",
"phone": "string"
}
]
}PUT /users/{userId}Request Body:
{
"name": "string",
"phone": "string",
"notification_preferences": {
"push_enabled": boolean,
"email_enabled": boolean,
"sms_enabled": boolean,
"quiet_hours": {
"start": "string",
"end": "string"
}
}
}All endpoints follow the same error response format:
{
"error": {
"code": "string",
"message": "string",
"details": {}
}
}Common Error Codes:
400: Bad Request401: Unauthorized403: Forbidden404: Not Found429: Too Many Requests500: Internal Server Error
API requests are limited to:
- 100 requests per minute for authenticated users
- 20 requests per minute for unauthenticated users
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200Connect to real-time updates:
wss://api.disasterwatch.com/v1/ws
Events:
// Subscribe to disaster updates
{
"type": "subscribe",
"channel": "disasters",
"filters": {
"types": ["earthquake", "flood"],
"severity": "high",
"location": {
"lat": number,
"lng": number,
"radius": number
}
}
}
// Receive disaster updates
{
"type": "disaster_update",
"data": {
// Disaster object
}
}