API Access Key & Authentication
API Authentication
The first step to using the API is to authenticate with your weatherstack account's unique API access key, which can be found in your account dashboard after registration. To authenticate with the API, simply use the base URL below and pass your API access key to the API's access_key
parameter.
Example API Request:
Sign Up to Run API Request
Keep it safe: Please ensure that you keep your API access key private and do not expose it in any publicly available part of your application. If you ever need to reset your key, simply visit your account dashboard to do so.
256-bit HTTPS Encryption
Users can connect to the weatherstack using industry-standard SSL (HTTPS) by attaching an s
to the HTTP protocol as shown in the example API request below.
Example API Request: Available on: All Plans
API Error Codes
Whenever an API request fails, the weatherstack API will return an error object in lightweight JSON format. Each error object contains an error code, an error type, and an info object containing details about the error that occurred. Below you will find an example error as well as a list of common API errors.
Example API Error:
Common API Errors:
Code | Type | Info |
---|---|---|
404 | 404_not_found | User requested a resource which does not exist. |
101 | unauthorized | User did not supply an access key / invalid access key |
429 | too_many_requests | User has reached his subscription's monthly request allowance. |
601 | missing_query | An invalid (or missing) query value was specified. |
603 | historical_queries_not_supported_on_plan | Historical data is not supported on the current subscription plan. |
604 | bulk_queries_not_supported_on_plan | Bulk queries is not supported on the current subscription plan. |
605 | invalid_language | An invalid language code was specified. |
606 | invalid_unit | An invalid unit value was specified. |
607 | invalid_interval | An invalid interval value was specified. |
608 | invalid_forecast_days | An invalid forecast days value was specified. |
609 | forecast_days_not_supported_on_plan | Weather forecast data is not supported on the current subscription plan. |
611 | invalid_historical_date | An invalid historical date was specified. |
612 | invalid_historical_time_frame | An invalid historical time frame was specified. |
613 | historical_time_frame_too_long | The specified historical time frame is too long. (Maximum: 60 days) |
614 | missing_historical_date | An invalid historical date was specified. |
615 | request_failed | API request has failed. |
616 | missing_latitude | Missing latitude value. |
617 | missing_longitude | Missing longitude value. |
618 | invalid_latitude_type | An invalid latitude value was specified. |
619 | invalid_longitude_type | An invalid longitude value was specified. |
620 | missing_historical_date_start | Missing historical start date value. |
621 | invalid_tide | An invalid tide value was specified. |
622 | invalid_historical_date_start | An invalid historical start date value was specified. |
623 | invalid_historical_date_end | An invalid historical end date value was specified. |
624 | invalid_historical_date_range | An invalid date range was specified. |