API Documentation

Getting Started

Welcome to MatrixAPI - your source for comprehensive, immutable reference data. Our APIs provide high-performance, cacheable data including vehicles, countries, geographic subdivisions, and more.

Base URL

https://matrixapi.dev/api/v1/

Quick Start

# Get minimal vehicle data (perfect for dropdowns)
curl -H "X-API-Key: your_api_key_here" https://matrixapi.dev/api/v1/vehicles

# Get comprehensive vehicle data  
curl -H "X-API-Key: your_api_key_here" https://matrixapi.dev/api/v1/vehicles?all=true

# Get specific vehicle models
curl -H "X-API-Key: your_api_key_here" https://matrixapi.dev/api/v1/vehicles/2025/bmw

Authentication

MatrixAPI offers both free and premium endpoints with different authentication requirements.

public Geographic Data (Free): Countries, subdivisions, and cities - no authentication required.

directions_car Vehicle Data (Premium): Requires API key in production. Free during development/testing.

API Key Usage

For endpoints that require authentication, include your API key in the request header:

# Include API key in header
curl -H "X-API-Key: your_api_key_here" https://matrixapi.dev/api/v1/vehicles

# For JavaScript/fetch
fetch('https://matrixapi.dev/api/v1/vehicles', {
  headers: {
    'X-API-Key': 'your_api_key_here'
  }
})

Getting an API Key: Contact us to request production access for vehicle data endpoints.

Response Patterns

All MatrixAPI endpoints follow a consistent, developer-friendly pattern optimized for both dropdown/UI components and comprehensive data access.

Two Response Modes

list Minimal (Default)

Perfect for dropdowns, forms, and UI components

{
  "vehicles": [
    {
      "name": "bmw",
      "endpoint": "/api/v1/vehicles/2025/bmw"
    }
  ],
  "total": 99,
  "statistics": {...}
}

bar_chart Comprehensive (?all=true)

Complete data with all available fields

{
  "vehicles": [
    {
      "name": "bmw",
      "full_name": "bmw, INC.",
      "country": "UNITED STATES (USA)",
      "vehicle_types": ["Passenger Car"],
      "total_models": 15,
      "endpoint": "/api/v1/vehicles/2025/bmw"
    }
  ]
}

Standard Response Structure

{
  "[resource_name]": [...],           // Main data array
  "total": 249,                       // Count of items
  "statistics": {...},                // Performance metrics
  "available_[filters]": [...],       // Available filter options
  "cache_duration": "immutable",      // Cache information
  "examples": {...},                  // Usage examples
  "endpoints": {...},                 // Related endpoints
  "available_fields": [...],          // Current response fields
  "query_parameters": {...}           // Parameter descriptions
}

directions_car Vehicles API

warning Authentication Required: Vehicle API endpoints require an API key in production. See authentication section for details.

GET /vehicles

All vehicle makes index

GET /vehicles/{make}

Current year models for make

GET /vehicles/{year}/{make}

Specific year models

Query Parameters

  • country - Filter by manufacturer country — ISO2 code (DE) or full name (GERMANY)
  • type - Filter by vehicle type (car, mpv, truck, motorcycle, all) - supports comma-separated
  • all - Set to 'true' to include comprehensive data fields

Examples

# Minimal data for dropdowns
curl -H "X-API-Key: your_api_key" https://matrixapi.dev/api/v1/vehicles
# Filter by country (ISO2 or full name — both work)
curl -H "X-API-Key: your_api_key" https://matrixapi.dev/api/v1/vehicles?country=DE
curl -H "X-API-Key: your_api_key" https://matrixapi.dev/api/v1/vehicles?country=GERMANY
# Filter by vehicle types
curl -H "X-API-Key: your_api_key" https://matrixapi.dev/api/v1/vehicles?type=car,mpv,truck
# Comprehensive data
curl -H "X-API-Key: your_api_key" https://matrixapi.dev/api/v1/vehicles?all=true
# Specific vehicle models
curl -H "X-API-Key: your_api_key" https://matrixapi.dev/api/v1/vehicles/2025/bmw

