01 Overview

All API endpoints return JSON. No authentication is required. The base URL is:

https://cia-factbook-archive.fly.dev

FastAPI also provides auto-generated interactive documentation at /docs (Swagger UI) and /redoc (ReDoc). The endpoints below are the public API surface.

02 Archive Endpoints
GET /api/years

List all available years with country count and field count per year.

curl https://cia-factbook-archive.fly.dev/api/years
GET /api/archive/{year}

List all countries in a specific year with ISO codes and entity types.

ParameterTypeDescription
yearintYear (1990–2025)
curl https://cia-factbook-archive.fly.dev/api/archive/2025
GET /api/archive/{year}/{code}

Full country profile for a specific year. Returns all categories and fields.

ParameterTypeDescription
yearintYear (1990–2025)
codestringISO Alpha-2 code (e.g. US, CN, RU)
curl https://cia-factbook-archive.fly.dev/api/archive/2025/US
GET /api/field/{code}/{field_name}

Time series for a specific field across all available years.

ParameterTypeDescription
codestringISO Alpha-2 code
field_namestringCanonical field name (e.g. Population)
curl https://cia-factbook-archive.fly.dev/api/field/US/Population
GET /api/search

Full-text search across all 1,071,213 fields. Supports boolean operators (AND, OR, NOT), phrase matching, and year filtering.

ParameterTypeDescription
qstringSearch query (required)
year_startintFilter: start year (optional)
year_endintFilter: end year (optional)
pageintPage number, 50 results per page (default: 1)
curl "https://cia-factbook-archive.fly.dev/api/search?q=nuclear&year_start=2000"
GET /api/fields

List all 414 canonical field names with variant counts.

curl https://cia-factbook-archive.fly.dev/api/fields
GET /api/archive/fields/{code}

List all canonical field names available for a specific country (across all years).

ParameterTypeDescription
codestringISO Alpha-2 code
curl https://cia-factbook-archive.fly.dev/api/archive/fields/US
03 Country Endpoints
GET /api/countries

All 281 master country entities with canonical names, ISO codes, and entity type classification.

curl https://cia-factbook-archive.fly.dev/api/countries
GET /api/countries/{code}

Single country details including all year appearances and category counts.

ParameterTypeDescription
codestringISO Alpha-2 code
curl https://cia-factbook-archive.fly.dev/api/countries/US
04 Analysis Endpoints
GET /api/analysis/regions

Summary statistics for all six COCOM regions (population, GDP, military, life expectancy).

curl https://cia-factbook-archive.fly.dev/api/analysis/regions
GET /api/analysis/region/{cocom}

Country-level indicators for all nations in a specific COCOM region.

ParameterTypeDescription
cocomstringCOCOM code (EUCOM, AFRICOM, CENTCOM, INDOPACOM, SOUTHCOM, NORTHCOM)
curl https://cia-factbook-archive.fly.dev/api/analysis/region/EUCOM
GET /api/analysis/map-data

Choropleth map data for all countries. Returns ISO3 codes, indicator values, and metadata for map rendering.

ParameterTypeDescription
indicatorstringIndicator key (population, gdp_percap, life_exp, etc.)
curl "https://cia-factbook-archive.fly.dev/api/analysis/map-data?indicator=gdp_percap"
GET /api/analysis/map-data/{year}

Choropleth data for a specific year and indicator. Used by timeline and map compare features.

ParameterTypeDescription
yearintYear (1990–2025)
indicatorstringIndicator key (query param)
curl "https://cia-factbook-archive.fly.dev/api/analysis/map-data/2025?indicator=population"
GET /api/analysis/timeseries

Parsed numeric time series for a country and indicator across all available years.

ParameterTypeDescription
codestringISO Alpha-2 code
indicatorstringIndicator key
curl "https://cia-factbook-archive.fly.dev/api/analysis/timeseries?code=US&indicator=population"
GET /api/analysis/dossier/{code}

Structured intelligence dossier for a country. Returns demographics, economy, military, infrastructure, and strategic assessment data.

ParameterTypeDescription
codestringISO Alpha-2 code
curl https://cia-factbook-archive.fly.dev/api/analysis/dossier/CN
GET /api/analysis/comms-data/{year}

Communications infrastructure data for all countries in a given year. Internet users, mobile subscriptions, fixed lines, and broadband.

ParameterTypeDescription
yearintYear (1990–2025)
curl https://cia-factbook-archive.fly.dev/api/analysis/comms-data/2025
GET /api/analysis/rankings

Ranked leaderboard of all sovereign states for any indicator and year.

ParameterTypeDescription
indicatorstringIndicator key (population, gdp_percap, life_exp, etc.)
yearintYear (default: latest)
curl "https://cia-factbook-archive.fly.dev/api/analysis/rankings?indicator=gdp_percap&year=2025"
GET /api/analysis/changes

Year-over-year change detection across 6 core indicators. Returns percentage changes with severity classification.

ParameterTypeDescription
yearintComparison year (default: latest)
indicatorstringFilter by indicator key (optional)
regionstringFilter by COCOM region (optional)
curl "https://cia-factbook-archive.fly.dev/api/analysis/changes?year=2025&indicator=gdp_billions"
GET /api/analysis/dissolved/{group}

Time series data for all successor states of a dissolved federation.

ParameterTypeDescription
groupstringGroup key: soviet_union, yugoslavia, czechoslovakia
indicatorstringIndicator key (default: population)
curl "https://cia-factbook-archive.fly.dev/api/analysis/dissolved/soviet_union?indicator=gdp_percap"
05 Export Endpoints
GET /export/{code}/{year}/csv

Download all fields for a country-year as a CSV file.

curl -O https://cia-factbook-archive.fly.dev/export/US/2025/csv
GET /export/{code}/{year}/xlsx

Download all fields for a country-year as an Excel (.xlsx) file.

curl -O https://cia-factbook-archive.fly.dev/export/US/2025/xlsx
GET /export/bulk/{code}/csv

Bulk export: all years of data for a country as a single CSV file.

curl -O https://cia-factbook-archive.fly.dev/export/bulk/US/csv
GET /export/bulk/{code}/xlsx

Bulk export: all years of data for a country as a single Excel (.xlsx) file.

curl -O https://cia-factbook-archive.fly.dev/export/bulk/US/xlsx
06 Indicator Keys Reference

The following indicator keys are accepted by analysis endpoints (indicator parameter):

KeyCIA Factbook FieldUnit
populationPopulationCount
gdp_billionsReal GDP (purchasing power parity)$B
gdp_percapReal GDP per capita$
life_expLife expectancy at birthYears
mil_pct_gdpMilitary expenditures% GDP
pop_growthPopulation growth rate%
birth_rateBirth rate/1,000
death_rateDeath rate/1,000
internet_pctInternet users%
mobile_per100Telephones - mobile cellular/100
unemploymentUnemployment rate%
inflationInflation rate (consumer prices)%
Terms of Use
The CIA World Factbook is a work of the United States Government and is in the public domain (17 U.S.C. § 105). This API is provided as-is with no rate limits or authentication. Please be respectful of shared resources. For bulk data access, consider downloading the SQL dumps from the GitHub repository.