---
title: "Look up an IP address (path slug)"
method: GET
path: "/ip/v1/{ip}"
tags: ["IP"]
---

# Look up an IP address (path slug)

`GET /ip/v1/{ip}`

Returns the geolocation record for the IP address given as the path slug: location (continent, country, subdivision, city, coordinates, postal), connection (ASN, organization, domain), security signals, and timezone. Both IPv4 and IPv6 are accepted; a value that isn't a valid IP address returns HTTP 400 before any lookup, and a valid but unlocatable address (private/reserved) returns HTTP 400 with the reason in the message. Every response carries the full canonical key tree; a leaf that can't be resolved for an address ships as null. See https://restcountries.com/docs/ip for the full reference.

## Path parameters

- `ip` string, required

## Query parameters

- `response_fields` string
- `response_fields_omit` string
- `pretty` boolean

## Response `200`

Geolocation record for the resolved IP address, always a single object.

- IPLookupResponse
  - `data` object, required
    - `objects` IPRecord[], required
      - `ip` string — The IP address the record describes.
      - `type` 'IPv4' | 'IPv6'
      - `location` object
        - `label` string, nullable — Display-ready place label, degrading city to subdivision to country as values go unresolved; null only when nothing is nameable.
        - `continent` object
          - `name` string, nullable
          - `codes` object
            - `common` string, nullable — Two-letter continent code (e.g. NA, EU).
        - `country` object
          - `name` string, nullable
          - `codes` object
            - `alpha_2` string, nullable — ISO 3166-1 alpha-2 (two-letter) code.
          - `flag` object — Flag assets derived from the alpha-2 code, so every lookup ships identical values for a given country.
            - `emoji` string, nullable
            - `html_entity` string, nullable
            - `url_png` string, uri, nullable
            - `url_svg` string, uri, nullable
          - `attributes` object
            - `is_eu` boolean, nullable — Whether the country is an EU member; null when the data source doesn't report it.
        - `subdivision` object
          - `name` string, nullable
          - `codes` object
            - `common` string, nullable — Bare subdivision code (e.g. ON, ENG).
            - `iso_3166_2` string, nullable — Full ISO 3166-2 code (e.g. CA-ON, GB-ENG).
        - `city` object
          - `name` string, nullable
        - `coordinates` object
          - `lat` number, nullable
          - `lng` number, nullable
        - `postal` object
          - `code` string, nullable
      - `connection` object
        - `asn` object
          - `number` integer, nullable — Autonomous system number.
        - `organization` object
          - `name` string, nullable — Operator of the address block.
        - `domain` string, nullable
      - `security` object — Tri-state threat signals: true or false when the data source reports one, null when it can't say.
        - `tor` boolean, nullable
        - `proxy` boolean, nullable
        - `vpn` boolean, nullable
        - `anonymous` boolean, nullable
        - `data_center` boolean, nullable
      - `timezone` object
        - `id` string, nullable — Stable IANA timezone identifier (e.g. America/Los_Angeles).
        - `current` object — Moment-of-request values for the timezone.
          - `abbreviation` string, nullable
          - `offset` object
            - `seconds` integer, nullable
            - `iso_8601` string, nullable — UTC offset as +HH:MM / -HH:MM.
          - `attributes` object
            - `is_dst` boolean, nullable
    - `meta` ResultMeta
      - `total` integer, required — Number of objects returned.
      - `request_id` string, required
      - `duration` integer, required — Server-side processing time in milliseconds.

## Other responses

- `400` — Bad request. Malformed parameters or unsupported property.
- `401` — Unauthorized. Missing, invalid, expired, or revoked API key.
- `403` — Forbidden. The account is deleted, disabled, frozen, or pending approval; the request origin isn't in the key's allowed CORS origins; a paid-only field was used as a search, filter, or lookup target on a plan that doesn't include it; a limit above the plan's ceiling but within the paid maximum was requested on a non-paid plan; or the monthly quota has been exceeded past the soft-limit grace period.
- `404` — Not found. The route doesn't match any defined endpoint, the API isn't active, or listing isn't supported for this API version.
- `405` — Method not allowed. Every endpoint is GET-only.
- `410` — Gone. The requested API version is no longer active.
- `429` — Too Many Requests. Sustained traffic above the edge rate limit (20 requests per 10 seconds) is rejected by Cloudflare before the request reaches the API, so this response is generated at the edge and does not carry the standard JSON error envelope. Back off briefly and retry.
- `502` — Bad Gateway. The upstream IP geolocation service is unavailable (network failure, timeout, or a non-200 upstream status). Generic by design; no upstream detail is leaked. Retry shortly.

---

[API](https://skmtc.dev/restcountries/apis/rest-countries.md) · [All operations](https://skmtc.dev/restcountries/apis/rest-countries/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/restcountries/rest-countries/revisions/87a86bdd79f6/schema)
