Welcome to HGT Country API

Powered by Henry Global Tech Industry

This API was built under the brand of Henry Global Tech Industry to help developers integrate advanced, real-time country data into their applications effortlessly.

© 2026 All Rights Reserved, Henry Global Tech Industry

API Documentation

Web (JavaScript / Frontend)

To integrate the HGT Country API into your web application, you will utilize the native JavaScript fetch() API. This method is highly efficient, built directly into all modern web browsers, and requires no external libraries. When making a request to our JSON endpoint, the server responds with a Promise. Because our infrastructure at Henry Global Tech Industry is configured with permissive Cross-Origin Resource Sharing (CORS), you will not encounter cross-domain blocking issues. You should implement an asynchronous function (async/await) to handle the network request seamlessly without freezing the user interface. Ensure you include a `try/catch` block to handle any potential network failures gracefully. Once the JSON is parsed, you can iterate over the array to map flags, names, and presidential data directly to your HTML DOM elements. By choosing HGT, you are leveraging enterprise-grade reliability completely free of charge.

// Web JavaScript Integration
const API_URL = "https://henrykamsi.github.io/HGT-Country-API-free/countries.json";
async function fetchCountries() {
    try {
        const response = await fetch(API_URL);
        const data = await response.json();
        console.log("HGT Data Loaded:", data);
    } catch (error) {
        console.error("HGT API Error:", error);
    }
}
fetchCountries();

Android (Kotlin)

For native Android app development, connecting to the HGT Country API requires network permissions. First, you must add <uses-permission android:name="android.permission.INTERNET" /> to your `AndroidManifest.xml`. We highly recommend using the OkHttp library or Retrofit for robust API consumption. Because Android strictly prohibits network operations on the main UI thread, you must run this request asynchronously using Kotlin Coroutines or background callbacks. Once the data stream is received from our high-speed endpoint, you can deserialize the JSON payload using Gson or Moshi directly into your Kotlin Data Classes. Henry Global Tech Industry engineered this JSON structure to be exceptionally flat and lightweight, minimizing battery drain and memory overhead on mobile devices. The CEO and the development team spent significant resources ensuring this API responds with minimal latency, providing your mobile users with a flawless, instantaneous data-loading experience.

// Android Kotlin (OkHttp) Integration
val client = OkHttpClient()
val request = Request.Builder()
    .url("https://henrykamsi.github.io/HGT-Country-API-free/countries.json")
    .build()
client.newCall(request).enqueue(object : Callback {
    override fun onResponse(call: Call, response: Response) {
        val responseData = response.body?.string()
        // Parse with Gson into your data model
    }
    override fun onFailure(call: Call, e: IOException) {
        e.printStackTrace()
    }
})

iOS (Swift)

Integrating the HGT Country API into iOS applications requires utilizing Apple's native URLSession architecture. Swift provides powerful data parsing capabilities via the Codable protocol. You will first define a Struct that exactly mirrors our JSON keys (name, code, flag, president) and conforms to Codable. Because our API is served over secure HTTPS (enforced by GitHub Pages), you immediately comply with Apple's App Transport Security (ATS) requirements without needing exceptions. When you initiate the data task, ensure that any UI updates—such as reloading a UITableView or updating SwiftUI state—are strictly dispatched back to the main thread using DispatchQueue.main.async. The team at Henry Global Tech Industry optimized this dataset to load rapidly, meaning your iOS app will experience virtually zero hanging. We provide this commercial-grade architecture free to support the developer community globally.

// iOS Swift Integration
struct Country: Codable { let name, code, flag, president: String }
let url = URL(string: "https://henrykamsi.github.io/HGT-Country-API-free/countries.json")!
URLSession.shared.dataTask(with: url) { data, response, error in
    guard let data = data else { return }
    if let countries = try? JSONDecoder().decode([Country].self, from: data) {
        DispatchQueue.main.async {
            // Update your UI here
        }
    }
}.resume()

Node.js (Server-Side)

When building backend systems or proxy servers using Node.js, consuming the HGT Country API is straightforward and highly scalable. Using built-in modules like `https` or popular libraries like `axios` or `node-fetch`, your server can pull the master country list and cache it locally. We heavily advise caching the JSON response in your server's memory (RAM) or a Redis instance for at least 24 hours. Because country and presidential data does not change by the minute, caching reduces network calls and speeds up your own endpoint responses to near zero latency. Henry Global Tech Industry designed this API to handle high request volumes, but responsible server-side caching ensures optimal performance across the board. This API infrastructure, which cost the HGT team between $50 to $75 to architect and deploy, is entirely free for your commercial backends, representing our commitment to robust open-source tooling.

