Getting started overview

This guide outlines the process for new users to begin integrating the AccuWeather API into their applications. It covers account creation, API key generation, and executing an initial API call to retrieve weather data.

The AccuWeather API provides access to various weather data types, including current conditions, historical data, and forecasts. All interactions with the API require an API key for authentication, which is obtained through the AccuWeather developer portal. The platform supports a free Developer package for testing and low-volume use, offering 50 API calls per day, with paid plans available for increased usage (AccuWeather API packages).

Before making requests, it is often necessary to first obtain a Location Key, which uniquely identifies a geographic location within the AccuWeather system. This key is then used in subsequent requests to retrieve specific weather information for that location.

Here's a quick reference table for getting started:

Step What to do Where
1. Sign Up Create an AccuWeather developer account. AccuWeather Developer Portal
2. Choose Package Select a suitable API package (e.g., Developer package). AccuWeather Packages page
3. Get API Key Generate your unique API key from your dashboard. AccuWeather Developer Dashboard
4. Get Location Key Use the Location Search API to find a key for your desired location. AccuWeather Location API reference
5. Make Request Construct and execute your first API call using your API Key and Location Key. Your preferred development environment

Create an account and get keys

To access the AccuWeather API, an account is required on the AccuWeather Developer Portal. Follow these steps to set up your account and obtain your API key:

  1. Navigate to the Developer Portal: Go to the AccuWeather Developer homepage.
  2. Sign Up: Click on the "Sign Up" or "Register" option. You will typically need to provide an email address, create a password, and agree to the terms of service.
  3. Choose an API Package: After signing up, you will be prompted to select an API package. For evaluation and development, the "Developer" package is available, offering 50 calls per day free of charge (AccuWeather API pricing details). Select this package to proceed.
  4. Access Your Dashboard: Once your account is active and a package is selected, you will be directed to your developer dashboard.
  5. Generate API Key: Within your dashboard, locate the section for "My Apps" or "API Keys." You might need to create a new application to generate a unique API key. The API key is a unique alphanumeric string that authenticates your requests to the AccuWeather API (AccuWeather API documentation). Keep this key secure and do not expose it in client-side code or public repositories.

Once you have your API key, you are ready to proceed with making your first API request.

Your first request

Before you can retrieve specific weather data, you often need to identify the location using a unique Location Key. The AccuWeather API uses these keys to pinpoint geographic areas. This example demonstrates how to find a Location Key and then use it to get current conditions.

Step 1: Get a Location Key

The Location Search API is used to find the unique identifier for a specific city or region. For example, to find the Location Key for 'London', you would make a request similar to this:

GET http://dataservice.accuweather.com/locations/v1/cities/search?apikey=YOUR_API_KEY&q=London

Replace YOUR_API_KEY with the key you obtained from your developer dashboard. The response will be a JSON array containing location objects. Each object includes a Key field, which is the Location Key you need. For instance, a snippet of the response might look like this:

[
  {
    "Version": 1,
    "Key": "328328",
    "Type": "City",
    "Rank": 30,
    "LocalizedName": "London",
    "EnglishName": "London",
    "PrimaryPostalCode": "SW1A 0AA",
    "Region": {
      "ID": "EUR",
      "LocalizedName": "Europe",
      "EnglishName": "Europe"
    },
    "Country": {
      "ID": "GB",
      "LocalizedName": "United Kingdom",
      "EnglishName": "United Kingdom"
    },
    "AdministrativeArea": {
      "ID": "ENG",
      "LocalizedName": "England",
      "EnglishName": "England",
      "Level": 1,
      "LocalizedType": "Country",
      "EnglishType": "Country",
      "CountryID": "GB"
    },
    "TimeZone": {
      "Code": "GMT",
      "Name": "Europe/London",
      "GmtOffset": 0.0,
      "IsDaylightSaving": false,
      "NextOffsetChange": null
    },
    "GeoPosition": {
      "Latitude": 51.507,
      "Longitude": -0.127,
      "Elevation": {
        "Metric": {
          "Value": 24.0,
          "Unit": "m",
          "UnitType": 5
        },
        "Imperial": {
          "Value": 78.0,
          "Unit": "ft",
          "UnitType": 0
        }
      }
    },
    "IsAlias": false,
    "ParentCity": {
      "Key": "328328",
      "LocalizedName": "London",
      "EnglishName": "London"
    },
    "SupplementalAdminAreas": [],
    "DataSets": [
      "AirQualityCurrentConditions",
      "AirQualityForecasts",
      "Alerts",
      "Forecasts",
      "Indices",
      "MinuteCast"
    ]
  }
]

From this response, identify the Key for the desired location. For London, as shown above, it's 328328.

Step 2: Get Current Conditions

Once you have the Location Key, you can use it to fetch current weather conditions. Using the Location Key 328328 for London:

GET http://dataservice.accuweather.com/currentconditions/v1/328328?apikey=YOUR_API_KEY

