# VariFlight DataWorks【Flight Happiness Index 】API Documentation
**Product Page:** [Flight Happiness Index](https://dataworks.variflight.com/products/flight-happiness-index/)
**Contact Us:** [DataWorks Contact](https://dataworks.variflight.com/about-us/contact/)
**Provider:** VariFlight DataWorks
**Website:** [DataWorks](https://dataworks.variflight.com/)
**Email:** dataworks@variflight.com
**Address:** Building E, High-tech Innovation Valley, Wenqu Road, High-tech Zone, Hefei, P.R.China
**Singapore Entity Address:** 1 Raffles Place, #02-209, Singapore 048616
Introduction
This document primarily introduces the standardized interface data HTTP interface subscription push specifications provided by VariFlight, along with detailed parameter information. The interface adopts UTF-8 encoding.
Authentication
The interface uses both token and IP for concurrent verification.
Token generation algorithm:
In the URL, all request parameters (excluding the token) are sorted in ascending order by KEY, the parameter names are connected in lowercase with the '&' symbol, then connected with the value of the Registration code, and then encrypted twice using MD5 (32-bit lowercase) encryption.
Registration code: Please obtain the registration code from the administrator of VariFlight. It is necessary for verification during the request process by both parties. Please be careful not to disclose it to the public.
Example (PHP):
| ksort($data);
foreach($data as $k=>$v){
$strtomd5[]=$k.'='.$v;
}
$token= md5(md5(implode('&',$strtomd5).$appsecurity)); |
| --- |
Example (Java):
| public static String generateToken(Map data, String appsecurity) {
String concatenatedString = data.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.map(entry -> entry.getKey() + "=" + entry.getValue())
.reduce((s1, s2) -> s1 + "&" + s2)
.orElse("") + appsecurity;
return calculateMD5Hash(calculateMD5Hash(concatenatedString));
}
public static String calculateMD5Hash(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] hashBytes = md.digest(input.getBytes());
StringBuilder hexString = new StringBuilder();
for (byte b : hashBytes) {
hexString.append(String.format("%02x", b));
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
} |
| --- |
Example (C#):
| static string GenerateToken(Dictionary data, string appsecurity)
{
var strtomd5 = data.OrderBy(kvp => kvp.Key)
.Select(kvp => $"{kvp.Key}={kvp.Value}")
.ToArray();
string concatenatedString = string.Join("&", strtomd5) + appsecurity;
return CalculateMD5Hash(CalculateMD5Hash(concatenatedString));
}
static string CalculateMD5Hash(string input)
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = MD5.HashData(inputBytes);
return BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
} |
| --- |
Query by Flight Number + Date:
Request URL:
| https://open-al.variflight.com/api/happiness?appid=${appid}&date=2024-12-19&fnum=CA1852&token=${token} |
| --- |
The parameter part in the URL is:
| appid=${appid}&date=2024-12-19&fnum=CA1852&token=${token} |
| --- |
Generating the encrypted string:
Step1. Sort the parameter names alphabetically and concatenate them into a string, replacing 'appid=${appid}&date=2024-12-19&fnum=CA1852&token=${token}' with the actual value. Let's call this string $str.
Step2. The registration code is '${appsecurity}'. Assign this value to the variable $appsecurity.
Step3. Calculate the MD5 hash of the concatenation of $str and $appsecurity (using a dot '.' as the concatenation operator in PHP).
Step4. Calculate the MD5 hash of the result from Step 3. This final result is the token.
Note: $appsecurity=Registration code
API Endpoints
The request URL:
| https://open-al.variflight.com/api/happiness? |
| --- |
The way to request: GET
The format of return: json
Request parameter Details
Flight Happiness Index employs an authorized authentication interface. At the beginning of the cooperation, VariFlight will apply on behalf of the third party to allocate user identification codes and registration codes (i.e., appid and appsecurity).
1 出参1
Inquiry Method: 1: Query by Flight Number + Date
| Request parameter | Description | Example | Required or Optional | Parameter
Type | Rules |
| --- | --- | --- | --- | --- | --- |
| appid | App ID | | Yes | string | |
| fnum | Flight Number | CA1852 | Yes | string | |
| date | Date | 2024-12-19 | Yes | string | |
| token | Token | | Yes | string | |
| lang | Language | | No | string | |
| cabin | Cabin Class | Y | No | string | |
Inquiry Method: 2: Query by Route + Cabin Class
| Request parameter | Description | Example | Required or Optional | Parameter
Type | Rules |
| --- | --- | --- | --- | --- | --- |
| dep | Departure Airport IATA Code | PEK | Yes | string | |
| arr | Arrival Airport IATA Code | CAN | Yes | string | |
| date | Departure Date | 2024-12-19 | Yes | string | |
| cabin | Cabin Class | Y | No | string | |
| appid | App ID | | Yes | string | |
| token | Token | | Yes | string | |
| lang | Language | | No | string | |
Return Parameter Details
| Request parameter | Description | Example | Parameter
Type | Rules |
| --- | --- | --- | --- | --- |
| FlightYear | Historical Average Aircraft Age | 19.3 | string | |
| AircraftNumber | Aircraft Number | B5190 | string | |
| Generic | Aircraft Type | 73M | string | |
| FlightNo | Flight Number | CZ3724 | string | |
| FlightDate | Flight Date | 2026-07-07 | string | |
| FlightDepcode | Departure Airport IATA Code | XMN | string | |
| FlightArrcode | Arrival Airport IATA Code | CAN | string | |
| DepAvgDelaytime | Average Departure Delay Time Over The Past 180 Days | 47 | string | |
| ArrAvgDelaytime | Average Arrival Delay Time Over The Past 180 Days | 28 | string | |
| PlanAvgFlytime | Average Scheduled Flight Time Over The Past 180 Days | 100 | string | |
| CancelProb | Flight Cancellation Rate For The Past 180 Days | 23% | string | |
| FoodCode | Meal Availability On The Flight | R | string | |
| Food | Meal Availability On The Flight | 无餐食 | string | |
| DepBridge | Departure Boarding Bridge Rate | 73.33% | string | |
| ArrBridge | Arrival Boarding Bridge Rate | 96.67% | string | |
| AirService | Airline Service Level Of FHI | 三星 | string | |
| ArrService | Arrival Airport Service Level Of FHI | 三星 | string | |
| DepService | Departure Airport Service Level Of FHI | 三星 | string | |
| OntimeRate | Historical Departure Punctuality Rate Over The Past 180 Days | 87% | string | |
| ArrOntimeRate | Historical Arrival Punctuality Rate Over The Past 180 Days | 97% | string | |
| GenericNew | Aircraft Type New Field | 737 | string | |
| FtypeDetail | Aircraft Model | B737-800 | string | |
| Anti-epidemic | Anti-Epidemic Policy | 在登机前,地面服务部门严把关口,杜绝患病及疑似旅客乘机。 在运行中,南航结合民航局要求,对机上餐食供应相关标准做出调整,毛毯、耳机不得重复使用,毛巾调整为湿巾,餐单、酒水单停止配备,尽量减少乘务员与旅客的接触。 | string | |
| Insurance-epidemic | Airline Epidemic Insurance | | string | |
| FlightTopic | Theme Of The Flight | | object | |
| pic | Side View Of The Airplane | https://file.variflight.com/buckets/happiness_theme_pic_750x282/keys/79750e417c7a4e5658b4a27e724b7ee7.png | string | |
| minPic | Thumbnail Image | https://file.variflight.com/buckets/happiness_theme_pic/keys/7352f7bd4b3bdfa1bfe43b1aabc7f7dd_120_45.png | string | |
| HistoryGeneric | Historical Aircraft Type Distribution | #320\|15.00%\|14.2#7M8\|75.00%\|2.3#32Q\|5.00%\|1.3#321\|5.00%\|11.8 | string | |
| distance | Flight Distance | 567 | string | |
| aircraftDescribe | Description Of The Operating Aircraft Model | 波音737-800型客机是波音737改进机型中的一款,是波音737-700的机身延长型型号,直接取代了波音737-400。机身长度为39.5米,高12.5米,最大速度达到每小时885千米,可以载客162-189名。 | string | |
| IsInt | Domestic/International Flag | 0 | string | |
| FlightPics | Onboard Photos | | array | |
| CabinPic | Seat Map Pictures | https://file.variflight.com/buckets/comfort_flayout/keys/8eddbc76dfb33c631476850cb3bdbaa8.png | string | |
| Luggage | The Allowance For Free Luggage | | object | |
| 手提 | Carry-On | | array | |
| 托运 | Checked Baggage | | array | |
| Carbon | Total Carbon Emission | 3310 | string | |
| PerCapitaCarbon | Per Capita Carbon Emission | 414 | string | |
| PerCapitaTree | Per Capita Trees Consumed | 17 | string | |
| Seatlayout | Seat Layout | 2-2 | string | |
| Comfort | Comfort Total Score | 7.5 | string | |
| Cabin | Booking Code / Cabin Class Code | J | string | |
| FoodArray | Airline Meal Group | | array | |
| SeatSpace | Seat Pitch | 55 | string | |
| SeatWidth | Seat Width | 17 | string | |
| SeatTilt | Maximum Seat Tilt | 100 | string | |
| Media | Onboard Entertainment Facilities | 天花板式电视 | string | |
| Socket | Onboard Power | 无 | string | |
| WiFi | Onboard WiFi | 无 | string | |
| SubCabin | Marketing Sub-Cabin Data Group | | array | |
| SeatSpace | Aircraft Seat Pitch | 55 | string | |
| SeatWidth | Aircraft Seat Width | 21 | string | |
| SeatTilt | Aircraft Seat Tilt | 120 | string | |
| Media | Entertainment Equipment | 天花板式电视 | string | |
| Socket | Power Socket | 无 | string | |
| WiFi | WiFi | 无 | string | |
| FoodCode | Meal Code | R | string | |
| Food | Meal Availability | 无餐食 | string | |
| Luggage | Baggage Allowance | | string | |
| Cabin | Cabin Class Code | I | string | |
| shareFlightNo | Codeshare Flight Number | | array | |
| desc | Description Of The Themed Livery | | string | |
| 1 | 11 | 1 | 1111111 | 11111 | 1111111 |
| --- | --- | --- | --- | --- | --- |
Return Parameter Examples
Example 1: Failed return
| {
"error_code": 3,
"error": "缺少参数或参数验证失败"
} |
| --- |
Example 2: Successful return
| [ {
"AircraftNumber" : "B5190",
"FlightNo" : "CZ3724",
"FlightDate" : "2026-07-07",
"FlightDepcode" : "XMN",
"FlightArrcode" : "CAN",
"DepAvgDelaytime" : "47",
"ArrAvgDelaytime" : "28",
"CancelProb" : "23%",
"DepBridge" : "73.33%",
"ArrBridge" : "96.67%",
"AirService" : "三星",
"ArrService" : "三星",
"DepService" : "三星",
"ArrOntimeRate" : "97%",
"Anti-epidemic" : "在登机前,地面服务部门严把关口,杜绝患病及疑似旅客乘机。 在运行中,南航结合民航局要求,对机上餐食供应相关标准做出调整,毛毯、耳机不得重复使用,毛巾调整为湿巾,餐单、酒水单停止配备,尽量减少乘务员与旅客的接触。",
"FlightTopic" : {
"desc" : "0",
"pic" : "https://file.variflight.com/buckets/happiness_theme_pic_750x282/keys/79750e417c7a4e5658b4a27e724b7ee7.png"
},
"distance" : "567",
"aircraftDescribe" : "波音737-800型客机是波音737改进机型中的一款,是波音737-700的机身延长型型号,直接取代了波音737-400。机身长度为39.5米,高12.5米,最大速度达到每小时885千米,可以载客162-189名。",
"FlightPics" : [ "https://file.variflight.com/buckets/comfort_ftype_image/keys/1fdfd02b267c61c4be781f36f24735be.jpg" ],
"CabinPic" : "https://file.variflight.com/buckets/comfort_flayout/keys/8eddbc76dfb33c631476850cb3bdbaa8.png",
"Carbon" : "3310",
"Comfort" : "7.5",
"Cabin" : "J",
"FlightYear" : "19.3",
"Generic" : "73M",
"PlanAvgFlytime" : "100",
"FoodCode" : "R",
"Food" : "无餐食",
"OntimeRate" : "87%",
"GenericNew" : "737",
"FtypeDetail" : "B737-800",
"Insurance-epidemic" : "0",
"minPic" : "https://file.variflight.com/buckets/happiness_theme_pic/keys/7352f7bd4b3bdfa1bfe43b1aabc7f7dd_120_45.png",
"HistoryGeneric" : "#320\|15.00%\|14.2#7M8\|75.00%\|2.3#32Q\|5.00%\|1.3#321\|5.00%\|11.8",
"IsInt" : "0",
"Luggage" : {
"手提" : [ "ALL:1件 ,5KG/件;三边限制:A+B+C≤115CM" ],
"托运" : [ "国际航线:2件 ,32KG/件;三边限制:A+B+C≤158cm;涉及日本、美洲、澳新、俄罗斯、迪拜的航程;新加坡始发与中国大陆间的航程;及内罗毕的航程;" ]
},
"PerCapitaCarbon" : "414",
"PerCapitaTree" : "17",
"Seatlayout" : "2-2",
"FoodArray" : [ "0" ],
"SeatSpace" : "55",
"SeatWidth" : "17",
"SeatTilt" : "100",
"Media" : "天花板式电视",
"Socket" : "无",
"WiFi" : "无",
"SubCabin" : [ {
"Cabin" : "I",
"SeatSpace" : "55",
"SeatWidth" : "21",
"SeatTilt" : "120",
"Media" : "天花板式电视",
"Socket" : "无",
"WiFi" : "无",
"FoodCode" : "R",
"Food" : "无餐食",
"Luggage" : "0"
} ],
"shareFlightNo" : [ "MF1405" ]
} ] |
| --- |
| Return parameter | Description |
| --- | --- |
| 0 | No data permissions |
| 3 | This request method has no permission temporarily |
| 3 | Lack of parameters or parameter identification failed |
| 3 | wrong flight number format |
| 3 | wrong departure airport format |
| 3 | wrong arrival airport format |
| 3 | No data permissions |
| 3 | do not support to inquire historical flight |
| 3 | wrong departure city format |
| 3 | wrong arrival city format |
| 5 | No data |
| 4 | The current interface is expired |
| 4 | The current interface is closed |
| 4 | No data permissions |
Error Responses
2 出参2
Inquiry Method: 1: Query by Departure & Arrival City + Cabin Class
| Request parameter | Description | Example | Required or Optional | Parameter
Type | Rules |
| --- | --- | --- | --- | --- | --- |
| date | Departure Date | 2024-12-19 | Yes | string | |
| token | Token | | Yes | string | |
| appid | App ID | | Yes | string | |
| depCity | Departure City | | Yes | string | |
| arrCity | Arrival City | | Yes | string | |
| cabin | Cabin Class Code | | No | string | |
| lang | Language Type | | No | string | |
| page | Page Number | 3 | No | string | |
Return Parameter Details
| Request parameter | Description | Example | Parameter
Type | Rules |
| --- | --- | --- | --- | --- |
| page | Page Number | 1 | string | |
| totalPage | Total Page Number | 6 | string | |
| data | Returned Data | | array | |
| FlightYear | Historical Average Aircraft Age | 0.5 | string | |
| AircraftNumber | Aircraft Number | B32LX | string | |
| Generic | Aircraft Type | 327 | string | |
| FlightNo | Flight Number | MU5151 | string | |
| FlightDate | Flight Date | 2025-08-07 | string | |
| FlightDepcode | Departure Airport IATA Code | PVG | string | |
| FlightArrcode | Arrival Airport IATA Code | PEK | string | |
| DepAvgDelaytime | Average Departure Delay Time Over The Past 180 Days | 25 | string | |
| ArrAvgDelaytime | Average Arrival Delay Time Over The Past 180 Days | -8 | string | |
| PlanAvgFlytime | Average Scheduled Flight Time Over The Past 180 Days | 145 | string | |
| CancelProb | Flight Cancellation Rate For The Past 180 Days | 3% | string | |
| FoodCode | Meal Availability On The Flight | | string | |
| Food | Meal Availability On The Flight | 无餐食 | string | |
| DepBridge | Departure Boarding Bridge Rate | 73.33% | string | |
| ArrBridge | Arrival Boarding Bridge Rate | 96.67% | string | |
| AirService | Airline Service Level Of FHI | 三星 | string | |
| ArrService | Arrival Airport Service Level Of FHI | 三星 | string | |
| DepService | Departure Airport Service Level Of FHI | 三星 | string | |
| OntimeRate | Historical Departure Punctuality Rate Over The Past 180 Days | 87% | string | |
| ArrOntimeRate | Historical Arrival Punctuality Rate Over The Past 180 Days | 97% | string | |
| GenericNew | Aircraft Type New Field | 327 | string | |
| FtypeDetail | Aircraft Model | A321NX(C) | string | |
| Anti-epidemic | Anti-Epidemic Policy | 该字段暂不更新 | string | |
| Insurance-epidemic | Airline Epidemic Insurance | | string | |
| FlightTopic | Theme Of The Flight | | object | |
| pic | Side View Of The Airplane | https://file.variflight.com/buckets | string | |
| minPic | Thumbnail Image | https://file.variflight.com | string | |
| HistoryGeneric | Historical Aircraft Type Distribution | #320\|7.41%\|14.9 | string | |
| distance | Flight Distance | 1178 | string | |
| aircraftDescribe | Description Of The Operating Aircraft Model | 空中客车A320系列飞机是欧洲空中客车工业公司研制生产的单通道双发中短程150座级客机。是第一款使用数字电传操纵飞行控制系统的商用飞机,也是第一款放宽静稳定度设计的民航客机。 | string | |
| IsInt | Domestic/International Flag | 0 | string | |
| FlightPics | Onboard Photos | | array | |
| CabinPic | Seat Map Pictures | | string | |
| Luggage | The Allowance For Free Luggage | | object | |
| 手提 | Carry-On | | array | |
| 托运 | Checked Baggage | | array | |
| Carbon | Total Carbon Emission | | string | |
| PerCapitaCarbon | Per Capita Carbon Emission | | string | |
| PerCapitaTree | Per Capita Trees Consumed | | string | |
| Seatlayout | Seat Layout | | string | |
| Comfort | Comfort Total Score | 6.4 | string | |
| Cabin | Booking Code / Cabin Class Code | Y | string | |
| FoodArray | Airline Meal Group | | array | |
| SeatSpace | Seat Pitch | 30 | string | |
| SeatWidth | Seat Width | 17 | string | |
| SeatTilt | Maximum Seat Tilt | 110 | string | |
| Media | Onboard Entertainment Facilities | 无 | string | |
| Socket | Onboard Power | 无 | string | |
| WiFi | Onboard WiFi | 无 | string | |
| SubCabin | Marketing Sub-Cabin Data Group | | array | |
| SeatSpace | Aircraft Seat Pitch | 30 | string | |
| SeatWidth | Aircraft Seat Width | 17 | string | |
| SeatTilt | Aircraft Seat Tilt | 110 | string | |
| Media | Entertainment Equipment | 无 | string | |
| Socket | Power Socket | 无 | string | |
| WiFi | WiFi | 无 | string | |
| FoodCode | Meal Code | | string | |
| Food | Meal Availability | 无餐食 | string | |
| Luggage | Baggage Allowance | | string | |
| Cabin | Cabin Class Code | P | string | |
| shareFlightNo | Codeshare Flight Number | | array | |
| desc | Description Of The Themed Livery | 春秋航空 -波司登 | string | |
| 1 | 11 | 1 | 1111111 | 11111 | 1111111 |
| --- | --- | --- | --- | --- | --- |
Return Parameter Examples
Example 1: Failed return
| {
"error_code": 3,
"error": "缺少参数或参数验证失败"
} |
| --- |
Example 2: Successful return
| {
"page" : "1",
"totalPage" : "6",
"data" : [ {
"FlightYear" : "0.5",
"AircraftNumber" : "B32LX",
"Generic" : "327",
"FlightNo" : "MU5151",
"FlightDate" : "2025-08-07",
"FlightDepcode" : "PVG",
"FlightArrcode" : "PEK",
"DepAvgDelaytime" : "25",
"ArrAvgDelaytime" : "-8",
"PlanAvgFlytime" : "145",
"CancelProb" : "3%",
"FoodCode" : "0",
"Food" : "无餐食",
"DepBridge" : "73.33%",
"ArrBridge" : "96.67%",
"AirService" : "三星",
"ArrService" : "三星",
"DepService" : "三星",
"OntimeRate" : "87%",
"ArrOntimeRate" : "97%",
"GenericNew" : "327",
"FtypeDetail" : "A321NX(C)",
"Anti-epidemic" : "该字段暂不更新",
"Insurance-epidemic" : "0",
"FlightTopic" : {
"pic" : "https://file.variflight.com/buckets",
"desc" : "春秋航空 -波司登"
},
"minPic" : "https://file.variflight.com",
"HistoryGeneric" : "#320\|7.41%\|14.9",
"distance" : "1178",
"aircraftDescribe" : "空中客车A320系列飞机是欧洲空中客车工业公司研制生产的单通道双发中短程150座级客机。是第一款使用数字电传操纵飞行控制系统的商用飞机,也是第一款放宽静稳定度设计的民航客机。",
"IsInt" : "0",
"FlightPics" : [ "https://file.variflight.com/buckets/comfort_ftype_image/keys/d343b7d02782cb479c09aa0c714183f7.jpeg" ],
"CabinPic" : "0",
"Luggage" : {
"手提" : [ "手提\": [ \"国内航线:1件 ,10KG/件;三边限制:20,40,55\", \"国际航线:1件 ,10KG/件;三边限制:25,45,56&A+B+C≤115CM" ],
"托运" : [ "国内航线:20KG\", \"国际航线:2件 ,23KG/件;三边限制:A+B+C≤158cm;欧洲、澳洲、日本、韩国、新加坡、泰国(仅曼谷航线)、迪拜航程;\", \"国际航线:2件 ,23KG/件;三边限制:A+B+C≤158cm;北美航程;" ]
},
"Carbon" : "0",
"PerCapitaCarbon" : "0",
"PerCapitaTree" : "0",
"Seatlayout" : "0",
"Comfort" : "6.4",
"Cabin" : "Y",
"FoodArray" : [ "0" ],
"SeatSpace" : "30",
"SeatWidth" : "17",
"SeatTilt" : "110",
"Media" : "无",
"Socket" : "无",
"WiFi" : "无",
"SubCabin" : [ {
"SeatSpace" : "30",
"SeatWidth" : "17",
"SeatTilt" : "110",
"Media" : "无",
"Socket" : "无",
"WiFi" : "无",
"FoodCode" : "0",
"Food" : "无餐食",
"Luggage" : "0",
"Cabin" : "P"
} ],
"shareFlightNo" : [ "\"KY9559\", \"HO5266\", \"TV6745\", \"SC9589\", \"CA3429\"" ]
} ]
} |
| --- |
| Return parameter | Description |
| --- | --- |
| 0 | No data permissions |
| 3 | This request method has no permission temporarily |
| 3 | Lack of parameters or parameter identification failed |
| 3 | wrong flight number format |
| 3 | wrong departure airport format |
| 3 | wrong arrival airport format |
| 3 | No data permissions |
| 3 | do not support to inquire historical flight |
| 3 | wrong departure city format |
| 3 | wrong arrival city format |
| 5 | No data |
| 4 | The current interface is expired |
| 4 | The current interface is closed |
| 4 | No data permissions |
Error Responses
## Parameters’ Return Description
### Seat Width – Return Description
| Value | Comfortable | Standard | Narrow |
| --- | --- | --- | --- |
### Seat Pitch (Legroom) – Return Description
| Value | Comfortable | Standard | Narrow |
| --- | --- | --- | --- |
### Seat Recline – Return Description
| Value | Comfortable | Standard | Narrow |
| --- | --- | --- | --- |
### Power Supply – Return Description
| Value | Comfortable | Standard | Narrow |
| --- | --- | --- | --- |
- WIFI – Return Description
| Value | Comfortable | Standard | Narrow |
| --- | --- | --- | --- |
### Airline Service Rating – Return Description
| Value | One star | Two stars | Three Stars | Four Stars | Five Stars |
| --- | --- | --- | --- | --- | --- |