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 2026-08-20

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 2026-08-20, 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

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