Flight Happiness Index

Appsecurity: ${appsecurity}

With a vision of "living on time" , a global leading aviation data intelligence company

The VariFlight DataWorks Flight Happiness Index API provides cabin and service information, including seat dimensions, onboard amenities, baggage allowances, service ratings and historical on-time performance. This documentation explains flight-number, airport-route and city-pair queries with date and cabin-class parameters.

Appid: ${appid}

Create time: 2026-10-22

https://dataworks.variflight.com Email: dataworks@variflight.com

Introduction

This document describes the VariFlight Flight Happiness Index API, including authentication, request parameters, response fields, JSON examples and error responses. The interface uses UTF-8 encoding.

Authentication

The interface uses both token and IP for concurrent verification.

Token generation algorithm (MD5)

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):

<?php
function generateToken(array $data, string $appsecurity): string {
    unset($data['token']);
    ksort($data, SORT_STRING);
    $pairs = [];
    foreach ($data as $key => $value) {
        $pairs[] = $key . '=' . $value;
    }
    $str = implode('&', $pairs);
    return hash('md5', hash('md5', $str . $appsecurity));
}
// 参数值使用 UTF-8 原文;通过 token 参数传入结果,构建 URL 时再编码。
// $data['token'] = generateToken($data, $appsecurity);
// $query = http_build_query($data, '', '&', PHP_QUERY_RFC3986);

Example (Java):

import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.stream.Collectors;
import java.security.MessageDigest;
import java.util.HexFormat;

public class TokenExample {
    public static String generateToken(
            Map<String, String> data, String appsecurity) throws Exception {
        String str = data.entrySet().stream()
            .filter(entry -> !"token".equals(entry.getKey()))
            .sorted(Map.Entry.comparingByKey())
            .map(entry -> entry.getKey() + "=" + entry.getValue())
            .collect(Collectors.joining("&"));
        return digestHex(digestHex(str + appsecurity));
    }

    private static String digestHex(String value) throws Exception {
        byte[] bytes = MessageDigest.getInstance("MD5")
            .digest(value.getBytes(StandardCharsets.UTF_8));
        return HexFormat.of().formatHex(bytes);
    }
}
// 请求 URL 追加 "&token=" + URLEncoder.encode(token, StandardCharsets.UTF_8)。