Again, replace YOUR_API_KEY with your actual API key. The response will provide current weather details:

[
  {
    "LocalObservationDateTime": "2026-05-29T10:00:00+01:00",
    "EpochTime": 1780444800,
    "WeatherText": "Partly cloudy",
    "WeatherIcon": 4,
    "HasPrecipitation": false,
    "PrecipitationType": null,
    "IsDayTime": true,
    "Temperature": {
      "Metric": {
        "Value": 18.0,
        "Unit": "C",
        "UnitType": 17
      },
      "Imperial": {
        "Value": 64.0,
        "Unit": "F",
        "UnitType": 18
      }
    },
    "RealFeelTemperature": {
      "Metric": {
        "Value": 18.0,
        "Unit": "C",
        "UnitType": 17
      },
      "Imperial": {
        "Value": 64.0,
        "Unit": "F",
        "UnitType": 18
      }
    },
    "RelativeHumidity": 60,
    "Wind": {
      "Direction": {
        "Degrees": 270,
        "Localized": "W",
        "English": "W"
      },
      "Speed": {
        "Metric": {
          "Value": 15.0,
          "Unit": "km/h",
          "UnitType": 7
        },
        "Imperial": {
          "Value": 9.0,
          "Unit": "mi/h",
          "UnitType": 9
        }
      }
    },
    "Pressure": {
      "Metric": {
        "Value": 1012.0,
        "Unit": "mb",
        "UnitType": 8
      },
      "Imperial": {
        "Value": 29.88,
        "Unit": "inHg",
        "UnitType": 12
      }
    }
  }
]

This response confirms a successful API call, providing current temperature, weather conditions, humidity, and wind details for London. You can find more endpoints and their specific parameters in the AccuWeather API reference documentation.

Common next steps

After successfully making your first API call, consider these next steps to further integrate and optimize your use of the AccuWeather API:

  1. Explore Additional Endpoints: The AccuWeather API offers various endpoints beyond current conditions, including 1-day, 5-day, and 10-day forecasts, historical data, and weather alerts. Review the AccuWeather API reference to identify other data types relevant to your application.
  2. Implement Error Handling: Incorporate robust error handling in your application to manage potential issues such as invalid API keys, rate limit exceeded errors, or network problems. Understanding HTTP status codes and API-specific error messages is crucial (MDN Web Docs on HTTP status codes).
  3. Manage API Key Security: Never hardcode your API key directly into client-side code or public repositories. For server-side applications, use environment variables. For client-side applications, consider proxying requests through your own backend to keep the key secure.
  4. Monitor Usage: Keep track of your API usage to stay within your package's limits. Your AccuWeather developer dashboard typically provides usage statistics. Upgrade your plan if your application's needs exceed the current package's call volume (AccuWeather API packages and pricing).
  5. Cache Data: To reduce API calls and improve performance, implement caching strategies for frequently requested weather data. Be mindful of data freshness requirements and AccuWeather's terms of service regarding data caching.
  6. Consider Location Key Management: For applications serving multiple locations, develop a strategy for efficiently managing and storing Location Keys, potentially including a mechanism to search for and store keys dynamically.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting tips for the AccuWeather API:

  • Invalid API Key (HTTP 401 Unauthorized):
    • Check for typos: Ensure your API key is copied exactly as provided in your developer dashboard.
    • Key activation: Verify that your API key is active and associated with a valid package on your AccuWeather developer dashboard.
    • Quotes: If using cURL or similar tools, ensure your API key is correctly enclosed in quotes if it contains special characters, though this is less common for API keys.
  • Rate Limit Exceeded (HTTP 403 Forbidden or similar):
    • Check usage: Review your API usage on your dashboard. The free Developer package has a limit of 50 calls per day.
    • Wait: If you've exceeded the limit, you may need to wait until the next day for your quota to reset.
    • Upgrade: If your testing requires more calls, consider upgrading to a paid package (AccuWeather API pricing).
  • Bad Request (HTTP 400):
    • Missing parameters: Ensure all required parameters (e.g., apikey, q for location search, Location Key for conditions) are present in your request URL.
    • Incorrect parameter format: Verify that parameter values are correctly formatted (e.g., Location Key is a number, query string is URL-encoded).
    • URL encoding: If your query string (q parameter) contains spaces or special characters, ensure it is URL-encoded.
  • No Data Returned (Empty Array or 204 No Content):
    • Incorrect Location Key: Double-check that the Location Key you're using is valid and corresponds to an actual location. Try re-running the Location Search API call.
    • API endpoint: Ensure you are calling the correct API endpoint for the data you expect (e.g., currentconditions/v1/ for current conditions).
  • Network Issues:
    • Internet connection: Verify your internet connection is active.
    • Firewall/Proxy: If you are in a corporate network, ensure that your firewall or proxy settings are not blocking access to the AccuWeather API domain (dataservice.accuweather.com).