Welcome to country-state-city microservice

Endpoint: Get Countries

URL

GET https://api.country-state-city.rebuscando.info/public/getCountries

Description

This endpoint retrieves a list of all countries.

Response

  • Content-Type: application/json
  • HTTP Status Codes:
    • 200 OK: The request was successful, and the response body contains a JSON array of country objects.
    • 500 Internal Server Error: An error occurred on the server.

Response Body

The response body is a JSON array of country objects. Each country object contains the following fields:

  • _id: Unique identifier for the country in the database (string)
  • id: Numeric identifier for the country (integer)
  • name: Name of the country (string)
  • iso3: ISO 3166-1 alpha-3 code of the country (string)
  • iso2: ISO 3166-1 alpha-2 code of the country (string)
  • numeric_code: Numeric code of the country (integer)
  • phone_code: International dialing code for the country (string)
  • capital: Capital city of the country (string)
  • currency: ISO 4217 currency code (string)
  • currency_name: Name of the country’s currency (string)
  • tld: Top-level domain (string)
  • nativename: Native name of the country (string or null)
  • region: Continent or region the country is part of (string)
  • region_id: Identifier for the region (string)
  • subregion: Subregion the country is part of (string)
  • subregion_id: Identifier for the subregion (string)
  • nationality: Demonym or nationality associated with the country (string)
  • timezones: Array of timezone objects associated with the country (stringified JSON array)
    • zoneName: Name of the timezone (string)
    • gmtOffset: Offset from GMT in seconds (integer)
    • gmtOffsetName: Name of the GMT offset (string)
    • abbreviation: Abbreviation of the timezone (string)
    • tzName: Full name of the timezone (string)
  • latitude: Latitude coordinate of the country (float)
  • longitude: Longitude coordinate of the country (float)
  • emoji: Emoji flag of the country (string)
  • emojiU: Unicode representation of the emoji flag (string)

Example Response