public Countries API

Access countries, subdivisions, and cities with comprehensive geographic data. All endpoints support human-readable, case-insensitive names.

GET /countries

All countries index with filtering

GET /countries/{identifier}

Individual country details (supports names)

link Connected Resources

Countries API seamlessly connects to:

  • Subdivisions: /countries/{country}/subdivisions
  • Cities: /countries/{country}/{subdivision}/cities
  • Specific Cities: /countries/{country}/{subdivision}/{city}

Query Parameters

  • region - Filter by world region (e.g., 'Europe', 'Asia', 'Africa')
  • subregion - Filter by subregion (e.g., 'Northern Europe', 'Southern Asia')

Response Fields

All fields are always returned — there is no minimal/comprehensive toggle for countries.

  • name, iso2, iso3, numeric_code, phone_code
  • capital, region, subregion
  • currency, currency_name, currency_symbol
  • tld, native_name, nationality, primary_language
  • driving_side, landlocked, un_member
  • population, area, density, gdp_per_capita, median_age
  • subdivision_type, total_subdivisions, subdivisions_endpoint
  • emoji, emojiU, latitude, longitude
  • timezones, translations, endpoint

Examples

# Minimal countries for dropdowns
GET /api/v1/countries
# Filter by region
GET /api/v1/countries?region=Europe
# Individual country (human-readable)
GET /api/v1/countries/kosovo
# Get subdivisions for a country
GET /api/v1/countries/kosovo/subdivisions
# Get cities in a subdivision
GET /api/v1/countries/kosovo/ferizaj/cities

location_city Cities API

Access cities within specific subdivisions with coordinates and comprehensive data. All endpoints support human-readable, case-insensitive names.

GET /countries/{country}/{subdivision}/cities

All cities in a subdivision

GET /countries/{country}/{subdivision}/{city}

Specific city details

Human-Readable URLs

All parameters support case-insensitive, human-readable names:

  • /countries/kosovo/ferizaj/cities (human-readable)
  • /countries/XK/XUF/cities (formal codes)
  • /countries/Kosovo/Ferizaj/cities (mixed case)

Response Fields

Coordinates and endpoint are always included — no query parameter required.

  • id - City database ID
  • name - City name
  • latitude - GPS latitude
  • longitude - GPS longitude
  • endpoint - City detail URL

Note: If city data was recently AI-populated, cache_duration may be "no-cache" on first access. Subsequent requests return "immutable".

Examples

# Cities in Kosovo's Ferizaj district
GET /api/v1/countries/kosovo/ferizaj/cities
# Cities with coordinates (included by default)
GET /api/v1/countries/kosovo/ferizaj/cities
# Specific city details
GET /api/v1/countries/kosovo/ferizaj/shtime

Sample Response

{
  "country": "Kosovo",
  "subdivision": "Ferizaj",
  "subdivision_code": "XUF",
  "subdivision_type": "districts",
  "cities": [
            {
      "id": 157206,
      "name": "Ferizaj",
      "latitude": "42.3708",
      "longitude": "21.1531",
      "endpoint": "https://matrixapi.dev/api/v1/countries/kosovo/ferizaj/ferizaj"
    },
    {
      "id": 157207,
      "name": "Shtime",
      "latitude": "42.4333",
      "longitude": "21.04",
      "endpoint": "https://matrixapi.dev/api/v1/countries/kosovo/ferizaj/shtime"
    }
  ],
  "total": 5,
  "data_source": "database",
  "cache_duration": "immutable",
  "canonical_url": "https://matrixapi.dev/api/v1/countries/XK/subdivisions/XUF/cities",
  "url_note": "Both /countries/{name}/{subdivision}/cities and /countries/{iso2}/subdivisions/{code}/cities return identical data. The canonical form uses ISO codes.",
  "related_endpoints": {
    "cross_subdivision_search": "https://matrixapi.dev/api/v1/cities?country=XK",
    "note": "Use /api/v1/cities?country={iso2}&state={code} to search across multiple subdivisions"
  },
  "available_fields": ["id", "name", "latitude", "longitude", "endpoint"]
}

