Countries API - CountriesDB

Country & Subdivision Data API
for Forms & Validation

See how it works

 

Features

<!-- Include the widget script with your public key -->
<script src="https://unpkg.com/@countriesdb/widget@latest/dist/index.js?public_key=YOUR_PUBLIC_KEY"></script>

<!-- Country select with data-name -->
<select class="country-selection" data-name="country1"></select>

<!-- Subdivision select linked to country -->
<select class="subdivision-selection" data-country="country1"></select>

Just Plug & Play Into Your Form

Add simple HTML attributes and watch select fields auto-populate with country and subdivision data in user language automatically.

Geolocation Included

Geolocation Included

Automatically detects and preselects the user's country and subdivision based on their IP address. No configuration needed - it just works out of the box.

Multi-Language Support

Multi-Language Support

Automatically displays country and subdivision names in the user's browser language. Supports 50+ languages with comprehensive translation coverage for seamless global integration.

Mission-Critical Data Consistency

Mission-Critical Data Consistency

ISO 3166 compliant data that's always up-to-date and reliable. Perfect for mission-critical applications requiring accurate country and subdivision information with guaranteed consistency.

// Backend fetch (keep your private token server-side)
const res = await fetch("https://api.countriesdb.com/api/data/countries", {
  headers: {
    Authorization: `Bearer ${process.env.COUNTRIESDB_PRIVATE_TOKEN}`,
    Accept: "application/json",
    "Accept-Language": "en",
  },
});

const countries = await res.json();

Backend API for Custom Integrations

Prefer fetching data server-side? Use the Bearer-authenticated Backend Data API for countries and subdivisions. See full docs.

Why Developers Choose CountriesDB?

</>

Framework Libraries

Seamless integration made easy

Integrate easily with React, Angular, Vue, Python, Java, and more.

{ }

Flexible API

Built for your needs

Validation API for consistent form inputs, plus a Backend Data API to list countries and subdivisions server-side.

@

Global Translations

Pre-translated for worldwide use

Supports the most popular languages for seamless global integration.

Always Up-to-Date

Accurate and reliable data

Stay current with the latest country details and subdivisions, updated regularly.

Press Coverage

AP NewsNational Law ReviewFox 8 ClevelandKTVX ABC 4
 

Supports All Web Platforms, Frameworks and Languages

Installation

Just add the script tag to your HTML page.
<!-- Include the widget script with your public key -->
<script src="https://unpkg.com/@countriesdb/widget@latest/dist/index.js?public_key=YOUR_PUBLIC_KEY"></script>

Usage

Add the select elements to your HTML page. No JavaScript knowledge needed.
<!-- Country select with data-name -->
<select class="country-selection" data-name="country1"></select>

<!-- Subdivision select linked to country -->
<select class="subdivision-selection" data-country="country1"></select>

Need help integrating?

We can integrate CountriesDB Widgets into your site or app at no cost if you are on the paid plan.

Most teams use our widget guides and framework docs on their own. If you'd like us to handle it, drop us a line via the contact form below.

Smart Pricing That Adapts to You

Free
Requests
1,000 included / month
Widget Domains
1
Country Languages
1
Subdivisions
Included
Integrations
All

Start

Requests
1,000 included / month
Widget Domains
1
Country Languages
1
Subdivisions
No subdivisions
Integrations
All
$5/month

Basic

Requests
2,000 included / month
Widget Domains
Country Languages
Subdivisions
Integrations
All
$10/month

Pro

Requests
100,000 included / month
Widget Domains
Country Languages
All languages
Subdivisions
Official included
Integrations
All
Most Popular
$49/month

Full

Requests
1,000,000 included / month
Widget Domains
Country Languages
All languages
Subdivisions
Official included
Extended included
Integrations
All
$79/month
10% off when you include attribution to our site
Get up to 25% off with affiliate referrals! See more!
 

Contact Us