Documentation / Getting started
Getting started
Reference
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
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
Now check that it works. /v1/ping is free — it tells you the key resolved, and what it resolved to.
Verify the 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 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
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
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
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
The arithmetic and three fuller worked examples are on Credits.
Next
Base URL for all of the above: https://api.worldgovdata.com/v1