map Subdivisions API

Access states, provinces, departments, and other administrative subdivisions with intelligent type detection.

GET /countries/{code}/subdivisions

Get subdivisions for a specific country

Intelligent Subdivision Types

🇺🇸 United States

states

🇨🇦 Canada

provinces

🇩🇪 Germany

states

🇫🇷 France

departments

🇯🇵 Japan

prefectures

🇨🇭 Switzerland

cantons

Response Fields

All fields are always returned for each subdivision.

  • name - Subdivision name
  • code - Official code (e.g., "US-CA", "XK-XUF")
  • type - Subdivision type (state, province, district, etc.)
  • latitude, longitude - Geographic center coordinates
  • cities_count - Number of cities in this subdivision
  • endpoint - URL to fetch cities for this subdivision

Examples

# US states (minimal for dropdowns)
GET /api/v1/countries/US/subdivisions
# Canadian provinces (coordinates included by default)
GET /api/v1/countries/CA/subdivisions
# German states
GET /api/v1/countries/DE/subdivisions

language Regions & Subregions API

Access world regions and subregions for geographic organization and filtering.

GET /regions

World regions (7 continents)

GET /subregions

Subregions within continents

Available Regions

• Africa
• Antarctica
• Asia
• Europe
• North America
• Oceania
• South America

Examples

# All world regions
GET /api/v1/regions
# All subregions
GET /api/v1/subregions

currency_exchange Currencies API

ISO 4217 currency data including codes, symbols, decimal places, and country associations. No live exchange rates — static reference data only.

public Free & Public: No authentication required.

GET /currencies

All currencies index

GET /currencies/{code}

Single currency by ISO 4217 code

Response Fields

  • code — ISO 4217 code (e.g., USD, EUR)
  • name — Official currency name
  • symbol — Currency symbol (e.g., $, )
  • decimal_places — Number of decimal digits
  • countries — ISO2 codes of countries using this currency

Examples

# All currencies (6 sample currencies; full ISO 4217 coverage coming soon)
GET /api/v1/currencies
# Specific currency
GET /api/v1/currencies/EUR
// Currency dropdown
fetch('/api/v1/currencies').then(r => r.json()).then(data => {
  data.currencies.forEach(c => {
    dropdown.innerHTML += `<option value="${c.code}">${c.code} – ${c.name}</option>`;
  });
});

flight Airports API

Global airport database with IATA/ICAO codes, GPS coordinates, elevation, and type classification. Filter by country, continent, region, or type.

public Free & Public: No authentication required.

GET /airports

All airports with filtering

GET /airports/{id}

Airport by IATA, ICAO, GPS code, or DB id

Query Parameters

  • country — ISO2 country code (e.g., US, DE)
  • type — Airport type: large_airport, medium_airport, small_airport, heliport, seaplane_base, balloonport, closed
  • continent — Continent code: AF, AN, AS, EU, NA, OC, SA
  • region — Geographic region name (e.g., Europe)
  • subregion — Geographic subregion (e.g., Western Europe)
  • iata — Look up by IATA code (e.g., JFK)
  • all — Set to true for full fields including coordinates, ICAO, elevation

Response Fields

Minimal Mode (default)

  • name — Airport name
  • iata_code — IATA 3-letter code
  • country — ISO2 string on index (e.g., "US")
  • airport_type — Classification

Comprehensive Mode (?all=true)

  • • All minimal fields plus:
  • icao_code, gps_code, local_code
  • municipality, continent
  • elevation_ft, state
  • latitude, longitude

Note: The country field shape differs between endpoints. On the index (/airports), it is a string: "US". On the show (/airports/JFK), it is an object: {"name":"United States","iso2":"US"}.

Examples

# All large airports in Europe
GET /api/v1/airports?continent=EU&type=large_airport
# All US airports
GET /api/v1/airports?country=US
# Look up by IATA code with full data
GET /api/v1/airports/JFK
# European airports with coordinates
curl "https://matrixapi.dev/api/v1/airports?continent=EU&type=large_airport&all=true"

