StatsHub Docs
Endpoint referenceCountry

/country/{slug}

The legacy file is named [id].ts but reads `query.slug`.

GET
/api/v2/country/{slug}

The legacy file is named [id].ts but reads query.slug. Under Next.js req.query merges the path parameter under its filename — id — so slug only ever arrives from the query string, and the path segment is ignored.

Verified against production: /api/country/spain is 404 for every value of the path segment, while /api/country/anything?slug=spain returns Spain. This looks like a bug and is kept anyway, because a client that today gets a 404 would start getting a row. Changing it is a product decision, not a port one.

Path Parameters

slug*string

Query Parameters

slug?string

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

curl -X GET "https://example.com/api/v2/country/string"
{  "$schema": "https://example.com/schemas/Countries.json",  "alpha2": "string",  "name": "string",  "slug": "string"}