Skip to main content

Mock Weather Data API

MOCK DATA

Generated demo weather — NOT a forecast. Physically coherent records per climate profile: snow only below 4°C, storms bring wind, exact °F conversion.

Generated test data for fixtures and development

Base URL
/api/weather
Capabilities
1 route Seedable
Last updated
July 29, 2026

GET /api/weather

Live requestRuns against the public API
No key required
GET/api/weather?climate=tropical&count=7&seed=42

Request parameters

Climate profile — temperature and humidity stay inside its band (tropical 22–36°C/60–100%, temperate −5–28°C, arctic −40–8°C, desert 8–48°C/5–30%). Omit for a mix.

Advanced response options7 options

How many records to generate (1–100).

Deterministic output: the same seed always returns the same records. Omit for random (the used seed is echoed in meta.seed).

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Response format: json envelope, ndjson (one record per line) or csv.

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/weather?climate=tropical&count=7&seed=42"
const res = await fetch("https://randomapi.dev/api/weather?climate=tropical&count=7&seed=42");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/weather?climate=tropical&count=7&seed=42").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/weather?climate=tropical&count=7&seed=42"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
climate enum

Climate profile — temperature and humidity stay inside its band (tropical 22–36°C/60–100%, temperate −5–28°C, arctic −40–8°C, desert 8–48°C/5–30%). Omit for a mix.

allowed: tropical | temperate | arctic | desert
example: climate=tropical
Universal parameters Shared response and formatting options 7
count int

How many records to generate (1–100).

default: 10
allowed: 1 – 100
example: count=3
seed int

Deterministic output: the same seed always returns the same records. Omit for random (the used seed is echoed in meta.seed).

example: seed=42
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=condition,temperatureC
exclude list

Return all fields except these (comma-separated).

example: exclude=climate
format enum

Response format: json envelope, ndjson (one record per line) or csv.

default: json
allowed: json | ndjson | csv
example: format=csv
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 9
condition string

sunny | partly-cloudy | cloudy | rain | snow | storm | fog. Obeys the physics rules (snow only below 4°C, no rain/storm in desert).

example: partly-cloudy

temperatureC float (one decimal)

Temperature in °C, inside the climate's band, stepping in 0.5° so the °F conversion stays exact.

example: 23.5

temperatureF float (one decimal)

Exactly temperatureC × 9⁄5 + 32 — always consistent with temperatureC.

example: 74.3

humidity integer

Relative humidity 0–100 %, inside the climate's band; ≥ 55 whenever it rains or storms.

example: 68

windKmh integer

Wind speed 0–110 km/h; storms always ≥ 40.

example: 14

windDirection string

8-point compass direction: N, NE, E, SE, S, SW, W or NW.

example: SW

pressureHpa integer

Air pressure 960–1045 hPa; storms sit at the low end.

example: 1012

uvIndex integer

UV index 0–11, coupled to the condition: high when sunny, near zero in rain, storm or fog.

example: 7

climate string

The climate profile this record was generated from (echoes ?climate when set).

example: tropical

Documented examples

