For your terminal & scripts

Useful answers. Simple requests.

Use myip.dk from curl, PowerShell, JavaScript, and scripts. Explore the IP, DNS, and network lookup APIs and their rate limits.

The current request determines the reported address. Requests from a VPS, CI runner, or proxy return that connection’s public address.

Your public address

A plain-text response for shell scripts. This endpoint works regardless of your user agent.

curl --fail --silent --show-error https://myip.dk/api/raw-ip

Choose IPv4 or IPv6

Force the address family on the client. The command fails if that route is unavailable.

curl -4 --fail https://myip.dk/api/raw-ip
curl -6 --fail https://myip.dk/api/raw-ip

Structured JSON

Returns the address family, IP address, and availability for the current request.

curl --fail https://myip.dk/api/ip

Illustrative JSON response (documentation address):

{ "family": "ipv4", "ip": "203.0.113.42", "available": true }

PowerShell

Read the JSON response and select the IP property.

(Invoke-RestMethod -Uri "https://myip.dk/api/ip").ip

DNS records

Choose A, AAAA, MX, TXT, NS, CAA, SOA, PTR, CNAME, SRV, HTTPS, or SVCB. Resolver options are cloudflare and google.

curl --fail --get https://myip.dk/api/dns \
  --data-urlencode "name=example.com" \
  --data-urlencode "type=MX" \
  --data-urlencode "resolver=cloudflare"

Request headers

Returns the browser-chosen headers of the current request, such as User-Agent and Accept-Language.

curl --fail https://myip.dk/api/headers

IP network lookup

Look up registration data from the responsible regional registry and reverse DNS. Routing enrichment is optional; inspect each source status.

curl --fail --get https://myip.dk/api/lookup \
  --data-urlencode "ip=1.1.1.1"

Rate limits and error handling

Address endpoints share an allowance of 20 requests in a burst, refilling at one request per minute. DNS and IP lookup tools share a separate allowance of 60 requests, refilling at six per minute. Both are per observed client IP, so people behind the same public address share the relevant allowance. A resolver comparison uses two requests; a full DNS overview uses ten.

On HTTP 429, wait for the number of seconds in the Retry-After response header. Handle non-success status codes before parsing the body, use a timeout, and avoid tight polling loops. The API does not require a key.

StatusMeaningWhat to do
400Invalid or unsupported inputCheck the address, name, type, and resolver.
429Client rate limit reachedRespect Retry-After before retrying.
502 / 503 / 504Upstream or temporary service problemBack off and retry later.

Cross-origin browser access is restricted to this site’s configured origins. These examples are intended for terminal and server-side use. This community tool has no uptime guarantee.

Reliable scripting patterns →