monitoring Status API

Check service health, discover available APIs, and view data coverage statistics.

GET /status

Service health and available APIs overview

Response Fields

  • service — Service name
  • version — API version
  • status — Operational status
  • available_apis — Map of all APIs with endpoint and status
  • data_coverage — Statistics per data category

Example

curl "https://matrixapi.dev/api/v1/status"

Sample Response

{
  "service": "MatrixAPI",
  "version": "v1",
  "status": "operational",
  "uptime": "99.9%",
  "cache_strategy": "immutable",
  "available_apis": {
    "vehicles":          { "endpoint": "/api/v1/vehicles",   "status": "available" },
    "countries":         { "endpoint": "/api/v1/countries",  "status": "available" },
    "currencies":        { "endpoint": "/api/v1/currencies", "status": "available" },
    "airports":          { "endpoint": "/api/v1/airports",   "status": "available" },
    "languages":         { "endpoint": "/api/v1/languages",  "status": "coming_soon" },
    "holidays":          { "endpoint": "/api/v1/holidays",   "status": "coming_soon" },
    "phone_metadata":    { "endpoint": "/api/v1/phone_metadata", "status": "coming_soon" },
    "postal_patterns":   { "endpoint": "/api/v1/postal_patterns", "status": "coming_soon" },
    "measurement_units": { "endpoint": "/api/v1/units",      "status": "coming_soon" }
  },
  "documentation": "https://matrixapi.dev/docs",
  "support": "support@matrixapi.dev"
}

bolt Caching & Performance

MatrixAPI implements aggressive multi-layer caching for exceptional performance worldwide.

Cache Layers

home Application Cache

Server-side Rails caching with Redis

  • • Cached for 1 year (immutable data)
  • • Automatic cache invalidation on deployment
  • • Sub-50ms response times

public HTTP Cache

Browser & CDN caching with ETags

  • • 1-year cache duration
  • • ETags for conditional requests
  • • 304 Not Modified responses

Cache Headers

Cache-Control: max-age=31556952, public
ETag: W/"2725d4a3b4575afe5a838dd205f326d7"
X-Runtime: 0.051136

Performance Benefits

  • Global Performance: Instant responses via CDN caching
  • Bandwidth Efficiency: 304 responses save bandwidth
  • Server Efficiency: Minimal database load
  • Developer Friendly: No cache management needed

code Code Examples

target Interactive Demo

See the API in action with live dynamic dropdowns for countries, subdivisions, cities, and vehicles.

open_in_new Try Live Demo

Features: Real-time API calls, performance monitoring, and intelligent subdivision filtering

JavaScript (Fetch)

// Get minimal data for dropdowns
const response = await fetch('https://matrixapi.dev/api/v1/countries');
const data = await response.json();

// Populate dropdown
data.countries.forEach(country => {
  dropdown.innerHTML += `<option value="${country.iso2}">${country.name}</option>`;
});

// Data already includes all available fields by default
console.log(data.countries[0].currency); // Currency info included
console.log(data.countries[0].latitude); // Coordinates included

Python (Requests)

import requests

# Get vehicle data with filtering
response = requests.get('https://matrixapi.dev/api/v1/vehicles', params={
    'country': 'GERMANY',
    'type': 'car,mpv'
})
vehicles = response.json()

# Get specific vehicle models  
bmw_response = requests.get('https://matrixapi.dev/api/v1/vehicles/2025/bmw')
bmw_models = bmw_response.json()

cURL Examples

# Check cache headers
curl -I "https://matrixapi.dev/api/v1/countries/kosovo"

# Test response times (cache verification)
time curl -s "https://matrixapi.dev/api/v1/countries/kosovo" > /dev/null

# Get US states for dropdown
curl "https://matrixapi.dev/api/v1/countries/US/subdivisions" | jq '.subdivisions'

Common Use Cases

tune Form Components

  • • Country dropdowns
  • • State/Province selectors
  • • Vehicle make/model lists

bar_chart Data Applications

  • • Geographic analysis
  • • Automotive databases
  • • Reference data validation