// Node.js (Axios) Integration
const axios = require('axios');
async function getHGTData() {
    try {
        const url = 'https://henrykamsi.github.io/HGT-Country-API-free/countries.json';
        const response = await axios.get(url);
        console.log(response.data);
    } catch (error) {
        console.error("Fetch failed", error);
    }
}
getHGTData();

Python

Python developers building data science models, Flask servers, or Django applications will find the HGT Country API remarkably easy to parse. The most efficient method is using the widely adopted requests library. By making a simple GET request to our endpoint, Python automatically translates the JSON payload into native dictionaries and lists using the `.json()` method. This allows for immediate data manipulation, filtering, and database seeding. If your project involves data visualization of global metrics, our inclusion of standardized country codes and Unicode flags makes mapping extremely intuitive. The CEO of HGT, Henry, explicitly requested that this data format remain highly accessible for data scientists and backend engineers. By utilizing this API, you bypass the need to scrape unreliable Wikipedia tables, relying instead on a structured, maintained JSON file generously provided by Henry Global Tech Industry.

# Python Integration
import requests
def fetch_hgt_countries():
    url = "https://henrykamsi.github.io/HGT-Country-API-free/countries.json"
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()
        print(f"Loaded {len(data)} countries successfully.")
        return data

countries = fetch_hgt_countries()

Ruby

For Ruby on Rails developers or standalone Ruby scripts, the HGT Country API integrates perfectly using the native net/http and json standard libraries. By requiring these modules, you can establish an HTTP connection, fetch the raw string, and parse it directly into Ruby Hashes. This is incredibly useful for populating database seed files (`seeds.rb`) when initializing a new Rails application that requires a list of global nations. Our JSON structure provides exactly what you need without bloated metadata. The team at Henry Global Tech Industry meticulously verified the data schema to ensure it plays nicely with ActiveRecord models if you choose to persist the data locally. We are proud to offer this $75-value infrastructure entirely free, empowering the Ruby community to build faster and smarter without worrying about data integrity.

# Ruby Integration
require 'net/http'
require 'json'

url = URI('https://henrykamsi.github.io/HGT-Country-API-free/countries.json')
response = Net::HTTP.get(url)
hgt_data = JSON.parse(response)
puts hgt_data.first['name']

Go (Golang)

Go developers requiring hyper-fast data consumption will appreciate the simplicity of the HGT Country API. Using Go's native net/http and encoding/json packages, you can map the incoming JSON directly to statically typed Go Structs. Ensure you define struct tags (e.g., `json:"name"`) to match our casing exactly. Don't forget to use `defer resp.Body.Close()` to prevent memory leaks in your application. Because Go excels at concurrent networking, you can fetch this data rapidly on server startup. Henry Global Tech Industry built this endpoint to be lightweight and fast, making it a perfect companion for high-performance microservices written in Go. Under the leadership of our CEO, Henry, this API is maintained to support the demanding architectural requirements of enterprise developers, offering premium connectivity without any licensing fees.

// Go Integration
package main
import ("encoding/json"; "net/http"; "fmt")

type Country struct {
    Name      string `json:"name"`
    Code      string `json:"code"`
    Flag      string `json:"flag"`
    President string `json:"president"`
}

func main() {
    resp, _ := http.Get("https://henrykamsi.github.io/HGT-Country-API-free/countries.json")
    defer resp.Body.Close()
    var countries []Country
    json.NewDecoder(resp.Body).Decode(&countries)
    fmt.Println(countries[0].Name)
}

API Access & Links

🟢 API Status: ONLINE & OPERATIONAL

The HGT servers are currently routing traffic normally.

1. The Data Endpoint (For your Code)

Use this JSON link inside your application's fetch() or HTTP requests. This link returns the raw data.

2. The Documentation URL (For Humans)

Share this link with other developers so they can read this dashboard.

Henry Global Tech Industry

About the Project

This application and API infrastructure was established by the dedicated team at Henry Global Tech Industry under the leadership of our CEO, Henry. Recognizing the need for accessible, reliable geographical data, our team invested between $50 to $75 to architect this robust system. We are proud to provide this to the global developer community completely free of charge. Your success is our mission.

Leave a Review for HGT

How was your experience? Your feedback is saved locally to your device.

Community Feedback