Graph Countries API

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

Overview

Graph Countries API provides rich country data including currencies, languages, flags, bordering countries, and regional groupings via GraphQL. It is completely free with no authentication required, making it ideal for learning or building geography-based features. Send a GraphQL query to retrieve exactly the fields you need.

Beginner Tip

This API uses GraphQL instead of REST, so you send a POST request with a JSON body containing your query. Use the GraphQL playground at the GitHub project to explore available fields before writing code.

Available Data

translated text
source language
target language
confidence score
country name and code
population

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 Top-level GraphQL response containing your requested data.
data.country.name The full English name of the country.
data.country.capital The capital city of the country.
data.country.currency Currency code used in the country, e.g. USD, EUR.
data.country.languages List of language objects with name and native name fields.
data.country.emoji Flag emoji representing the country.

Implementation Example

Request
const url = "https://github.com/lennertVanSever/graphcountries";
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

400 Bad Request Malformed GraphQL query syntax or missing required fields.
Validate your query in the GraphQL playground. Ensure you use double quotes inside the query and escape them correctly in shell.
null field value Requested a field that is not available for a particular country.
Check the schema in the playground to see which fields are available. Handle null values gracefully in your code.
Network Error / CORS Browser-side requests may be blocked depending on the endpoint used.
Use server-side requests or look for an alternative REST mirror of this dataset if CORS is an issue.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

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

Related Tags

Similar APIs

View All →