Docs / Countries

Get a country

Returns one country by its ISO 3166-1 alpha-2 code.

GET/v1/countries/{code}
import { Client } from "@liveapiio/liveapi";

const client = new Client({ token: process.env.LIVEAPI_TOKEN });

const country = await client.country("TR", true);

Request

Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.

FieldTypeDescription
codestringISO country code, such as TR. Path parameter.
includestringOptional query value geoshape. Adds the GeoJSON geometry and its attribution.

Response

A 200 response uses one call. Includes names, capital, region, currencies, languages, calling code, and coordinates. With include=geoshape it also includes a Polygon or MultiPolygon stored separately in R2.

Errors

A failed request returns { "error": { "code", "message" } } and does not use a call.

StatusCodeWhen
404not_foundCountry not found.
401unauthorizedThe bearer token is missing or not recognized.

We value your privacy

We use necessary cookies to run this website. With your consent, we would also like to use analytics and marketing cookies. Read our cookie policy.