Countries
ISO 3166-1 alpha-2 country reference data for airport forms, continent filters, and validating iso_country on airport records. Two operations: list all countries (optionally filtered by continent) and fetch one country by code. Empty list matches return countries: [] with HTTP 200.
| Endpoint | When to use |
|---|---|
GET /countries | Populate country pickers or filter airport lists by continent |
GET /countries/{code} | Resolve a single ISO code to a canonical label |
List countries
Returns all countries, optionally filtered by continent code (AF, AN, AS, EU, NA, OC, SA).
Request
Requirements
x-api-key on every request (direct subscription). Learn more →https://data.skylinkapi.com/v3/countries| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
continent | string | No | all continents | Continent code (AF, AN, AS, EU, NA, OC, SA) |
Response
{
"countries": [
{
"id": 302755,
"code": "US",
"name": "United States",
"continent": null,
"wikipedia_link": "https://en.wikipedia.org/wiki/United_States",
"keywords": "American airports"
}
],
"total": 1
}| Field | Type | Required | Null? | Description |
|---|---|---|---|---|
countries | array | Yes | Never | Matching country records |
total | integer | Yes | Never | Number of records returned |
Country item (countries[])
| Field | Type | Required | Null? | Description |
|---|---|---|---|---|
id | integer | Yes | Never | Numeric record identifier |
code | string | Yes | Never | ISO 3166-1 alpha-2 code |
name | string | Yes | Never | Country name |
continent | string | null | No | Yes | Continent code when assigned |
wikipedia_link | string | null | No | Yes | Reference URL |
keywords | string | null | No | Yes | Free-text tags |
Get country by code
Retrieve a single country by ISO 3166-1 alpha-2 code (e.g. US, GB). Returns 404 if the code is not found.
Request
https://data.skylinkapi.com/v3/countries/{code}| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Country code path parameter (alpha-2) |
Response
{
"id": 302755,
"code": "US",
"name": "United States",
"continent": null,
"wikipedia_link": "https://en.wikipedia.org/wiki/United_States",
"keywords": "American airports"
}Same object shape as list items. continent, wikipedia_link, and keywords may be null.
Client types
"""Country reference models for /countries endpoints."""from __future__ import annotationsfrom dataclasses import dataclass@dataclassclass CountriesListRequest: continent: str | None = None@dataclassclass CountryByCodeRequest: code: str@dataclassclass CountryRecord: id: int code: str name: str continent: str | None wikipedia_link: str | None keywords: str | None@dataclassclass CountriesResponse: countries: list[CountryRecord] total: intIntegration
Build a validated country options list for airport or route filters.
The example below caches country reference data for 24 hours and uses explicit timeouts to keep form rendering responsive.
import osimport timefrom dataclasses import dataclassimport requestsHEADERS = { "x-api-key": os.getenv("SKYLINK_API_KEY", "YOUR_API_KEY")}BASE = "https://data.skylinkapi.com/v3"CACHE: dict[str, tuple[dict, float]] = {}COUNTRIES_TTL = 86_400 # 24 h@dataclassclass CountryOption: code: str label: strdef fetch_countries(*, continent: str | None = None) -> list[dict]: key = f"countries:{continent or 'all'}" cached = CACHE.get(key) if cached and time.time() < cached[1]: return cached[0]["countries"] params = {"continent": continent} if continent else None try: r = requests.get(f"{BASE}/countries", headers=HEADERS, params=params, timeout=(10, 15)) except requests.Timeout as exc: raise RuntimeError("SkyLink timeout fetching countries") from exc r.raise_for_status() data = r.json() CACHE[key] = (data, time.time() + COUNTRIES_TTL) return data.get("countries", [])def get_country_by_code(code: str) -> dict | None: code = code.upper() try: r = requests.get(f"{BASE}/countries/{code}", headers=HEADERS, timeout=(10, 15)) except requests.Timeout as exc: raise RuntimeError(f"SkyLink timeout fetching country {code}") from exc if r.status_code == 404: return None r.raise_for_status() return r.json()def country_options(continent: str | None = None) -> list[CountryOption]: items = fetch_countries(continent=continent) return [CountryOption(code=item["code"], label=item["name"]) for item in items]if __name__ == "__main__": import json us = get_country_by_code("US") print(json.dumps(us, indent=2, default=str))Implementation notes
Continent filtering. Pass continent to reduce payload in region-specific products (e.g. only NA and EU).
Code normalization. Uppercase user input before lookup (us → US) to avoid false 404s.
Error responses
Shared platform errors: Error Handling. Endpoint-specific:
404 - country not found
{
"detail": "Country 'XX' not found"
}400 - invalid continent filter
{
"detail": "Invalid continent 'XX'. Valid values: AF, AN, AS, EU, NA, OC, SA"
}Your SkyLink licence key, for keys bought direct from skylinkapi.com.
In: header
Query Parameters
Filter by continent code: AF (Africa), AN (Antarctica), AS (Asia), EU (Europe), NA (North America), OC (Oceania), SA (South America)
Response Body
application/json
application/json
curl -X GET "https://data.skylinkapi.com/v3/countries"{
"countries": [
{
"id": 0,
"code": "string",
"name": "string",
"continent": "string",
"wikipedia_link": "string",
"keywords": "string"
}
],
"total": 0
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}Your SkyLink licence key, for keys bought direct from skylinkapi.com.
In: header
Path Parameters
ISO 3166-1 alpha-2 country code (e.g. US, GB, DE)
Response Body
application/json
application/json
curl -X GET "https://data.skylinkapi.com/v3/countries/US"{
"id": 0,
"code": "string",
"name": "string",
"continent": "string",
"wikipedia_link": "string",
"keywords": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}Related: Regions · Airports · Airport Search