Widget Score
API Reference
Widget Score
Lightweight endpoint for the embeddable AirRating badge.
GET
Widget Score
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
IATA code of the departure airport.
IATA code of the arrival airport.
IATA airline code.
Departure date in
YYYY-MM-DD format.Your API key (optional during beta).
Response
IATA departure airport code.
IATA arrival airport code.
IATA airline code.
Requested date.
Risk Score 0–100.
Risk label:
Low risk, Medium risk, High risk, or Very high risk.Hex color for the score badge (green → red).
Historical delay rate as a whole percentage.
Example
Response
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:
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 |