Build-generated requests and complete responses
3
A week of tropical demo weather
GET /api/weather?climate=tropical&count=7&seed=42
{
  "data": [
    {
      "condition": "fog",
      "temperatureC": 28.5,
      "temperatureF": 83.3,
      "humidity": 84,
      "windKmh": 19,
      "windDirection": "S",
      "pressureHpa": 992,
      "uvIndex": 0,
      "climate": "tropical"
    },
    {
      "condition": "sunny",
      "temperatureC": 22.5,
      "temperatureF": 72.5,
      "humidity": 78,
      "windKmh": 32,
      "windDirection": "NW",
      "pressureHpa": 999,
      "uvIndex": 7,
      "climate": "tropical"
    },
    {
      "condition": "sunny",
      "temperatureC": 34,
      "temperatureF": 93.2,
      "humidity": 74,
      "windKmh": 28,
      "windDirection": "S",
      "pressureHpa": 990,
      "uvIndex": 9,
      "climate": "tropical"
    },
    {
      "condition": "cloudy",
      "temperatureC": 24,
      "temperatureF": 75.2,
      "humidity": 61,
    …
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Arctic conditions for snow-UI testing
GET /api/weather?climate=arctic&count=10&seed=7
{
  "data": [
    {
      "condition": "snow",
      "temperatureC": -7.5,
      "temperatureF": 18.5,
      "humidity": 71,
      "windKmh": 10,
      "windDirection": "W",
      "pressureHpa": 992,
      "uvIndex": 3,
      "climate": "arctic"
    },
    {
      "condition": "cloudy",
      "temperatureC": -12,
      "temperatureF": 10.4,
      "humidity": 58,
      "windKmh": 47,
      "windDirection": "N",
      "pressureHpa": 1040,
      "uvIndex": 5,
      "climate": "arctic"
    },
    {
      "condition": "fog",
      "temperatureC": -18.5,
      "temperatureF": -1.3,
      "humidity": 75,
      "windKmh": 45,
      "windDirection": "N",
      "pressureHpa": 996,
      "uvIndex": 2,
      "climate": "arctic"
    },
    {
      "condition": "partly-cloudy",
      "temperatureC": -2,
      "temperatureF": 28.4,
      "humidity": 69,
    …
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Mixed climates as CSV
GET /api/weather?count=20&format=csv&seed=3
condition,temperatureC,temperatureF,humidity,windKmh,windDirection,pressureHpa,uvIndex,climate
sunny,1.5,34.7,31,58,SW,1029,7,temperate
partly-cloudy,46,114.8,9,37,W,1037,8,desert
partly-cloudy,25.5,77.9,87,31,SE,1009,3,tropical
fog,36,96.8,93,52,E,998,1,tropical
sunny,-15,5,77,11,S,1000,11,arctic
sunny,21.5,70.7,95,11,E,1018,7,temperate
cloudy,27.5,81.5,35,32,S,990,3,temperate
partly-cloudy,8,46.4,68,51,SE,1044,7,temperate
partly-cloudy,26.5,79.7,98,38,E,1016,7,tropical
partly-cloudy,-35,-31,50,45,S,1032,8,arctic
partly-cloudy,23.5,74.3,15,12,W,991,6,desert
cloudy,8,46.4,83,9,SE,1044,2,temperate
partly-cloudy,0,32,57,13,N,1035,7,temperate
fog,12,53.6,24,30,W,1027,0,desert
sunny,17,62.6,62,18,E,1045,9,temperate
snow,-24,-11.2,84,5,SE,1006,0,arctic
cloudy,37,98.6,26,6,NW,1033,2,desert
sunny,36,96.8,6,50,SE,1041,6,desert
sunny,42.5,108.5,12,36,E,1019,8,desert
cloudy,-14.5,5.9,57,7,N,1044,5,arctic

About this API

Coverage & behavior

This is generated demo data, not a forecast. No observation or weather service is behind it — the endpoint invents plausible readings for UI mockups, dashboard demos and test fixtures, so never use it to decide whether to bring an umbrella.

What makes it useful is that the fake readings are physically coherent instead of independently random:

  • snow only appears when temperatureC is below 4 °C (and rain/storm only above freezing).
  • rain and storm records always carry humidity ≥ 55 %.
  • storm records always blow at ≥ 40 km/h, with low pressure.
  • uvIndex follows the sky: high when sunny (6–11), near zero in rain, storm or fog.
  • temperatureF is exactly temperatureC × 9⁄5 + 32 — temperatures step in 0.5 °C so both values stay at one decimal with no rounding drift.

Pick a climate profile and temperature + humidity stay inside its band: tropical 22–36 °C / 60–100 %, temperate −5–28 °C, arctic −40–8 °C, desert 8–48 °C / 5–30 %. Because desert humidity tops out at 30 %, desert records never produce rain or storm. Omit climate for a mix of all four (each record's climate field says which profile it used). With a seed the same request returns byte-identical weather forever.

Use it for

  • Fill a weather-widget or dashboard mockup with coherent-looking conditions
  • Test UI states per condition (snow icons, storm warnings) without waiting for real weather
  • Seeded fixtures for climate-dependent features — the same 'weather' in every CI run

Frequently asked questions

Is this a real weather forecast?

No — explicitly not. Records are generated (badged mock) for building weather UIs without keys or quotas. For real forecasts use a meteorological service.

Why does the data still look plausible?

Physical coherence is enforced: snow only appears below ~4 °C, storms bring high wind, humidity fits the climate, and °F is the exact conversion of °C.

Can I pick a climate?

climate=tropical|temperate|arctic|desert biases conditions and temperature ranges to that profile.