Widget Score
curl --request GET \
--url https://airrating.io/api/widget-scoreimport requests
url = "https://airrating.io/api/widget-score"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://airrating.io/api/widget-score', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://airrating.io/api/widget-score",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://airrating.io/api/widget-score"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://airrating.io/api/widget-score")
.asString();require 'uri'
require 'net/http'
url = URI("https://airrating.io/api/widget-score")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"origin": "<string>",
"destination": "<string>",
"airline": "<string>",
"date": "<string>",
"score": 123,
"label": "<string>",
"color": "<string>",
"delay_rate": 123
}API Reference
Widget Score
Lightweight endpoint for the embeddable AirRating badge.
GET
/
api
/
widget-score
Widget Score
curl --request GET \
--url https://airrating.io/api/widget-scoreimport requests
url = "https://airrating.io/api/widget-score"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://airrating.io/api/widget-score', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://airrating.io/api/widget-score",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://airrating.io/api/widget-score"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://airrating.io/api/widget-score")
.asString();require 'uri'
require 'net/http'
url = URI("https://airrating.io/api/widget-score")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"origin": "<string>",
"destination": "<string>",
"airline": "<string>",
"date": "<string>",
"score": 123,
"label": "<string>",
"color": "<string>",
"delay_rate": 123
}Overview
Powers the embeddablewidget.js badge. Returns a minimal risk score payload optimised for frontend rendering. Open CORS — can be called directly from any domain.
Responses are cached for 1 hour (s-maxage=3600).
Request
string
required
IATA code of the departure airport.
string
required
IATA code of the arrival airport.
string
required
IATA airline code.
string
required
Departure date in
YYYY-MM-DD format.string
Your API key (optional during beta).
Response
string
IATA departure airport code.
string
IATA arrival airport code.
string
IATA airline code.
string
Requested date.
integer
Risk Score 0–100.
string
Risk label:
Low risk, Medium risk, High risk, or Very high risk.string
Hex color for the score badge (green → red).
integer
Historical delay rate as a whole percentage.
Example
curl "https://airrating.io/api/widget-score?origin=FCO&dest=LHR&airline=AZ&date=2026-04-10"
Response
{
"origin": "FCO",
"destination": "LHR",
"airline": "AZ",
"date": "2026-04-10",
"score": 62,
"label": "High risk",
"color": "#f97316",
"delay_rate": 33
}
Embedding the widget
Add the script tag once per page and place one or morediv.airrating-widget elements wherever you want the badge to appear:
<div class="airrating-widget"
data-origin="FCO"
data-dest="LHR"
data-airline="AZ"
data-date="2026-04-10"
data-key="YOUR_API_KEY">
</div>
<script src="https://airrating.io/widget.js" async></script>
Widget attributes
| Attribute | Required | Default | Description |
|---|---|---|---|
data-origin | ✓ | — | IATA departure code |
data-dest | ✓ | — | IATA arrival code |
data-airline | ✓ | — | IATA airline code |
data-date | ✓ | — | Date (YYYY-MM-DD) |
data-key | — | — | API key |
data-size | — | full | full or compact |
data-theme | — | dark | dark or light |
data-lang | — | en | en, it, or es |
The widget disappears silently on any error — no broken UI on your page.
