Skip to main content
GET
/
api
/
widget-score
Widget Score
curl --request GET \
  --url https://airrating.io/api/widget-score
{
  "origin": "<string>",
  "destination": "<string>",
  "airline": "<string>",
  "date": "<string>",
  "score": 123,
  "label": "<string>",
  "color": "<string>",
  "delay_rate": 123
}

Overview

Powers the embeddable widget.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

origin
string
required
IATA code of the departure airport.
dest
string
required
IATA code of the arrival airport.
airline
string
required
IATA airline code.
date
string
required
Departure date in YYYY-MM-DD format.
key
string
Your API key (optional during beta).

Response

origin
string
IATA departure airport code.
destination
string
IATA arrival airport code.
airline
string
IATA airline code.
date
string
Requested date.
score
integer
Risk Score 0–100.
label
string
Risk label: Low risk, Medium risk, High risk, or Very high risk.
color
string
Hex color for the score badge (green → red).
delay_rate
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 more div.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

AttributeRequiredDefaultDescription
data-originIATA departure code
data-destIATA arrival code
data-airlineIATA airline code
data-dateDate (YYYY-MM-DD)
data-keyAPI key
data-sizefullfull or compact
data-themedarkdark or light
data-langenen, it, or es
The widget disappears silently on any error — no broken UI on your page.