What is the queryCost parameter?

The queryCost parameter can be found in the response of the Timeline Weather API. QueryCost is used to indicate how many result records the query counts as towards your metered billing or any daily or monthly query cost limit that may apply to the plan being used.

For full information about result record costs, please see ‘What exactly is a weather record?’

Examples of the queryCost parameter

Weather Forecast Request

The following represents the response to a standard Weather API request for the forecast.

https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Sterling%2C%20VA%2C%20US?unitGroup=us&key=YOUR_API_KEY

Weather forecast queries are defined as having a cost of one even though they include multiple days, hours and other features such as alerts, events and current conditions.

 {
    "queryCost": 1,
    "latitude": 39.0334,
    "longitude": -77.4071,
    ...
} 

Historical weather forecast request

The cost of historical weather data requests is based upon the number of records that are returned. Here is an example of a request for a week of historical data that includes both the daily and hourly values.

https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Sterling%2C%20VA%2C%20US/2021-1-1/2021-1-7?unitGroup=us&key=YOUR_API_KEY

The cost of the query is 168 because there are 168 hours in a week (24 multiplied by 7).

 {
   "queryCost": 168,
   "latitude": 39.0334,
   "longitude": -77.4071,
   ...
} 

The ‘includes’ parameter cab be used to limit the result set to daily only data:

https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Sterling%2C%20VA%2C%20US/2021-1-1/2021-1-7?unitGroup=us&key=YOUR_API_KEY&include=days

The cost of the query is reduced to 7:

{
   "queryCost": 7,
   "latitude": 39.0334,
   "longitude": -77.4071,
  ...
}

What is the total cost I can run with my subscription, license or plan?

Different plans have different usage limits or charges. If you are on the free plan with no credit card, then you can run queries that sum up to 1000 query cost per day (for example 1000 forecast requests).

If you add a credit card to the metered plan, any queryCost above 1000 per day is charged at $0.0001 per cost. Therefore if you ran queries totaling 11000 queryCost in a single day, then you would receive 1000 free and then be charged $0.0001 for 10000 results for a total of $1.00.

Some monthly plans have daily or monthly limits. Please see the Pricing and Editions page for more information.

Questions or need help?

If you have a question or need help, please post on our actively monitored forum for the fastest replies. You can also contact us via our support site or drop us an email at support@visualcrossing.com.