Welcome to the Weather API documentation. This API provides current weather data and forecasts for locations worldwide.
https://api.weather.com/v1
To use this API, you need to include your API key in the header of each request:
X-API-Key: your_api_key_here
Get current weather data for a specific location.
Name | Type | Description |
---|---|---|
lat | float | Latitude of the location |
lon | float | Longitude of the location |
{ "location": { "name": "New York", "country": "US", "lat": 40.7128, "lon": -74.0060 }, "current": { "temperature": 22.5, "humidity": 65, "wind_speed": 5.2, "wind_direction": "NE", "condition": "Partly cloudy" } }
Get weather forecast for a specific location.
Name | Type | Description |
---|---|---|
lat | float | Latitude of the location |
lon | float | Longitude of the location |
days | integer | Number of days to forecast (max 7) |
{ "location": { "name": "London", "country": "UK", "lat": 51.5074, "lon": -0.1278 }, "forecast": [ { "date": "2023-06-01", "max_temp": 18.5, "min_temp": 12.3, "condition": "Sunny" }, { "date": "2023-06-02", "max_temp": 20.1, "min_temp": 13.7, "condition": "Partly cloudy" } ] }
The API uses standard HTTP response codes to indicate the success or failure of an API request. In case of an error, the response body will contain more information about the error.
{ "error": { "code": 401, "message": "Invalid API key" } }
The API is rate limited to 1000 requests per day per API key. If you exceed this limit, you will receive a 429 Too Many Requests response.
If you have any questions or need assistance, please contact our support team at support@weather-api.com.