{"openapi":"3.1.0","info":{"title":"worldgovdata API","description":"Comparative country-data API. Metadata endpoints are free and may be called without credentials; row-returning endpoints need an API key (`Authorization: Bearer wgd_live_...`) and cost credits. Data is redistributable under the CC BY licence of each source; every response's `meta` carries the `licence` and `attribution` you must display. Do not use provider logos. See /v1/meta/freshness and /v1/indicators for per-source licence details.","version":"1.0"},"paths":{"/data/api/v1/countries":{"get":{"tags":["countries"],"summary":"List Countries","operationId":"list_countries_data_api_v1_countries_get","parameters":[{"name":"region","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Region as stored in the spine","title":"Region"},"description":"Region as stored in the spine"},{"name":"income_group","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Income group as stored in the spine","title":"Income Group"},"description":"Income group as stored in the spine"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/api/v1/countries/{iso3}":{"get":{"tags":["countries"],"summary":"Get Country","operationId":"get_country_data_api_v1_countries__iso3__get","parameters":[{"name":"iso3","in":"path","required":true,"schema":{"type":"string","title":"Iso3"}},{"name":"featured","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter topic items by the featured flag (featured=true is the slim payload country pages consume)","title":"Featured"},"description":"Filter topic items by the featured flag (featured=true is the slim payload country pages consume)"},{"name":"topic","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter topic items to a single topic","title":"Topic"},"description":"Filter topic items to a single topic"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/api/v1/indicators":{"get":{"tags":["indicators"],"summary":"List Indicators","operationId":"list_indicators_data_api_v1_indicators_get","parameters":[{"name":"topic","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Topic (data-driven, any value)","title":"Topic"},"description":"Topic (data-driven, any value)"},{"name":"provider","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Provider id filter","title":"Provider"},"description":"Provider id filter"},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tokenized id/name/description search","title":"Q"},"description":"Tokenized id/name/description search"},{"name":"featured","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter to featured indicators (ranking pages)","title":"Featured"},"description":"Filter to featured indicators (ranking pages)"},{"name":"projections","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"true = only indicators carrying projection/forecast years beyond their latest observed year; false = only fully observed series","title":"Projections"},"description":"true = only indicators carrying projection/forecast years beyond their latest observed year; false = only fully observed series"},{"name":"sort","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"name | coverage | latest | topic | source (default name)","title":"Sort"},"description":"name | coverage | latest | topic | source (default name)"},{"name":"dir","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"asc | desc — direction for `sort` (default: each sort's natural direction)","title":"Dir"},"description":"asc | desc — direction for `sort` (default: each sort's natural direction)"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":500,"minimum":1},{"type":"null"}],"description":"Cap the page size (meta.total holds the full match count)","title":"Limit"},"description":"Cap the page size (meta.total holds the full match count)"},{"name":"offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"description":"Rows to skip before the page (pagination; applied after ORDER BY, with limit)","title":"Offset"},"description":"Rows to skip before the page (pagination; applied after ORDER BY, with limit)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/api/v1/indicators/{indicator_id}":{"get":{"tags":["indicators"],"summary":"Get Indicator","operationId":"get_indicator_data_api_v1_indicators__indicator_id__get","parameters":[{"name":"indicator_id","in":"path","required":true,"schema":{"type":"string","title":"Indicator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/api/v1/data":{"get":{"tags":["data"],"summary":"Get Data","operationId":"get_data_data_api_v1_data_get","parameters":[{"name":"indicator","in":"query","required":true,"schema":{"type":"string","description":"Indicator id, e.g. wgi.control_of_corruption","title":"Indicator"},"description":"Indicator id, e.g. wgi.control_of_corruption"},{"name":"countries","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated ISO3 codes","title":"Countries"},"description":"Comma-separated ISO3 codes"},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"To"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"json","title":"Format"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/api/v1/rankings/{indicator}":{"get":{"tags":["rankings"],"summary":"Get Rankings","operationId":"get_rankings_data_api_v1_rankings__indicator__get","parameters":[{"name":"indicator","in":"path","required":true,"schema":{"type":"string","title":"Indicator"}},{"name":"year","in":"query","required":false,"schema":{"type":"string","default":"latest","title":"Year"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/api/v1/topics":{"get":{"tags":["topics"],"summary":"List Topics","operationId":"list_topics_data_api_v1_topics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/data/api/v1/meta/freshness":{"get":{"tags":["meta"],"summary":"Freshness","operationId":"freshness_data_api_v1_meta_freshness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/data/api/v1/meta/coverage":{"get":{"tags":["meta"],"summary":"Coverage","operationId":"coverage_data_api_v1_meta_coverage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/data/api/v1/ping":{"get":{"tags":["account"],"summary":"Ping","description":"Key liveness: who this key is, what it may do, what it has left (§2.1).\n\nFree and cheap on purpose — this is what a client calls at boot to fail fast\non a bad key, and what a support conversation starts with. The balance comes\nfrom the key resolution that already happened this request, so there is no\nextra query.","operationId":"ping_data_api_v1_ping_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/data/api/v1/usage":{"get":{"tags":["account"],"summary":"Usage","description":"The caller's own balance and recent usage (§2.1).\n\nThe same numbers the account page shows, reachable with the credential a\nclient already has, so that a script can watch its own burn rate without a\nsession and without the portal.","operationId":"usage_data_api_v1_usage_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/":{"get":{"summary":"Dashboard","operationId":"dashboard_admin__get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/admin/indicators":{"get":{"summary":"Indicators","operationId":"indicators_admin_indicators_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/admin/indicators/{indicator_id}/toggle":{"post":{"summary":"Toggle Indicator","operationId":"toggle_indicator_admin_indicators__indicator_id__toggle_post","parameters":[{"name":"indicator_id","in":"path","required":true,"schema":{"type":"string","title":"Indicator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/indicators/{indicator_id}":{"post":{"summary":"Edit Indicator","operationId":"edit_indicator_admin_indicators__indicator_id__post","parameters":[{"name":"indicator_id","in":"path","required":true,"schema":{"type":"string","title":"Indicator Id"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_edit_indicator_admin_indicators__indicator_id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/runs":{"get":{"summary":"Runs","operationId":"runs_admin_runs_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/admin/providers/{provider_id}/rerun":{"post":{"summary":"Trigger Rerun","operationId":"trigger_rerun_admin_providers__provider_id__rerun_post","parameters":[{"name":"provider_id","in":"path","required":true,"schema":{"type":"string","title":"Provider Id"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users":{"get":{"summary":"Users","description":"Search accounts by email, name or id.\n\nThe search is a plain ``LIKE`` on lower-cased text, not full-text: this table\nis thousands of rows, an operator is nearly always pasting a whole address\nfrom a support ticket, and an index that has to be maintained on every signup\nto make a rare query fast is the wrong trade.","operationId":"users_admin_users_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users/{user_id}":{"get":{"summary":"User Detail","description":"One account, end to end: profile, wallet, keys, ledger, orders, audit.\n\nSeven small queries rather than one join: they are independent, each is a\nsingle indexed lookup by ``user_id``, and a seven-way join would produce a\ncartesian product that the template would then have to unpick.","operationId":"user_detail_admin_users__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users/{user_id}/credits":{"post":{"summary":"Adjust Credits","description":"Grant or claw back credits by hand — the `manual` provider of D7.\n\nThis is what makes the product fully usable before Razorpay goes live, and\nwhat settles a support case afterwards. It writes a real\n``acct.credit_ledger`` row (kind ``admin_adjust``, ``ref_type`` ``admin``) so\nthe balance still equals the sum of the deltas, plus an ``acct.audit_log``\nentry naming the reason — the ledger says what moved, the audit row says why\nand who.\n\nA negative delta uses ``claw_back``, not ``debit``: an admin correcting a\nbalance downwards must not be refused because the customer has already spent\nsome of it, and ``claw_back`` clamps at the balance and reports the shortfall\ninstead of failing. The shortfall goes in the audit detail, because a\ncorrection that could not be fully applied is exactly the thing a human wants\nto see later.","operationId":"adjust_credits_admin_users__user_id__credits_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_adjust_credits_admin_users__user_id__credits_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/orders":{"get":{"summary":"Orders","operationId":"orders_admin_orders_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/usage":{"get":{"summary":"Usage","operationId":"usage_admin_usage_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/reconcile":{"get":{"summary":"Reconcile","operationId":"reconcile_admin_reconcile_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/admin/gdpr":{"get":{"summary":"Gdpr Queue","description":"Open subject-rights requests, oldest first (§8).\n\nRead-only apart from closing a request, and deliberately so. Erasure runs\nthrough ``app.accounts.gdpr.erase``, which will only act on a ``pending`` row\nit can claim and only after the user re-authenticated — an admin \"erase\"\nbutton here would bypass that confirmation, and Article 17 wants the subject's\nact, not ours. What an admin *does* need is the clock: the ``age_days`` column\nis the one-month response deadline made visible.","operationId":"gdpr_queue_admin_gdpr_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/admin/gdpr/{request_id}/close":{"post":{"summary":"Close Gdpr Request","description":"Record that a request was fulfilled (or could not be).\n\nOnly ``done`` and ``failed`` are accepted: ``pending`` and ``ready`` are\nstates the system sets, and letting an admin move a row backwards would make\nthe age column — the only evidence of when we responded — meaningless.","operationId":"close_gdpr_request_admin_gdpr__request_id__close_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_close_gdpr_request_admin_gdpr__request_id__close_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_adjust_credits_admin_users__user_id__credits_post":{"properties":{"delta":{"type":"integer","title":"Delta"},"reason":{"type":"string","title":"Reason","default":""},"idem":{"type":"string","title":"Idem","default":""}},"type":"object","required":["delta"],"title":"Body_adjust_credits_admin_users__user_id__credits_post"},"Body_close_gdpr_request_admin_gdpr__request_id__close_post":{"properties":{"status":{"type":"string","title":"Status"},"note":{"type":"string","title":"Note","default":""}},"type":"object","required":["status"],"title":"Body_close_gdpr_request_admin_gdpr__request_id__close_post"},"Body_edit_indicator_admin_indicators__indicator_id__post":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description","default":""},"unit":{"type":"string","title":"Unit","default":""}},"type":"object","required":["name"],"title":"Body_edit_indicator_admin_indicators__indicator_id__post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}