---
title: "Returns a country for the selected IP."
method: GET
path: "/{ip}/country"
tags: ["single"]
---

# Returns a country for the selected IP.

`GET /{ip}/country`

## Request

- Base URL: `https://ipinfo.io`
- URL: `https://ipinfo.io/{ip}/country`
- Auth: one of:
  - HTTP basic
  - HTTP bearer
  - API key in query parameter `token`
- TypeScript: <https://skmtc.dev/ipinfo/apis/ipinfo-io-openapi-specification/docs/:ip/country/get.ts> (a function with typed inputs; its response is checked against the schema)

Returns a country for the selected IP in two letter ISO-3166 format. If the country is not available, it will return an empty string.

## Path parameters

- `ip` string, required

## Response `200`

Name of the country in the 2 letter ISO 3166-1 alpha-2 for the IP address.

## Other responses

- `400`: If users try to access a field type that does not exist or do not have permissions to access it, they will encounter a wrong module or field type error.
- `403`: Unknown token or invalid permission. We return the same error for blocking malicious IP addresses as well.
- `404`: Wrong ip. Please provide a valid IP address.
- `429`: Allocated API rate limit has been reached for the token. The user will be prompted with options to increase their API limit.
- `500`: Internal server error or server unavailable.

---

[API](https://skmtc.dev/ipinfo/apis/ipinfo-io-openapi-specification.md) - [All operations](https://skmtc.dev/ipinfo/apis/ipinfo-io-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/ipinfo/apis/ipinfo-io-openapi-specification/revisions/c63f11e4f26e?raw)
