Logogithub

A free GraphQL API for comprehensive geographic data β€” countries, states, and cities worldwide. Perfect for applications needing location data, dropdown menus, maps, and geographic information systems.

🎯 Free & Open Source β€” No API keys required, no rate limits. This GraphQL API provides detailed geographic data including country ISO codes, phone codes, capitals, currencies, emojis, state coordinates, and city locations. Data sourced from thecountries-states-cities-database by Darshan Gada, with additional personally gathered data.

🌍 250+ CountriesπŸ—ΊοΈ 5,000+ StatesπŸ™οΈ 150,000+ CitiesπŸ†“ Free Forever⚑ GraphQL
  • βœ… Get countries with ISO2, ISO3, phone codes, capital, currency, emoji, and coordinates
  • βœ… Filter countries by region or subregion (Africa, Americas, Asia, Europe, Oceania)
  • βœ… Get states with names, longitude, latitude, and associated cities
  • βœ… Search cities by country or state with precise coordinates
🌐 GraphQL Endpoint:https://graphql.countriesql.com/graphqlπŸš€ Playground:https://graphql.countriesql.com

🌍 Countries

QUERYCountries

Get all countries with detailed information including ISO codes, phone codes, capital, currency, emoji, and coordinates.

πŸ“€ Example Response

{
  "data": {
    "Countries": [
      {
        "id": 1,
        "iso2": "US",
        "iso3": "USA",
        "name": "United States",
        "emoji": "πŸ‡ΊπŸ‡Έ",
        "numeric_code": "840",
        "phone_code": "+1",
        "capital": "Washington D.C.",
        "currency": "USD",
        "currency_name": "US Dollar",
        "currency_symbol": "$",
        "tld": ".us",
        "native": "United States",
        "region": "Americas",
        "subregion": "North America",
        "longitude": -95.712891,
        "latitude": 37.09024
      }
    ]
  }
}
QUERYCountry(iso2: String)

Get detailed information about a specific country by ISO2 code.

πŸ“ Arguments

ArgumentTypeRequiredDescription
iso2Stringβœ“ YesTwo-letter country code (e.g., "NG", "US", "GH")

πŸ“€ Example Response

{
  "data": {
    "Country": {
      "id": 162,
      "iso2": "NG",
      "iso3": "NGA",
      "name": "Nigeria",
      "emoji": "πŸ‡³πŸ‡¬",
      "numeric_code": "566",
      "phone_code": "234",
      "capital": "Abuja",
      "currency": "NGN",
      "currency_name": "Nigerian naira",
      "currency_symbol": "₦",
      "tld": ".ng",
      "native": "Nigeria",
      "region": "Africa",
      "subregion": "Western Africa",
      "longitude": 8,
      "latitude": 10
    }
  }
}
QUERYCountriesByRegion(region: String)

Get all countries belonging to a specific region (e.g., Africa, Americas, Asia, Europe, Oceania).

πŸ“ Arguments

ArgumentTypeRequiredDescription
regionStringβœ“ YesRegion name (Africa, Americas, Asia, Europe, Oceania)

πŸ“€ Example Response

{
  "data": {
    "CountriesByRegion": [
      {
        "id": 162,
        "iso2": "NG",
        "name": "Nigeria",
        "emoji": "πŸ‡³πŸ‡¬",
        "phone_code": "234",
        "capital": "Abuja",
        "currency": "NGN",
        "region": "Africa"
      }
    ]
  }
}
QUERYCountriesBySubregion(subregion: String)

Get all countries belonging to a specific subregion (e.g., Western Africa, Southeast Asia, South America).

πŸ“ Arguments

ArgumentTypeRequiredDescription
subregionStringβœ“ YesSubregion name (e.g., "Western Africa", "South America")

πŸ“€ Example Response

{
  "data": {
    "CountriesBySubregion": [
      {
        "id": 162,
        "iso2": "NG",
        "name": "Nigeria",
        "emoji": "πŸ‡³πŸ‡¬",
        "capital": "Abuja",
        "region": "Africa",
        "subregion": "Western Africa"
      }
    ]
  }
}

πŸ—ΊοΈ States

QUERYStates

Get all states with their names and coordinates.

πŸ“€ Example Response