[
  {
    "_id": "665d8f83cba4c7b5edda9f9a",
    "id": 8,
    "name": "Anguilla",
    "iso3": "AIA",
    "iso2": "AI",
    "numeric_code": 660,
    "phone_code": "+1-264",
    "capital": "The Valley",
    "currency": "XCD",
    "currency_name": "East Caribbean dollar",
    "tld": ".ai",
    "nativename": null,
    "region": "Americas",
    "region_id": "2",
    "subregion": "Caribbean",
    "subregion_id": "7",
    "nationality": "Anguillan",
    "timezones": "[{\"zoneName\":\"America\\/Anguilla\",\"gmtOffset\":-14400,\"gmtOffsetName\":\"UTC-04:00\",\"abbreviation\":\"AST\",\"tzName\":\"Atlantic Standard Time\"}]",
    "latitude": 18.25,
    "longitude": -63.16666666,
    "emoji": "🇦🇮",
    "emojiU": "U+1F1E6 U+1F1EE"
  },
  {
    "_id": "665d8f83cba4c7b5edda9f93",
    "id": 1,
    "name": "Afghanistan",
    "iso3": "AFG",
    "iso2": "AF",
    "numeric_code": 4,
    "phone_code": "93",
    "capital": "Kabul",
    "currency": "AFN",
    "currency_name": "Afghan afghani",
    "tld": ".af",
    "nativename": null,
    "region": "Asia",
    "region_id": "3",
    "subregion": "Southern Asia",
    "subregion_id": "14",
    "nationality": "Afghan",
    "timezones": "[{\"zoneName\":\"Asia\\/Kabul\",\"gmtOffset\":16200,\"gmtOffsetName\":\"UTC+04:30\",\"abbreviation\":\"AFT\",\"tzName\":\"Afghanistan Time\"}]",
    "latitude": 33.0,
    "longitude": 65.0,
    "emoji": "🇦🇫",
    "emojiU": "U+1F1E6 U+1F1EB"
  },
  {
    "_id": "665d8f83cba4c7b5edda9fa2",
    "id": 16,
    "name": "Azerbaijan",
    "iso3": "AZE",
    "iso2": "AZ",
    "numeric_code": 31,
    "phone_code": "994",
    "capital": "Baku",
    "currency": "AZN",
    "currency_name": "Azerbaijani manat",
    "tld": ".az",
    "nativename": null,
    "region": "Asia",
    "region_id": "3",
    "subregion": "Western Asia",
    "subregion_id": "11",
    "nationality": "Azerbaijani, Azeri",
    "timezones": "[{\"zoneName\":\"Asia\\/Baku\",\"gmtOffset\":14400,\"gmtOffsetName\":\"UTC+04:00\",\"abbreviation\":\"AZT\",\"tzName\":\"Azerbaijan Time\"}]",
    "latitude": 40.5,
    "longitude": 47.5,
    "emoji": "🇦🇿",
    "emojiU": "U+1F1E6 U+1F1FF"
  },
  {
    "_id": "665d8f83cba4c7b5edda9fa9",
    "id": 24,
    "name": "Benin",
    "iso3": "BEN",
    "iso2": "BJ",
    "numeric_code": 204,
    "phone_code": "229",
    "capital": "Porto-Novo",
    "currency": "XOF",
    "currency_name": "West African CFA franc",
    "tld": ".bj",
    "nativename": null,
    "region": "Africa",
    "region_id": "1",
    "subregion": "Western Africa",
    "subregion_id": "3",
    "nationality": "Beninese, Beninois",
    "timezones": "[{\"zoneName\":\"Africa\\/Porto-Novo\",\"gmtOffset\":3600,\"gmtOffsetName\":\"UTC+01:00\",\"abbreviation\":\"WAT\",\"tzName\":\"West Africa Time\"}]",
    "latitude": 9.5,
    "longitude": 2.25,
    "emoji": "🇧🇯",
    "emojiU": "U+1F1E7 U+1F1EF"
  },
  {
    "_id": "665d8f83cba4c7b5edda9fab",
    "id": 26,
    "name": "Bhutan",
    "iso3": "BTN",
    "iso2": "BT",
    "numeric_code": 64,
    "phone_code": "975",
    "capital": "Thimphu",
    "currency": "BTN",
    "currency_name": "Bhutanese ngultrum",
    "tld": ".bt",
    "nativename": null,
    "region": "Asia",
    "region_id": "3",
    "subregion": "Southern Asia",
    "subregion_id": "14",
    "nationality": "Bhutanese",
    "timezones": "[{\"zoneName\":\"Asia\\/Thimphu\",\"gmtOffset\":21600,\"gmtOffsetName\":\"UTC+06:00\",\"abbreviation\":\"BTT\",\"tzName\":\"Bhutan Time\"}]",
    "latitude": 27.5,
    "longitude": 90.5,
    "emoji": "🇧🇹",
    "emojiU": "U+1F1E7 U+1F1F9"
  },
  {
    "_id": "665d8f83cba4c7b5edda9fae",
    "id": 28,
    "name": "Bosnia and Herzegovina",
    "iso3": "BIH",
    "iso2": "BA",
    "numeric_code": 70,
    "phone_code": "387",
    "capital": "Sarajevo",
    "currency": "BAM",
    "currency_name": "Bosnia and Herzegovina convertible mark",
    "tld": ".ba",
    "nativename": null,
    "region": "Europe",
    "region_id": "4",
    "subregion": "Southern Europe",
    "subregion_id": "16",
    "nationality": "Bosnian or Herzegovinian",
    "timezones": "[{\"zoneName\":\"Europe\\/Sarajevo\",\"gmtOffset\":3600,\"gmtOffsetName\":\"UTC+01:00\",\"abbreviation\":\"CET\",\"tzName\":\"Central European Time\"}]",
    "latitude": 44.0,
    "longitude": 18.0,
    "emoji": "🇧🇦",
    "emojiU": "U+1F1E7 U+1F1E6"
  }
]

Error Response

If an internal server error occurs, the API will respond with a 500 Internal Server Error status code and an empty response body.