Hour-by-hour forecast (next 48 hours)
Hour-by-hour forecast for up to 48 hours.
Request
GEThttps://weather.p.apihiver.com/v1/hourly?coords=19.07%2C72.87&hours=6
String. City name, e.g.
Mumbai. Give city or coords. String. ISO country code to pick the right city, e.g.
IN. String. Latitude,longitude, e.g.
19.07,72.87. Give city or coords. Number. Number of hours (1–48, default
24). Language
Client
1curl --request GET \
2 --url 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6' \
3 --header 'Accept: application/json' \
4 --header 'X-API-Key: YOUR_API_KEY'Hour-by-hour forecast (next 48 hours): Weather API reference
Hour-by-hour forecast for up to 48 hours. This endpoint is part of the Weather API: Current weather, 9-day forecasts, hourly forecasts, and sunrise/sunset/moon phase for any city or coordinates worldwide.
Hour-by-hour forecast (next 48 hours): example requests in every language
GET /v1/hourly in Shell (cURL)
curl --request GET \
--url 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6' \
--header 'Accept: application/json' \
--header 'X-API-Key: YOUR_API_KEY'GET /v1/hourly in Shell (HTTPie)
http GET 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6' \
Accept:application/json \
X-API-Key:YOUR_API_KEYGET /v1/hourly in Shell (Wget)
wget --quiet \
--method GET \
--header 'Accept: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--output-document \
- 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6'GET /v1/hourly in Node.js (http)
const http = require('https');
const options = {
method: 'GET',
hostname: 'weather.p.apihiver.com',
port: null,
path: '/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();GET /v1/hourly in Node.js (Request)
const request = require('request');
const options = {
method: 'GET',
url: 'https://weather.p.apihiver.com/v1/hourly',
qs: {city: '{city}', country: '{country}', coords: '19.07,72.87', hours: '6'},
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});GET /v1/hourly in Node.js (Unirest)
const unirest = require('unirest');
const req = unirest('GET', 'https://weather.p.apihiver.com/v1/hourly');
req.query({
city: '{city}',
country: '{country}',
coords: '19.07,72.87',
hours: '6'
});
req.headers({
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});GET /v1/hourly in Node.js (Axios)
const axios = require('axios').default;
const options = {
method: 'GET',
url: 'https://weather.p.apihiver.com/v1/hourly',
params: {city: '{city}', country: '{country}', coords: '19.07,72.87', hours: '6'},
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}GET /v1/hourly in Node.js (Fetch)
const fetch = require('node-fetch');
const url = 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6';
const options = {
method: 'GET',
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}GET /v1/hourly in JavaScript (XMLHttpRequest)
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6');
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('X-API-Key', 'YOUR_API_KEY');
xhr.send(data);GET /v1/hourly in JavaScript (Axios)
import axios from 'axios';
const options = {
method: 'GET',
url: 'https://weather.p.apihiver.com/v1/hourly',
params: {city: '{city}', country: '{country}', coords: '19.07,72.87', hours: '6'},
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}GET /v1/hourly in JavaScript (Fetch)
const url = 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6';
const options = {
method: 'GET',
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}GET /v1/hourly in JavaScript (jQuery)
const settings = {
async: true,
crossDomain: true,
url: 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6',
method: 'GET',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});GET /v1/hourly in Python (http.client)
import http.client
conn = http.client.HTTPSConnection("weather.p.apihiver.com")
headers = {
'Accept': "application/json",
'X-API-Key': "YOUR_API_KEY"
}
conn.request("GET", "/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))GET /v1/hourly in Python (Requests)
import requests
url = "https://weather.p.apihiver.com/v1/hourly"
querystring = {"city":"{city}","country":"{country}","coords":"19.07,72.87","hours":"6"}
headers = {
"Accept": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())GET /v1/hourly in PHP (cURL)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"X-API-Key: YOUR_API_KEY"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}GET /v1/hourly in PHP (Guzzle)
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => 'YOUR_API_KEY',
],
]);
echo $response->getBody();GET /v1/hourly in PHP (PECL HTTP v1)
<?php
$request = new HttpRequest();
$request->setUrl('https://weather.p.apihiver.com/v1/hourly');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'city' => '{city}',
'country' => '{country}',
'coords' => '19.07,72.87',
'hours' => '6'
]);
$request->setHeaders([
'Accept' => 'application/json',
'X-API-Key' => 'YOUR_API_KEY'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}GET /v1/hourly in PHP (PECL HTTP v2)
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://weather.p.apihiver.com/v1/hourly');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'city' => '{city}',
'country' => '{country}',
'coords' => '19.07,72.87',
'hours' => '6'
]));
$request->setHeaders([
'Accept' => 'application/json',
'X-API-Key' => 'YOUR_API_KEY'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();GET /v1/hourly in Java (AsyncHttp)
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6")
.setHeader("Accept", "application/json")
.setHeader("X-API-Key", "YOUR_API_KEY")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();GET /v1/hourly in Java (java.net.http)
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6"))
.header("Accept", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());GET /v1/hourly in Java (OkHttp)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6")
.get()
.addHeader("Accept", "application/json")
.addHeader("X-API-Key", "YOUR_API_KEY")
.build();
Response response = client.newCall(request).execute();GET /v1/hourly in Java (Unirest)
HttpResponse<String> response = Unirest.get("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6")
.header("Accept", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.asString();GET /v1/hourly in C# (HttpClient)
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6"),
Headers =
{
{ "Accept", "application/json" },
{ "X-API-Key", "YOUR_API_KEY" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}GET /v1/hourly in C# (RestSharp)
var client = new RestClient("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6");
var request = new RestRequest("", Method.Get);
request.AddHeader("Accept", "application/json");
request.AddHeader("X-API-Key", "YOUR_API_KEY");
var response = client.Execute(request);GET /v1/hourly in Go (NewRequest)
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Accept", "application/json")
req.Header.Add("X-API-Key", "YOUR_API_KEY")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}GET /v1/hourly in Ruby (net::http)
require 'uri'
require 'net/http'
url = URI("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["X-API-Key"] = 'YOUR_API_KEY'
response = http.request(request)
puts response.read_bodyGET /v1/hourly in Swift (NSURLSession)
import Foundation
let headers = [
"Accept": "application/json",
"X-API-Key": "YOUR_API_KEY"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()GET /v1/hourly in Objective-C (NSURLSession)
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Accept": @"application/json",
@"X-API-Key": @"YOUR_API_KEY" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];GET /v1/hourly in Kotlin (OkHttp)
val client = OkHttpClient()
val request = Request.Builder()
.url("https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6")
.get()
.addHeader("Accept", "application/json")
.addHeader("X-API-Key", "YOUR_API_KEY")
.build()
val response = client.newCall(request).execute()GET /v1/hourly in C (libcurl)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);GET /v1/hourly in Clojure (clj-http)
(require '[clj-http.client :as client])
(client/get "https://weather.p.apihiver.com/v1/hourly" {:headers {:X-API-Key "YOUR_API_KEY"}
:query-params {:city "{city}"
:country "{country}"
:coords "19.07,72.87"
:hours "6"}
:accept :json})GET /v1/hourly in OCaml (CoHTTP)
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6" in
let headers = Header.add_list (Header.init ()) [
("Accept", "application/json");
("X-API-Key", "YOUR_API_KEY");
] in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)GET /v1/hourly in R (httr)
library(httr)
url <- "https://weather.p.apihiver.com/v1/hourly"
queryString <- list(
city = "{city}",
country = "{country}",
coords = "19.07,72.87",
hours = "6"
)
response <- VERB("GET", url, query = queryString, add_headers('X-API-Key' = 'YOUR_API_KEY'), content_type(""), accept("application/json"))
content(response, "text")GET /v1/hourly in PowerShell (Invoke-WebRequest)
$headers=@{}
$headers.Add("Accept", "application/json")
$headers.Add("X-API-Key", "YOUR_API_KEY")
$response = Invoke-WebRequest -Uri 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6' -Method GET -Headers $headersGET /v1/hourly in PowerShell (Invoke-RestMethod)
$headers=@{}
$headers.Add("Accept", "application/json")
$headers.Add("X-API-Key", "YOUR_API_KEY")
$response = Invoke-RestMethod -Uri 'https://weather.p.apihiver.com/v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6' -Method GET -Headers $headersGET /v1/hourly in HTTP (HTTP/1.1)
GET /v1/hourly?city=%7Bcity%7D&country=%7Bcountry%7D&coords=19.07%2C72.87&hours=6 HTTP/1.1
Accept: application/json
X-Api-Key: YOUR_API_KEY
Host: weather.p.apihiver.com
Example response (200, application/json)
Success.
1{
2 "hours": [
3 {
4 "time": "2026-09-26T23:30:00+05:30",
5 "condition": "Partly cloudy",
6 "temperature_c": 26.9,
7 "wind_speed_ms": 4.3,
8 "humidity_percent": 83.9,
9 "precipitation_mm": 0,
10 "cloud_cover_percent": 71.1
11 },
12 {
13 "time": "2026-09-27T00:30:00+05:30",
14 "condition": "Partly cloudy",
15 "temperature_c": 26.6,
16 "wind_speed_ms": 4.1,
17 "humidity_percent": 85.1,
18 "precipitation_mm": 0,
19 "cloud_cover_percent": 81.2
20 },
21 {
22 "time": "2026-09-27T01:30:00+05:30",
23 "condition": "Cloudy",
24 "temperature_c": 26.4,
25 "wind_speed_ms": 4.4,
26 "humidity_percent": 85.5,
27 "precipitation_mm": 0,
28 "cloud_cover_percent": 97.7
29 }
30 ],
31 "source": "MET Norway",
32 "location": {
33 "lat": 19.07,
34 "lon": 72.87,
35 "name": "Mumbai",
36 "timezone": "Asia/Kolkata",
37 "country_code": "IN"
38 }
39}Errors
- 400 — A required parameter is missing or a value has the wrong format.
1{ 2 "error": { 3 "code": "INVALID_INPUT", 4 "message": "Pass 'city' (e.g. Mumbai) or 'coords' (lat,lon)." 5 } 6}
Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.