API Endpoints

Click an endpoint to test it instantly

Authentication

POST /api/v1/keys/generate Generate custom 32-char API Key

Countries & Data

GET /api/v1/countries List all 250+ countries (with limit=5)
GET /api/v1/countries/code/:code Get country by 2/3 letter code (e.g. JPN)
GET /api/v1/countries/region/:region Filter by region (Asia, Europe, etc)
GET /api/v1/countries/capital/:capital Find country by capital city
GET /api/v1/countries/currency/:code Filter countries using currency (e.g. USD)
GET /api/v1/countries/language/:lang Filter by spoken language (e.g. jpn, eng, mya)
GET /api/v1/countries/random Get random country (great for quizzes)
GET /api/v1/countries/stats Aggregated stats & population metrics

Query Options & Examples

API Integration Code Guide

// 1. Header Method (Recommended)
fetch('https://freecountries.vercel.app/api/v1/countries', {
  headers: {
    'x-api-key': 'demo-key-12345'
  }
})
.then(res => res.json())
.then(data => console.log(data));

// 2. Query Parameter Method
fetch('https://freecountries.vercel.app/api/v1/countries?apiKey=demo-key-12345')
.then(res => res.json())
.then(data => console.log(data));

Interactive Request Console

API Online

Response Payload

Status: -- Time: -- ms πŸ›‘οΈ Rate Limit: -- πŸ“¦ Size: --
{ "message": "Click Send Request to view response..." }