CSC

Playground

Run authenticated CountryStateCity REST requests and copy SDK-ready examples.

Use your API key to run a request against the current origin. The key stays in component memory and is not stored in local storage, cookies, or the URL.

Hosted API playground

Requests run in your browser; the key is never persisted.

v1 · ODbL metadata included
GET
cURL
curl 'https://countrystatecity.tansuasici.com/api/v1/countries?limit=3&fields=id,name,iso2,capital' -H 'x-api-key: YOUR_API_KEY'
Response
{
  "data": [
    {
      "id": 225,
      "name": "Türkiye",
      "iso2": "TR",
      "capital": "Ankara"
    }
  ],
  "meta": {
    "apiVersion": "v1",
    "dataVersion": "sha256:…",
    "pagination": {
      "total": 250
    }
  }
}

JavaScript

const response = await fetch('https://countrystatecity.tansuasici.com/api/v1/countries?limit=3', {
  headers: { 'x-api-key': process.env.CSC_API_KEY! },
});

if (!response.ok) throw new Error(`CountryStateCity API: ${response.status}`);
const { data, meta } = await response.json();

Python

import os
import requests

response = requests.get(
    "https://countrystatecity.tansuasici.com/api/v1/countries",
    params={"limit": 3, "fields": "id,name,iso2"},
    headers={"x-api-key": os.environ["CSC_API_KEY"]},
    timeout=10,
)
response.raise_for_status()
payload = response.json()

See the REST reference for endpoints and Limits & policy for versioning, quotas, and cache behavior.