> ## Documentation Index
> Fetch the complete documentation index at: https://docs.greip.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Country Lookup

> This method allows you to retrieve detailed information about a country by providing its country code in the request.

The API returns valuable data, such as the country’s name, capital, population, region, and other relevant attributes, enabling you to enrich your applications with geographic context and enhance user experiences.

export const MCPCallout = () => {
  return <div class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-[rgba(192, 132, 252, 0.2)] bg-[rgba(192, 132, 252, 0.1)] dark:border-[#c084fc4d] dark:bg-[#c084fc1a] text-[#6005BB] dark:text-[#FFFFFF]" data-callout-type="callout">
      <div class="mt-0.5 w-4" data-component-part="callout-icon">
        <svg class="h-4 w-4 !m-0 shrink-0 bg-[#c084fc] [mask-image:url('https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/duotone/fire.svg')] [-webkit-mask-image:url('https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/duotone/fire.svg')] [mask-repeat:no-repeat] [-webkit-mask-repeat:no-repeat] [mask-position:center] [-webkit-mask-position:center]"></svg>
      </div>
      <div class="text-sm prose dark:prose-invert min-w-0 w-full [&_kbd]:bg-background-light dark:[&_kbd]:bg-background-dark text-[#6005BB] dark:text-[#FFFFFF]" data-component-part="callout-content">
        <span data-as="p">
          Want to skip the docs? Use the{" "}
          <a class="link mint-text-xs border-[#C792FC]" href="/docs-mcp-server">
            <b>MCP Server</b>
          </a>
        </span>
      </div>
    </div>;
};

export const Availability = ({plan, color}) => {
  const colorMap = {
    green: "text-green-700 dark:text-green-400",
    blue: "text-blue-700 dark:text-blue-400",
    purple: "text-purple-700 dark:text-purple-400"
  };
  return <div dir="ltr" data-orientation="horizontal" class="p-4 px-5 mt-0 md:mt-4 flex flex-col sm:flex-row flex-wrap gap-2 relative overflow-hidden rounded-2xl border border-gray-950/10 dark:border-white/10 my-0 bg-gray-50 dark:bg-white/5 dark:codeblock-dark text-gray-950 dark:text-gray-50 codeblock-light text-sm prose prose-gray dark:prose-invert font-semibold no-wrap-words">
      Endpoint availability:{" "}
      <span class={` ${colorMap[color]} flex-1`}>{plan}</span>
      <a class="custom-link text-xs" href="https://greip.io/detailed-pricing">
        Learn more
      </a>
    </div>;
};

### Query Parameters

<ParamField query="CountryCode" type="string" placeholder="The Country code" required>
  The `ISO 3166-1 alpha-2` format of the country code. [Learn more](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)

  Sample value: `GB`
</ParamField>

<ParamField query="params" type="string" placeholder="The params you want to use">
  The params command is used to determine the data you need in the response.

  Expected values: `language`, `flag`, `currency`, and/or `timezone`.

  Sample value: `language,currency,timezone`
</ParamField>

<ParamField query="format" type="string" default="JSON" placeholder="Response format">
  The format command is used to get a response in a specific format.

  Expected values: `JSON`, `XML`, `CSV`, or `Newline`

  For more information please refer to [Response Format](/options/response-format).
</ParamField>

<ParamField query="mode" type="string" default="live" placeholder="Environment">
  The mode command is used to in the development stage to simulate the integration process before releasing it to the production environment.

  Expected values: `live`, or `test`.

  For more information please refer to [Development Environment](/options/development-environment).
</ParamField>

<ParamField query="callback" type="string" placeholder="JSONP callback">
  The callback command can help you make the response as a JSONP format.

  Expected values: any name that can be used as a function name in Javascript, e.g: `myFunctionName`.

  For more information please refer to [JSONP Callback](/options/jsonp-callback).
</ParamField>

<Panel>
  <MCPCallout />

  <Availability plan="Free and above" color="green" />

  <ResponseExample>
    ```json Success theme={null}
    {
      "data": {
        "countryCode": "US",
        "countryName": "United States",
        "countryGeoNameID": 6252001,
        "capital": "Washington, D.C.",
        "population": 331000000,
        "phoneCode": "1",
        "currency": {
          "currencyName": "United States Dollar",
          "currencyCode": "USD",
          "currencySymbol": "$"
        },
        "language": {
          "name": "Portuguese",
          "code": "pt",
          "native": "Português"
        },
        "timezone": {
          "name": "America/Adak",
          "abbreviation": "HST",
          "offset": -36000,
          "currentTime": "11:51:19",
          "currentTimestamp": 1643406679,
          "isDST": false,
          "sunInfo": {
            "sunset": "08:17:34",
            "sunrise": "20:08:16",
            "transit": "02:12:55",
            "civilTwilightBegin": "19:47:39",
            "civilTwilightEnd": "08:38:10",
            "nauticalTwilightBegin": "19:22:22",
            "nauticalTwilightEnd": "09:03:28",
            "astronomicalTwilightBegin": "18:57:01",
            "astronomicalTwilightEnd": "09:28:49",
            "dayLength": "11:50:42"
          }
        },
        "flag": {
          "emoji": "🇺🇸",
          "unicode": "U+1F1FA U+1F1F8",
          "png": {
            "1000px": "https://www.gredev.io/img/flags/png1000px/us.png",
            "250px": "https://www.gredev.io/img/flags/png250px/us.png",
            "100px": "https://www.gredev.io/img/flags/png100px/us.png"
          },
          "svg": "https://www.gredev.io/img/flags/svg/us.svg"
        },
        "countryIsEU": false,
        "countryNeighbours": "CA,MX,CU",
        "tld": ".us",
        "continentName": "North America",
        "continentCode": "NA",
        "continentGeoNameID": 6255149
      },
      "status": "success",
      "executionTime": 0
    }
    ```

    ```json Error theme={null}
    {
      "status": "error",
      "code": 101,
      "type": "invalid_key",
      "description": "The API Key is missing or invalid."
    }
    ```
  </ResponseExample>
</Panel>