{
  "data": {
    "States": [
      {
        "id": 1,
        "name": "Lagos",
        "latitude": 6.5243793,
        "longitude": 3.3792057,
        "country_name": "Nigeria"
      }
    ]
  }
}
QUERYStatesByCountry(country_name: String)

Get all states for a specific country by country name.

πŸ“ Arguments

ArgumentTypeRequiredDescription
country_nameStringβœ“ YesFull country name (e.g., "Nigeria", "Canada")

πŸ“€ Example Response

{
  "data": {
    "StatesByCountry": [
      {
        "id": 53,
        "name": "Ahafo",
        "latitude": 7.5821372,
        "longitude": -2.5497463
      },
      {
        "id": 48,
        "name": "Ashanti",
        "latitude": 6.7470436,
        "longitude": -1.5208624
      }
    ]
  }
}
QUERYState(name: String)

Get detailed information about a specific state by name.

πŸ“ Arguments

ArgumentTypeRequiredDescription
nameStringβœ“ YesName of the state (e.g., "California", "Lagos")

πŸ“€ Example Response

{
  "data": {
    "State": {
      "id": 48,
      "name": "Ashanti",
      "latitude": 6.7470436,
      "longitude": -1.5208624,
      "country_name": "Ghana"
    }
  }
}

πŸ™οΈ Cities

QUERYCitiesByCountry(country_name: String)

Get all cities for a specific country. Returns city names with coordinates.

πŸ“ Arguments

ArgumentTypeRequiredDescription
country_nameStringβœ“ YesFull country name (e.g., "Nigeria", "USA")

πŸ“€ Example Response

{
  "data": {
    "CitiesByCountry": [
      {
        "id": 1,
        "name": "Abuja",
        "latitude": 9.05785,
        "longitude": 7.49508,
        "state_name": "Federal Capital Territory"
      },
      {
        "id": 2,
        "name": "Lagos",
        "latitude": 6.45407,
        "longitude": 3.39467,
        "state_name": "Lagos"
      }
    ]
  }
}
QUERYCitiesByState(state_name: String)

Get all cities within a specific state.

πŸ“ Arguments

ArgumentTypeRequiredDescription
state_nameStringβœ“ YesName of the state (e.g., "Lagos", "California")

πŸ“€ Example Response

{
  "data": {
    "CitiesByState": [
      {
        "id": 1,
        "name": "Kumasi",
        "latitude": 6.6666,
        "longitude": -1.6163,
        "country_name": "Ghana"
      },
      {
        "id": 2,
        "name": "Obuasi",
        "latitude": 6.2012,
        "longitude": -1.6912,
        "country_name": "Ghana"
      }
    ]
  }
}
QUERYCity(name: String)

Get detailed information about a specific city by name.

πŸ“ Arguments

ArgumentTypeRequiredDescription
nameStringβœ“ YesName of the city (e.g., "Toronto", "Lagos")

πŸ“€ Example Response

{
  "data": {
    "City": {
      "id": 1,
      "name": "Kumasi",
      "latitude": 6.6666,
      "longitude": -1.6163,
      "state_name": "Ashanti",
      "country_name": "Ghana"
    }
  }
}

🎨 Example Queries

Get countries by region with specific fields

{
  CountriesByRegion(region: "Oceania") {
    id
    iso2
    name
    emoji
    capital
    currency
    phone_code
  }
}

Get states within a country

{
  StatesByCountry(country_name: "Nigeria") {
    id
    name
    latitude
    longitude
  }
}

Get cities by state

{
  CitiesByState(state_name: "Lagos") {
    id
    name
    latitude
    longitude
    country_name
  }
}

πŸ’¬ Contributing & Support

This project is open source and contributions are welcome! Whether it's adding new data, improving performance, or fixing bugs β€” feel free to submit a pull request.

  • πŸ“¦ Packages: Available via npm/yarn for easy integration
  • πŸ“™ Docs: Full schema documentation available in the GraphQL playground
  • ⭐ Star on GitHub: Show your support by starring the repository
  • πŸ› Issues: Report bugs or request features via GitHub Issues

πŸ“œ License

MIT License β€” Free for personal and commercial use. Data provided as-is with no warranties. Attribution appreciated but not required. Original country/state/city data sourced from the countries-states-cities-database by Darshan Gada.