Skip to content
worldgovdata
Documentation / Getting started

Getting started

Quickstart

Five steps from nothing to a real time series on your disk. Every command below is copy-pasteable as written.

You can skip to step 5 if you only need the catalogue: search, indicator metadata, coverage and freshness are free and need no key at all.

Step 1

Create an account

Go to worldgovdata.com/signup and register with an email address and a password of at least ten characters. Nothing is charged and no card is asked for.

Signing up costs you an email address. That is the whole toll: there is no sales call, no trial clock, and no card on file.

Step 2

Verify your email

Open the link we send you. Verification is what releases the free grant of 2,000 credits — roughly 200,000 observation rows — and it is also what moves you off the anonymous rate-limit tier.

No email? Check spam, then request another from account settings. Resends are limited to five an hour per address.

Step 3

Create an API key

Go to account → keys and create one. Name it after the thing that will use it — laptop, nightly-etl, staging — because that name is the only thing you will have to go on when you decide which key to revoke.

A key looks like this. The middle segment is a public id; the long tail is the secret.

Key format

wgd_live_<12-char id>_<40-char secret>

You may hold up to 10 active keys. Use different keys for different deployments, so revoking one never takes down the rest.

Step 4

Put it in your environment

Never in the source file. Every sample on this site reads WGD_API_KEY from the environment, and so should your code.

Shell

export WGD_API_KEY="wgd_live_7k2m9xq4b3dv_Yb2Nq…"

Now check that it works. /v1/ping is free — it tells you the key resolved, and what it resolved to.

Verify the key

curl -sS -i "https://api.worldgovdata.com/v1/ping" \
  -H "Authorization: Bearer $WGD_API_KEY"

A 200 means you are set. A 401 invalid_key means the string is wrong, truncated, or the key has been revoked — one code covers all of those on purpose, so check what you pasted rather than guessing which of them it is.

Step 5

Make the call

This asks for control of corruption across five countries, 2000 to 2024 — 125 rows, which is 2 credits.

Request

curl -sS "https://api.worldgovdata.com/v1/data?indicator=wgi.control_of_corruption&countries=IND,CHN,USA,DEU,JPN&from=2000&to=2024" \
  -H "Authorization: Bearer $WGD_API_KEY"

Response · 200

{
  "data": [
    { "iso3": "CHN", "year": 2000, "value": 47.6, "ci_lo": 38.1, "ci_hi": 57.0 },
    { "iso3": "CHN", "year": 2001, "value": 48.2, "ci_lo": 38.9, "ci_hi": 57.4 },
    // … CHN through 2024, then DEU, IND, JPN, USA — ordered by iso3, then year
    { "iso3": "USA", "year": 2024, "value": 87.1, "ci_lo": 78.4, "ci_hi": 94.2 }
  ],
  "meta": {
    "generated_at": "2026-07-28T09:14:02.481932+00:00",
    "indicator": "wgi.control_of_corruption",
    "count": 125,
    "licence": "CC BY 4.0",
    "attribution": "World Bank — Worldwide Governance Indicators",
    "from": 2000,
    "to": 2024
  }
}

data is the rows, ordered by iso3 then year. value, ci_lo and ci_hi are nullable — a country with no reading for a year still appears if the provider published a row for it, so check for null rather than assuming a number.

meta carries the two fields you are legally obliged to use: licence and attribution. Do not discard them.

Reading what came back

The body is only half the answer. The response headers tell you what it cost and how much room you have left.

Response headers

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: private, no-store
X-Request-Id: 0f3a91c4e2b7
X-RateLimit-Limit: 600
X-RateLimit-Remaining: 594
X-RateLimit-Reset: 1785315600
X-Credits-Charged: 2
X-Credits-Remaining: 24998
  • X-Credits-Charged — what this request cost. Always present when you sent a key, including when it is 0: a free endpoint and a failed request both report 0 rather than omitting the header.
  • X-Credits-Remaining — your balance afterwards. Watch this rather than polling /v1/usage; it is free and it is already in the response you asked for.
  • X-RateLimit-Remaining — requests left in the current minute.
  • X-Request-Id — quote it if you ever need to ask us what happened.

To see them yourself on any call:

Headers only

curl -sS -D - -o /dev/null \
  "https://api.worldgovdata.com/v1/rankings/wgi.control_of_corruption" \
  -H "Authorization: Bearer $WGD_API_KEY"

Want a file instead of JSON?

/v1/data takes format=csv and streams a plain CSV with the header iso3,year,value,ci_lo,ci_hi. Same cost, same licence obligations.

CSV to a file

curl -sS "https://api.worldgovdata.com/v1/data?indicator=wdi.gdp_per_capita_ppp&countries=IND,CHN,USA&from=2000&to=2024&format=csv" \
  -H "Authorization: Bearer $WGD_API_KEY" \
  -o gdp_per_capita.csv

What you just spent, and what you did not

Finding the indicator cost nothing. Everything that helps you decide what to buy is free: searching the catalogue, reading an indicator’s metadata, listing countries, checking provider freshness. Credits are only spent when observation rows come back.

You can also count before you commit. Ask for a single country first and read meta.count — one credit tells you how large the full pull will be.

Estimate first

# How many rows before you spend anything: ask for one country, read meta.count.
curl -sS "https://api.worldgovdata.com/v1/data?indicator=wdi.gdp_per_capita_ppp&countries=IND" \
  -H "Authorization: Bearer $WGD_API_KEY" | jq '.meta.count'

The arithmetic and three fuller worked examples are on Credits.

Next