MagicWeather API
Integrate powerful weather data into your applications
Getting Started
The MagicWeather API provides developers with programmatic access to our comprehensive weather data, forecasts, and alerts. Follow these steps to get started:
- Sign up for a MagicWeather developer account
- Generate an API key from your dashboard
- Choose the endpoints you need for your application
- Make requests using your API key for authentication
Base URL
https://api.magic-weather.com/v1
Current Weather Endpoint
Get real-time weather data for a specific location
Request
/current?lat={lat}&lon={lon}
Parameters:
lat- Latitude (required)lon- Longitude (required)units- Units of measurement (optional, defaults to "metric")
Response
{
"coord": {
"lon": -74.006,
"lat": 40.7128
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"main": {
"temp": 22.3,
"feels_like": 21.8,
"temp_min": 20.9,
"temp_max": 23.1,
"pressure": 1015,
"humidity": 65
},
"wind": {
"speed": 3.6,
"deg": 160
},
"dt": 1632225600,
"sys": {
"country": "US",
"sunrise": 1632216610,
"sunset": 1632260720
},
"name": "New York",
"cod": 200
}
Forecast Endpoint
Get hourly and daily forecasts for a location
Request
/forecast?lat={lat}&lon={lon}&days={days}
Parameters:
lat- Latitude (required)lon- Longitude (required)days- Number of days (optional, defaults to 5, max 10)units- Units of measurement (optional, defaults to "metric")
The forecast endpoint returns both hourly (every 3 hours) and daily forecasts for the requested location. Response format includes detailed weather information for each time period.
Historical Weather Endpoint
Access historical weather data for a location
Request
/historical?lat={lat}&lon={lon}&start={unix_timestamp}&end={unix_timestamp}
Parameters:
lat- Latitude (required)lon- Longitude (required)start- Start time in Unix timestamp (required)end- End time in Unix timestamp (required)units- Units of measurement (optional)
The historical endpoint provides access to past weather data within a specified time range. Available data goes back up to 5 years. Premium API plans have access to additional historical data.
Weather Alerts Endpoint
Get severe weather warnings and alerts for a location
Request
/alerts?lat={lat}&lon={lon}
Parameters:
lat- Latitude (required)lon- Longitude (required)
The alerts endpoint provides current severe weather warnings and advisory information for the requested location. This includes government-issued weather alerts as well as MagicWeather's AI-enhanced alerts for sudden weather changes.
API Pricing
Free
$0/month
- 1,000 API calls per day
- Current weather
- 5-day forecast
- Basic alerts
- Standard support
Pro
$29/month
- 50,000 API calls per day
- Current & historical weather
- 15-day forecast
- Advanced alerts
- Priority support
Enterprise
Custom/month
- Unlimited API calls
- Full data access
- 30-day forecast
- Custom integrations
- Dedicated support
Developer Resources
Full Documentation
Comprehensive API documentation with all endpoints, parameters, and response formats explained in detail.
Sample Code
Ready-to-use code examples in JavaScript, Python, PHP, Java, and more to help you get started quickly.
SDKs & Libraries
Official client libraries for popular programming languages to simplify API integration.
API Status
Check the current operational status of our API and view historical uptime metrics.