Skip to content
worldgovdata
Documentation / Getting started

Documentation

worldgovdata API

Comparative country statistics — governance, economy, health, climate and nine other topics — harmonised onto one country spine, served as JSON or CSV from a single versioned base URL.

Every endpoint is a GET. Browsing the catalogue is free. You only spend credits when rows of actual data come back.

The base URL

There is one public base URL, and it is the only one. Everything below is relative to it.

Base URL

https://api.worldgovdata.com/v1

The version lives in the path. /v1 will not change shape underneath you: fields are added, never removed or renamed. A breaking change would arrive as /v2.

Sixty seconds

The catalogue endpoints need no credentials at all, so the first call works before you have an account. This one asks the country spine for South Asia.

No key required

curl -sS "https://api.worldgovdata.com/v1/countries?region=South%20Asia"

Response · 200

{
  "data": [
    {
      "iso3": "AFG",
      "iso2": "AF",
      "m49": 4,
      "name": "Afghanistan",
      "official_name": "Islamic Republic of Afghanistan",
      "region": "South Asia",
      "subregion": "Southern Asia",
      "income_group": "Low income",
      "wb_code": "AFG",
      "capital": "Kabul",
      "wikidata_id": "Q889",
      "flag_emoji": "🇦🇫"
    },
    {
      "iso3": "BGD",
      "iso2": "BD",
      "m49": 50,
      "name": "Bangladesh",
      "official_name": "People's Republic of Bangladesh",
      "region": "South Asia",
      "subregion": "Southern Asia",
      "income_group": "Lower middle income",
      "wb_code": "BGD",
      "capital": "Dhaka",
      "wikidata_id": "Q902",
      "flag_emoji": "🇧🇩"
    }
    // … 6 more, ordered by name
  ],
  "meta": {
    "generated_at": "2026-07-28T09:14:02.481932+00:00",
    "count": 8,
    "region": "South Asia"
  }
}

Lines beginning // in the samples on this site mark where a real response was trimmed for reading. The API never returns comments.

To fetch observations rather than metadata you need a key. That is five minutes, and the quickstart walks the whole path — sign up, verify, create a key, make the first metered call, read the result.

The three things you need first

How a response is shaped

Every JSON response is the same two keys. data is the payload — an array for list endpoints, an object for detail endpoints. meta describes the request that produced it and always carries generated_at.

Success envelope

{
  "data": [ /* rows, or a single object */ ],
  "meta": {
    "generated_at": "2026-07-28T09:14:02.481932+00:00",
    "count": 8
    // … the filters you sent, echoed back
  }
}

meta omits any field you did not send, so a key being absent means “not applied”, never “null”. Failures replace the whole body with a single error object:

Error envelope

{
  "error": {
    "code": "indicator_not_found",
    "message": "Unknown indicator: wdi.gdpp"
  }
}

Branch on error.code, never on error.message — the message is written for a human and may be reworded. Some codes add fields: a 402 carries required and balance, a 429 carries retry_after. The full list is on Errors.

What each route costs

Metadata is free and callable anonymously; the endpoints that return rows of observations cost credits. One credit is 100 rows.

Credit cost of every public route
RouteCredits
GET /v1/countriesfree
GET /v1/countries/{iso3}1
GET /v1/indicatorsfree
GET /v1/indicators/{id}free
GET /v1/topicsfree
GET /v1/meta/freshnessfree
GET /v1/meta/coveragefree
GET /v1/rankings/{indicator}1
GET /v1/datamax(1, ceil(rows / 100))
GET /v1/usagefree
GET /v1/pingfree

A request that ends in an error costs nothing — including a too_many_rows rejection, which is counted before any data is read. New accounts get 2,000 credits at email verification. Full detail on Credits.

The data model, in four nouns

  • Country — the spine. Keyed by ISO 3166-1 alpha-3 (IND, CHN), carrying region, subregion, income group, M49 and the World Bank code. Every observation hangs off one of these. Reference
  • Indicator — one measured series, with an id like wgi.control_of_corruption: a provider prefix, a dot, a slug. Carries its unit, topic, direction (higher_is_better), coverage and, critically, the licence and attribution you must display. Reference
  • Observation — one country, one indicator, one year, one value, sometimes a confidence interval. This is the atom, and /v1/data is how you get them. Reference
  • Ranking — every country ordered on one indicator for one year, pre-computed, with the rank and the size of the ranked field. Reference

Topics group indicators into thirteen themes. Ask /v1/topics rather than hardcoding the list — it is data, and it grows.

Conventions

  • Read-only. Every route is a GET. Anything else returns 405 method_not_allowed.
  • Ids are exact. Indicator ids are case-sensitive; ISO3 country codes are upper-cased for you.
  • Cacheable — by you. An anonymous /v1 GET returns public, max-age=3600, s-maxage=21600. An authenticated one returns private, no-store, because it carries your balance and your remaining quota and must not sit in a shared cache. Cache it in your own application anyway: behind this data are pipelines that run daily at fastest and annually at slowest, and a response you did not re-request costs no credit.
  • Compressed. Send Accept-Encoding: gzip and responses over roughly half a kilobyte come back gzipped. Every HTTP client does this by default.
  • CORS is open, credentials are not. Any origin may call the API, but cookies are never accepted. Which is also why a key must never be in browser code — see Authentication.
  • One hard cap. A single /v1/data request will not return more than 100,000 rows. Pagination has the recipe for fetching more than that.

Before you publish anything

The data is not ours. Each indicator arrives under its provider’s licence — most commonly CC BY — and every response tells you which: meta.licence and meta.attribution on the data endpoints, data.licence and data.attribution on the indicator record.

Where to go next