---
title: "Top N countries by GDP per capita or population for a year"
method: GET
path: "/api/v1/research/maddison/top"
tags: ["Research"]
---

# Top N countries by GDP per capita or population for a year

`GET /api/v1/research/maddison/top`

Ranks Maddison Project Database countries by a variable in descending order for one year. Answers questions like `which 10 countries had the highest GDP per capita in 1913?` without requiring the caller to pull the full panel and sort locally. Variable must be one of `gdppc` (GDP per capita in 2011 international dollars, PPP) or `pop` (population in thousands). Published under CC BY 4.0 by Bolt and van Zanden at the University of Groningen.

## Query parameters

- `variable` string — Variable to rank by. Accepted: `gdppc` or `pop`.
- `year` integer, required — Year to rank by. Must be within the workbook range (1 AD through 2022).
- `limit` integer — Maximum rows to return (1 to 50). Defaults to 10.

## Response `200`

Descending ranking of countries with their iso3, country, region, and variable value.

- EnvelopeMaddisonTopPayload
  - `data` MaddisonTopPayload, required — Top-N countries by a Maddison variable for a given year.
    - `variable` string, required — Variable used for ranking (`gdppc` or `pop`).
    - `unit` string, required — Unit of measure for `value`.
    - `year` integer, required — Year the ranking applies to.
    - `limit` integer, required — Maximum rows requested (1 to 50).
    - `ranking` MaddisonTopRow[], required — Descending ranking, rank 1 = highest value.
      - `rank` integer, required — 1-indexed descending rank.
      - `iso3` string, nullable — ISO 3166-1 alpha-3 country code.
      - `country` string, nullable — English country name.
      - `region` string, nullable — Maddison analytical region label.
      - `region_slug` string, nullable — Stable slug form of the region.
      - `value` number, nullable — Variable value for this country in the requested year.
    - `count` integer, required — Number of rows returned (may be smaller than `limit`).
  - `meta` SugraMeta, required — Metadata attached to every /api/v1/* response envelope.
    - `endpoint` string, required — Requested endpoint path.
    - `data_time` string, required — ISO 8601 UTC timestamp of the source data, not of the request.
    - `response_time` string, required — ISO 8601 UTC timestamp when this response was produced.
    - `provider` string, required — API name and version.
    - `source` string, nullable — Identifier of the primary upstream source used for this response.
    - `attribution` string, nullable — Human-readable attribution mandated by an upstream source (e.g. a securities regulator or self-regulatory organization). Present only on responses whose source requires the owner and source to be clearly identified. Do not remove or alter it when using the response.
    - `fallback_used` boolean, nullable — True when the primary source failed and a fallback produced the data.
    - `fallback_chain` string[], nullable — Ordered list of sources attempted, in the order they were tried.
    - `cached` boolean, nullable — True when this response was served from the internal cache.
    - `stale` boolean, nullable — True when the cached response was returned after the upstream rate-limited or errored. Clients can use this to detect degraded data.

## Other responses

- `401` — Missing or invalid `x-api-key` header.
- `422` — Validation Error
- `429` — Daily rate limit exceeded. Check `X-RateLimit-Reset` for the next window.
- `503` — Upstream source is temporarily unavailable. Retry after a short delay.

---

[API](https://skmtc.net/sugra/apis/sugra-api.md) · [All operations](https://skmtc.net/sugra/apis/sugra-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sugra/sugra-api/versions/4e2740743eb4/schema)
