Flight Connection V1.0

Appsecurity: ${appsecurity}

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

The VariFlight DataWorks Flight Connection API documents queries by departure and arrival cities and travel dates. Response fields describe flight numbers, airport and terminal details, departure and arrival times, and average delay time.

Appid: ${appid}

Create time: 2026-10-22

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

Introduction

This document describes the VariFlight Flight Connection V1.0 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 Route + Departure Date:

Request URL:

https://open-al.variflight.com/api/transfer?appid=${appid}&arrcity=SHA&arrdate=2024-10-21&depcity=BJS&depdate=2024-10-21&lang=en&token=${token}

The parameter part in the URL is:

appid=${appid}&arrcity=SHA&arrdate=2024-10-21&depcity=BJS&depdate=2024-10-21&lang=en&token=${token}

Generating the encrypted string:

str = appid=${appid}&arrcity=SHA&arrdate=2024-10-21&depcity=BJS&depdate=2024-10-21&lang=en

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/transfer?

The way to request: GET

The format of return: json

Request parameter Details

Flight Connection V1.0 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 Route + Departure Date

Request parameter Description Example Required or Optional Parameter
Type
depcity Departure City BJS Yes string
lang Sets the language of the response text en No string
arrcity Destination City SHA Yes string
depdate yyyy-mm-dd format, must not be earlier than the current time at the origin (i.e. only future times can be queried) 2024-10-21 Yes string
arrdate yyyy-mm-dd format. Provides direct and transfer options up to departure date +3 days. Optional; defaults to departure date +3 days. 2024-10-21 No string
appid App ID Yes string
token App ID Yes string

Return Parameter Details

Request parameter Description Example Parameter
Type
FlightNo Flight Number ZH9990 string
Service 1 = passenger flight; 2 = cargo flight 1 number
DepTime Scheduled departure time of the flight, format: yyyy-mm-dd hh:mm:ss 2024-10-21 21:30:00 string
DepTimeZone Time zone of the flight's departure location; e.g. 480 means 8 hours ahead of UTC, i.e. UTC+8 480 number
ArrTime Scheduled arrival time of the flight, format: yyyy-mm-dd hh:mm:ss 2024-10-21 23:25:00 string
ArrTimeZone Time zone of the flight's departure location; e.g. 480 means 8 hours ahead of UTC, i.e. UTC+8 480 number
AverageDelayTime Average delay over the flight's last 7 operations (unit: seconds; positive = delayed, negative = early arrival) -113 number
DepCity Departure City Name (English) Beijing string
DepCityZh Departure City Name (Chinese) Beijing string
DepCityCode Departure City IATA Code (IATA Code) BJS string
DepAirport Departure Airport Name (English) Beijing Capital string
DepAirportZh Departure Airport Name (Chinese) Beijing Capital string
DepAirportCode Departure Airport IATA Code (IATA Code) PEK string
DepTerminal Departure Airport Terminal T2 string
ArrCityZh Arrival City Name (Chinese) Shanghai string
ArrCity Arrival City Name (English) Shanghai string
ArrAirportCode Arrival Airport IATA Code (IATA Code) SHA string
ArrCityCode Arrival City IATA Code (IATA Code) SHA string
ArrAirport Arrival Airport Name (English) Shanghai Hongqiao string
ArrAirportZh Arrival Airport Name (Chinese) Shanghai Hongqiao string
ArrTerminal Arrival Airport Terminal T2 string

Return Parameter Examples

Example 1: Failed return

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

Example 2: Successful return

[ [ {
  "FlightNo" : "ZH9990",
  "Service" : 1,
  "DepTime" : "2024-10-21 21:30:00",
  "DepTimeZone" : 480,
  "ArrTime" : "2024-10-21 23:25:00",
  "ArrTimeZone" : 480,
  "AverageDelayTime" : -113,
  "DepCity" : "Beijing",
  "DepCityZh" : "Beijing",
  "DepCityCode" : "BJS",
  "DepAirport" : "Beijing Capital",
  "DepAirportZh" : "Beijing Capital",
  "DepAirportCode" : "PEK",
  "DepTerminal" : "T2",
  "ArrCityZh" : "Shanghai",
  "ArrCity" : "Shanghai",
  "ArrAirportCode" : "SHA",
  "ArrCityCode" : "SHA",
  "ArrAirport" : "Shanghai Hongqiao",
  "ArrAirportZh" : "Shanghai Hongqiao",
  "ArrTerminal" : "T2"
} ] ]

Error Responses

Return parameter Description Trigger Scene Suggestions
2 The visiting ip have not been joined in white list
3 Lack of parameters or parameter identification failed
3 wrong departure city format
3 wrong arrival city format
3 Incorrect date
10 No data
4 No data permissions
1 Pending review
11 Unknown error
0 Invalid user