# Weather Forecast API - Hourly Series by Coordinates (`stas_k/weather-forecast-hourly-api`) Actor

Most weather APIs charge for a pair that is not a coordinate, or hide commercial use behind a paid plan. This Actor charges only for a real forecast: a bad pair comes back free with the reason. Hourly series plus daily high and low, metric or imperial, no API key.

- **URL**: https://apify.com/stas_k/weather-forecast-hourly-api.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** Developer tools, Automation, Travel
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 locations

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Weather Forecast API - Hourly Series and Daily High/Low by Coordinates

You should not pay for a place that was never read. Send coordinates, get the hourly
series back, and every pair that is not a real point comes back free with the reason
instead of an empty row and a charge.

### What it returns

One row per coordinate pair:

- `latitude`, `longitude`, `units`, `hours` (how many points came back), `updatedAt`
  (when the model ran), `source` (the attribution string);
- `hourly`: the first N points of the series, each entry with `time`, `temperature`,
  `windSpeed`, `windDirection`, `humidity`, `pressure`, `cloudCover`, `precipitation`,
  `precipitationStepHours` and the weather `symbol`. Every entry carries all of them: near
  the point the source is hourly, further out it gives a 6 or 12 hour step, and the step
  used is named instead of leaving the field empty;
- `daily` (optional): one entry per day with `temperatureMin`, `temperatureMax` and
  `precipitationSum`, computed from the same series, so nothing is invented to fill it.

Units are `metric` (celsius, km/h, mm) or `imperial` (fahrenheit, mph, inch). The source
gives celsius, metres per second and millimetres; the conversion is ours and covers all
three, including the precipitation of each point and the daily sum. Millimetres are divided
by 25.4, so an imperial row never shows a metric amount under an imperial label.

### Input

`locations` is a list of `latitude,longitude` pairs, for example `50.45,30.52`. Names are
not accepted: geocoding is a different service with its own limits, and pulling it in
would add a wall to a source that has none. `hours` is 1 to 72, `maxLocations` is 1 to 500,
`includeDaily` adds the daily summary.

### What is free and what is charged

Charged only for a place whose series was really read and written to the dataset, at
$0.0005 per place. Free, with a status and a plain reason:

- `INVALID_INPUT`: not a coordinate pair, or outside the real ranges;
- `DUPLICATE`: the same pair was already sent or already delivered in this run;
- `NOT_CHECKED_LIMIT`: past `maxLocations`;
- `NOT_CHECKED_CAP`: the spending limit or the remaining budget ended before this place;
- `NOT_CHECKED_TIME`: the run was running out of its five minutes;
- `NOT_CHECKED_BILLING`: the price of this event could not be read, so nothing is claimed
  as sold;
- `NOT_CHECKED_ERROR`: the source did not answer for this place, with the reason named.

The lowest spending limit you can set per run is $0.05. That number is a floor for
your own limit, not a fee: one pair costs a fraction of a cent, and a run of a
hundred pairs costs five cents.

If every coordinate pair was asked for and none was read, the run fails and says how many
attempts were made and why the first one failed. A different failure is an input with no
coordinate pair at all: the message then names the number of places that were not pairs and
gives the expected format, because the source was never asked and nothing is charged. A run
that read nothing is never reported as a success, because a green run with an empty dataset
is the most expensive kind of quiet.

### Source and attribution

Forecast data is from the Norwegian Meteorological Institute (MET Norway), Locationforecast
2.0, published under CC-BY 4.0. Attribution is required and is given here and in every run
summary (`source`). Requests carry a User-Agent with a contact, as their terms ask. The
service is free of charge, including commercial use, and needs no API key.

We do not use Open-Meteo for this actor: their free endpoint is for non-commercial use
only, and a paid actor on the Store is commercial use.

### Limits

- `hours` up to 72; the source covers about nine days and the first two are hourly.
- `maxLocations` up to 500 per run.
- The run is designed to finish inside the platform's five minute window; places it could
  not reach are listed as free rows with a status, never silently dropped.
- Memory is 256 MB, which is enough because a run holds one timeseries at a time.

### What this actor does not do

- It does not accept city names, and it does not geocode.
- It does not give historical weather, only the forecast the source publishes now.
- It does not smooth or interpolate the series: what the source says is what a row says,
  and a missing value stays empty rather than becoming a zero.
- It does not promise that a place is covered by a local model; the source decides, and a
  place it cannot answer for comes back free.

# Actor input Schema

## `locations` (type: `array`):

Coordinates as latitude,longitude, one pair per row, for example 50.45,30.52. Every pair that is not a real point comes back free with the reason.

## `units` (type: `string`):

metric: celsius, km/h, mm. imperial: fahrenheit, mph, inch (precipitation is converted too, not just relabelled).

## `maxLocations` (type: `integer`):

Every place past this number still gets a free row that says it was not attempted.

## `hours` (type: `integer`):

How many points of the series to return per place, 1 to 72. Near the point the source is hourly; past that it gives a 6 or 12 hour step, and each entry says which step it came from in precipitationStepHours.

## `includeDaily` (type: `boolean`):

Add one entry per day with the minimum and maximum temperature and the precipitation sum, computed from the same series.

## Actor input object example

```json
{
  "locations": [
    "50.45,30.52",
    "52.52,13.40",
    "48.85,2.35"
  ],
  "units": "metric",
  "maxLocations": 50,
  "hours": 24,
  "includeDaily": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per place. Paid rows carry the coordinates, the units, the hourly series and the daily high and low; rows that could not be read carry status, reason and billable false, so the free rows have no data fields to fill.

## `summary` (type: `string`):

Counters for the run: locationsRequested, locationsDelivered, chargedEvents, chargeUncertain, deliveredUnverified, byStatus, counterMismatch, stopReason, the source with its CC-BY attribution, and the free statuses NOT_CHECKED_LIMIT, NOT_CHECKED_CAP, NOT_CHECKED_TIME, NOT_CHECKED_BILLING, NOT_CHECKED_ERROR.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "locations": [
        "50.45,30.52",
        "52.52,13.40",
        "48.85,2.35"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/weather-forecast-hourly-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "locations": [
        "50.45,30.52",
        "52.52,13.40",
        "48.85,2.35",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/weather-forecast-hourly-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "locations": [
    "50.45,30.52",
    "52.52,13.40",
    "48.85,2.35"
  ]
}' |
apify call stas_k/weather-forecast-hourly-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stas_k/weather-forecast-hourly-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/eUgMHCIYttkNE1BDD/builds/j9lyJQd3mKnnQNSeX/openapi.json