Example (C#):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

public static class TokenExample {
    public static string GenerateToken(
            Dictionary<string, string> data, string appsecurity) {
        string str = string.Join("&", data
            .Where(entry => entry.Key != "token")
            .OrderBy(entry => entry.Key, StringComparer.Ordinal)
            .Select(entry => entry.Key + "=" + entry.Value));
        return DigestHex(DigestHex(str + appsecurity));
    }

    private static string DigestHex(string value) {
        using (var digest = MD5.Create()) {
            byte[] result = digest.ComputeHash(Encoding.UTF8.GetBytes(value));
            return BitConverter.ToString(result).Replace("-", "").ToLowerInvariant();
        }
    }
}
// 请求 URL 追加 "&token=" + Uri.EscapeDataString(token)。

Query by Flight Number + Date:

Request URL:

https://open-al.variflight.com/api/happiness?appid=${appid}&cabin=Y&date=2024-12-19&fnum=CA1852&lang=&token=${token}

The parameter part in the URL is:

appid=${appid}&cabin=Y&date=2024-12-19&fnum=CA1852&lang=&token=${token}

Generating the encrypted string:

str = appid=${appid}&cabin=Y&date=2024-12-19&fnum=CA1852&lang=

Step2. The registration code is '${appsecurity}'. Assign this value to the variable $appsecurity.

Append appsecurity (the registration code) directly to str, with no extra separator.
Apply MD5 twice. Each result is a 32-character lowercase hexadecimal string. The second digest takes the UTF-8 bytes of the first Hex string, not its raw digest bytes.

token = md5Hex(md5Hex(str + appsecurity))

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 Response 1

Inquiry Method: 1: Query by Flight Number + Date

Request parameter Description Example Required or Optional Parameter
Type
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
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
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 No string
DepBridge Departure Boarding Bridge Rate 73.33% string
ArrBridge Arrival Boarding Bridge Rate 96.67% string
AirService Airline Service Level Of FHI Three-star string
ArrService Arrival Airport Service Level Of FHI Three-star string
DepService Departure Airport Service Level Of FHI Three-star 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 The Boeing 737-800 is an expanded version of the 737-700, and substitutes the 737-400. With a length of 129 ft 6 in and a height of 41 ft 2 in, the maximum speed is 885 km/h. The 737-800 seats 162 passengers in a two-class layout or 189 passengers in a one-class layout.The cruising distance is 5,665 kilometers (3,060 miles). Development began on September 5, 1994. Its maiden flight was on July 31 1997 and its first delivery was in April 1998. 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 Overhead string
Socket Onboard Power No string
WiFi Onboard WiFi No 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 Overhead string
Socket Power Socket No string
WiFi WiFi No string
FoodCode Meal Code R string
Food Meal Availability No string
Luggage Baggage Allowance string
Cabin Cabin Class Code I string
shareFlightNo Codeshare Flight Number array
desc Description Of The Themed Livery string
SeatNumCabinStr SeatNumCabinStr 8 string
SeatNumFlightStr AircraftSeatCountStr 158 string
StarlinkWifiInstalled StarlinkWifiInstalled 是 string
CabinConfig CabinConfig C16Y150 string

Return Parameter Examples

Example 1: Failed return

{
  "error_code": 3,
  "error": "Lack of parameters or parameter identification failed"
}

Example 2: Successful return

[ {
  "aircraftDescribe" : "The Boeing 737-800 is an expanded version of the 737-700, and substitutes the 737-400. With a length of 129 ft 6 in and a height of 41 ft 2 in, the maximum speed is 885 km/h.  The 737-800 seats 162 passengers in a two-class layout or 189 passengers in a one-class layout.The cruising distance is 5,665 kilometers (3,060 miles). Development began on September 5, 1994. Its maiden flight was on July 31 1997 and its first delivery was in April 1998.",
  "FlightYear" : "19.3",
  "AircraftNumber" : "B5190",
  "Generic" : "73M",
  "FlightNo" : "CZ3724",
  "FlightDate" : "2026-07-07",
  "FlightDepcode" : "XMN",
  "FlightArrcode" : "CAN",
  "DepAvgDelaytime" : "47",
  "ArrAvgDelaytime" : "28",
  "PlanAvgFlytime" : "100",
  "CancelProb" : "23%",
  "FoodCode" : "R",
  "Food" : "No",
  "DepBridge" : "73.33%",
  "ArrBridge" : "96.67%",
  "AirService" : "Three-star",
  "ArrService" : "Three-star",
  "DepService" : "Three-star",
  "OntimeRate" : "87%",
  "ArrOntimeRate" : "97%",
  "GenericNew" : "737",
  "FtypeDetail" : "B737-800",
  "Anti-epidemic" : "在登机前,地面服务部门严把关口,杜绝患病及疑似旅客乘机。 在运行中,南航结合民航局要求,对机上餐食供应相关标准做出调整,毛毯、耳机不得重复使用,毛巾调整为湿巾,餐单、酒水单停止配备,尽量减少乘务员与旅客的接触。",
  "Insurance-epidemic" : "",
  "FlightTopic" : {
    "pic" : "https://file.variflight.com/buckets/happiness_theme_pic_750x282/keys/79750e417c7a4e5658b4a27e724b7ee7.png",
    "desc" : ""
  },
  "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",
  "distance" : "567",
  "IsInt" : "0",
  "FlightPics" : [ "https://file.variflight.com/buckets/comfort_ftype_image/keys/1fdfd02b267c61c4be781f36f24735be.jpg" ],
  "CabinPic" : "https://file.variflight.com/buckets/comfort_flayout/keys/8eddbc76dfb33c631476850cb3bdbaa8.png",
  "Luggage" : {
    "手提" : [ "ALL:1件 ,5KG/件;三边限制:A+B+C≤115CM" ],
    "托运" : [ "国际航线:2件 ,32KG/件;三边限制:A+B+C≤158cm;涉及日本、美洲、澳新、俄罗斯、迪拜的航程;新加坡始发与中国大陆间的航程;及内罗毕的航程;" ]
  },
  "Carbon" : "3310",
  "PerCapitaCarbon" : "414",
  "PerCapitaTree" : "17",
  "Seatlayout" : "2-2",
  "Comfort" : "7.5",
  "Cabin" : "J",
  "FoodArray" : [ "" ],
  "SeatSpace" : "55",
  "SeatWidth" : "17",
  "SeatTilt" : "100",
  "Media" : "Overhead",
  "Socket" : "No",
  "WiFi" : "No",
  "SubCabin" : [ {
    "SeatSpace" : "55",
    "SeatWidth" : "21",
    "SeatTilt" : "120",
    "Media" : "Overhead",
    "Socket" : "No",
    "WiFi" : "No",
    "FoodCode" : "R",
    "Food" : "No",
    "Luggage" : "",
    "Cabin" : "I"
  } ],
  "shareFlightNo" : [ "MF1405" ],
  "SeatNumCabinStr" : "8",
  "SeatNumFlightStr" : "158",
  "CabinConfig" : "C16Y150",
  "StarlinkWifiInstalled" : "是"
} ]

Error Responses

Return parameter Description Trigger Scene Suggestions
0 No data permissions
2 The visiting ip have not been joined in white list
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
3 Not find the city
3 wrong cabin format
10 No data
5 No data
4 The current interface is expired
4 The current interface is closed
4 No data permissions
1 Pending review
11 Unknown error
0 Invalid user

2 Response 2

Inquiry Method: 1: Query by Departure & Arrival City + Cabin Class

Request parameter Description Example Required or Optional Parameter
Type
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 lang=en for English; Chinese by default when omitted or lang=zh No string
page Used for pagination 3 No string

Return Parameter Details

Request parameter Description Example Parameter
Type
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 No string
DepBridge Departure Boarding Bridge Rate 73.33% string
ArrBridge Arrival Boarding Bridge Rate 96.67% string
AirService Airline Service Level Of FHI Three-star string
ArrService Arrival Airport Service Level Of FHI Three-star string
DepService Departure Airport Service Level Of FHI Three-star 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 The Boeing 737-800 is an expanded version of the 737-700, and substitutes the 737-400. With a length of 129 ft 6 in and a height of 41 ft 2 in, the maximum speed is 885 km/h. The 737-800 seats 162 passengers in a two-class layout or 189 passengers in a one-class layout.The cruising distance is 5,665 kilometers (3,060 miles). Development began on September 5, 1994. Its maiden flight was on July 31 1997 and its first delivery was in April 1998. 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 No string
Socket Onboard Power No string
WiFi Onboard WiFi No 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 No string
Socket Power Socket No string
WiFi WiFi No string
FoodCode Meal Code string
Food Meal Availability No string
Luggage Baggage Allowance string
Cabin Cabin Class Code P string
shareFlightNo Codeshare Flight Number array
desc Description Of The Themed Livery 春秋航空 -波司登 string
SeatNumCabinStr SeatNumCabinStr 8 string
SeatNumFlightStr AircraftSeatCountStr 158 string
CabinConfig CabinConfig C16Y150 string
StarlinkWifiInstalled StarlinkWifiInstalled 是 string

Return Parameter Examples

Example 1: Failed return

{
  "error_code": 3,
  "error": "Lack of parameters or parameter identification failed"
}

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" : "",
    "Food" : "No",
    "DepBridge" : "73.33%",
    "ArrBridge" : "96.67%",
    "AirService" : "Three-star",
    "ArrService" : "Three-star",
    "DepService" : "Three-star",
    "OntimeRate" : "87%",
    "ArrOntimeRate" : "97%",
    "GenericNew" : "327",
    "FtypeDetail" : "A321NX(C)",
    "Anti-epidemic" : "该字段暂不更新",
    "Insurance-epidemic" : "",
    "FlightTopic" : {
      "pic" : "https://file.variflight.com/buckets",
      "desc" : "春秋航空 -波司登"
    },
    "minPic" : "https://file.variflight.com",
    "HistoryGeneric" : "#320|7.41%|14.9",
    "distance" : "1178",
    "aircraftDescribe" : "The Boeing 737-800 is an expanded version of the 737-700, and substitutes the 737-400. With a length of 129 ft 6 in and a height of 41 ft 2 in, the maximum speed is 885 km/h.  The 737-800 seats 162 passengers in a two-class layout or 189 passengers in a one-class layout.The cruising distance is 5,665 kilometers (3,060 miles). Development began on September 5, 1994. Its maiden flight was on July 31 1997 and its first delivery was in April 1998.",
    "IsInt" : "0",
    "FlightPics" : [ "https://file.variflight.com/buckets/comfort_ftype_image/keys/d343b7d02782cb479c09aa0c714183f7.jpeg" ],
    "CabinPic" : "",
    "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" : "",
    "PerCapitaCarbon" : "",
    "PerCapitaTree" : "",
    "Seatlayout" : "",
    "Comfort" : "6.4",
    "Cabin" : "Y",
    "FoodArray" : [ "" ],
    "SeatSpace" : "30",
    "SeatWidth" : "17",
    "SeatTilt" : "110",
    "Media" : "No",
    "Socket" : "No",
    "WiFi" : "No",
    "SubCabin" : [ {
      "SeatSpace" : "30",
      "SeatWidth" : "17",
      "SeatTilt" : "110",
      "Media" : "No",
      "Socket" : "No",
      "WiFi" : "No",
      "FoodCode" : "",
      "Food" : "No",
      "Luggage" : "",
      "Cabin" : "P"
    } ],
    "shareFlightNo" : [ "\"KY9559\",             \"HO5266\",             \"TV6745\",             \"SC9589\",             \"CA3429\"" ],
    "CabinConfig" : "C16Y150",
    "StarlinkWifiInstalled" : "是"
  } ],
  "SeatNumCabinStr" : "8",
  "SeatNumFlightStr" : "158"
}

Error Responses

Return parameter Description Trigger Scene Suggestions
0 No data permissions
2 The visiting ip have not been joined in white list
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
3 Not find the city
3 wrong cabin format
10 No data
5 No data
4 The current interface is expired
4 The current interface is closed
4 No data permissions
1 Pending review
11 Unknown error
0 Invalid user

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