GeographQL API

⭐ Beginner's Pick Geocoding / No Auth Required Beginner HTTPS CORS
Free to Use Varies (check documentation)

Overview

GeographQL is a free GraphQL API that provides structured data about countries, states, and cities worldwide. Because it uses GraphQL, you can request exactly the fields you need in a single query, avoiding over-fetching. No authentication is required, making it a great starting point for location-aware apps.

💡

Beginner Tip

Use the GraphQL playground at the API endpoint to explore the schema and test queries before adding them to your code — it shows all available fields interactively.

Available Data

IP address details
latitude and longitude
city and country
timezone
ISP information
country name and code

Example Response

JSON Response
{
  "name": "Japan",
  "capital": "Tokyo",
  "population": 125800000,
  "region": "Asia",
  "languages": [
    "Japanese"
  ],
  "flag": "https://flagcdn.com/jp.svg",
  "currencies": [
    {
      "code": "JPY",
      "name": "Japanese yen"
    }
  ]
}

Field Reference

data.countries List of country objects matching the query.
data.countries[].name Official name of the country.
data.countries[].capital Capital city of the country.
data.countries[].states List of states or provinces within the country (if requested).
data.countries[].states[].cities List of cities within the state (if requested in the query).

Implementation Example

const url = "https://geographql.netlify.app/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

{"errors":[{"message":"Cannot query field ..."}]} The field name in your GraphQL query does not match the schema.
Open the GraphQL playground to browse the exact field names available in the schema.
Network error or CORS error in browser Direct browser requests may be blocked by CORS policy.
Send the GraphQL query from a server-side environment or use a proxy to avoid CORS restrictions.
Empty data object The filter value (e.g. country code) does not match any record.
Use ISO 3166-1 alpha-2 codes (e.g. "US", "GB") for country filters and verify spelling for state/city names.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 20/20
🔒 Security 15/15
🛠 Developer XP 20/20
✓ Reliability 7/15
Response Time 150ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS YES
Category Geocoding
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →