BYTETOOLS

CountriesNow API

Free countries API with no key: every country with capitals, currencies, flags, dial codes, states and cities. A working RestCountries alternative. Tested.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 20 Aug 2026

What is the CountriesNow API?

CountriesNow is a free, key-free API providing comprehensive country data — capitals, currencies, flags, dial codes, populations — along with states and cities for each country.

This API matters more than it otherwise would because RestCountries, long the default choice, deprecated its free v3.1 endpoints and now gates access. CountriesNow is the practical open replacement.

Its distinguishing feature is administrative depth: as well as country-level data it provides states and cities within each country, which is what you actually need for cascading address dropdowns.

Quick facts

Base URL
https://countriesnow.space/api/v0.1
Authentication
No API key required.
Rate limit
No published limit; fair use expected.
Pricing
Free and open source.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the CountriesNow API

Every request below was executed against the live API on 20 Aug 2026, and the response shown is the real body it returned — not an illustration.

1. Fetch countries and their capitals

GET https://countriesnow.space/api/v0.1/countries/capital

curl
curl 'https://countriesnow.space/api/v0.1/countries/capital'
JavaScript (fetch)
const res = await fetch("https://countriesnow.space/api/v0.1/countries/capital");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://countriesnow.space/api/v0.1/countries/capital", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "error": false,
  "msg": "countries and capitals retrieved",
  "data": [
    {
      "name": "Afghanistan",
      "capital": "Kabul",
      "iso2": "AF",
      "iso3": "AFG"
    },
    {
      "name": "Aland Islands",
      "capital": "Mariehamn",
      "iso2": "AX",
      "iso3": "ALA"
    },
    {
      "name": "Albania",
      "capital": "Tirana",
      "iso2": "AL",
      "iso3": "ALB"
    },
    {
      "name": "Algeria",
      "capital": "Algiers",
      "iso2": "DZ",
      "iso3": "DZA"
    },
    {
      "name": "Andorra",
      "capital": "Andorra la Vella",
      "iso2": "AD",
      "iso3": "AND"
    },
    {
      "name": "Angola",
      "capital": "Luanda",
      "iso2": "AO",
      "iso3": "AGO"
    },
    {
      "name": "Anguilla",
      "capital": "The Valley",
      "iso2": "AI",
      "iso3": "AIA"
    },
    {
      "name": "Antarctica",
      "capital": "",
      "iso2": "AQ",
      "iso3": "ATA"
    },
    {
      "name": "Antigua and Barbuda",
      "capital": "St. John's",
      "iso2": "AG",
      "iso3": "ATG"
    },
    {
      "name": "Argentina",
      "capital": "Buenos Aires",
      "iso2": "AR",
      "iso3": "ARG"
    },
    {
      "name": "Armenia",
      "capital": "Yerevan",
      "iso2": "AM",
      "iso3": "ARM"
    },
    {
      "name": "Aruba",
      "capital": "Oranjestad",
      "iso2": "AW",
      "iso3": "ABW"
    },
    {
      "name": "Australia",
      "capital": "Canberra",
      "iso2": "AU",
      "iso3": "AUS"
    },
    {
      "name": "Austria",
      "capital": "Vienna",
      "iso2": "AT",
      "iso3": "AUT"
    }

Parameters

ParameterTypeRequiredDescription
countries/capitalpathOptionalEvery country with its capital city. countries/capital
countries/currencypathOptionalCountry currencies. countries/currency
countries/flag/imagespathOptionalFlag image URLs. countries/flag/images
countries/statespathOptionalStates or provinces per country. countries/states
countries/citiespathOptionalPOST a country name to get its cities. countries/cities

Response fields

errorboolean
False on success — check this first.
msgstring
Human-readable status message.
dataarray|object
The payload; shape varies by endpoint.
data[].namestring
Country name.
data[].capitalstring
Capital city.
data[].iso2 / iso3string
ISO country codes.

What you can build with the CountriesNow API

  • Build cascading country, state and city address dropdowns
  • Populate a country selector with flags and dial codes
  • Replace a broken RestCountries integration
  • Validate address data against real administrative divisions

Common errors and how to fix them

error: true

The request failed; read `msg` for why.

Fix: The API returns HTTP 200 with error:true for logical failures — check the field, not just the status.

Cities endpoint needs POST

Some endpoints take a POST body rather than query parameters.

Fix: POST {"country":"Pakistan"} to /countries/cities rather than using GET.

Inconsistent country naming

Country names vary between endpoints.

Fix: Prefer ISO codes where the endpoint supports them.

CountriesNow API — frequently asked questions

Is CountriesNow free?

Yes, completely free and open source with no API key.

Is this a good RestCountries replacement?

Yes. RestCountries deprecated its free v3.1 endpoints and now gates access, so CountriesNow is the practical open alternative — and it adds states and cities, which RestCountries never had.

How do I get cities for a country?

POST a JSON body with the country name to /countries/cities. Several endpoints use POST rather than GET, which is unusual but documented.

Why does a successful response contain error: true?

The API signals logical failures in the body while returning HTTP 200. Always check the `error` boolean rather than relying on the status code.

Tools that pair with this API

Alternatives to CountriesNow API

If CountriesNow does not fit, these geolocation & ip apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.

APIWhat it doesAuthCORSLast verified
ipifyipify is a free, unlimited API that returns your public IP address as text, JSON or JSONP. No key, no rate limit, IPv4 and IPv6 endpoints. Live curl example.No keyYes19 Aug 2026
ip-api.comFree IP geolocation API returning country, city, coordinates, timezone and ISP for any IP. No key on the free tier, 45 requests per minute. Tested curl example.No keyYes19 Aug 2026
ipwho.isFree IP geolocation API with HTTPS and no API key. Returns country, city, coordinates, timezone, currency and connection data. 10,000 requests/month free.No keyYes19 Aug 2026
Nominatim (OpenStreetMap)Free OpenStreetMap geocoding API: convert addresses to coordinates and back. No API key, open data, 1 request per second. Tested curl example and usage policy.No keyNo19 Aug 2026
country.isFree IP to country API with no key: returns just the ISO country code for any IP address, in a two-field response. Tested curl example and live response included.No keyYes21 Aug 2026
DAWA (Danish Addresses)Free official Danish address API with no key: search, validate and autocomplete every address in Denmark, with coordinates, municipality codes and full history. Live example included.No keyYes21 Aug 2026
All Geolocation & IP APIs

CountriesNow is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 20 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.