GET /api/url-resolve

URL Resolve

Trace the full redirect chain of a URL. Returns every hop in order, the final resolved URL, the number of redirects followed, and any error that stopped resolution. Follows up to 10 redirects.

Query parameters

urlrequiredThe URL to resolve. Scheme may be http or https; if omitted, https is assumed.

Example request

curl

curl "https://tinyutils.dev/api/url-resolve?url=http://example.com"

JavaScript (fetch)

const res = await fetch(
  "https://tinyutils.dev/api/url-resolve?url=http://example.com"
);
const data = await res.json();

Example response

{
  "input_url": "http://example.com",
  "final_url": "https://www.example.com/",
  "redirect_count": 2,
  "redirect_chain": [
    { "url": "http://example.com", "status": 301 },
    { "url": "https://example.com", "status": 301 },
    { "url": "https://www.example.com/", "status": 200 }
  ],
  "error": null
}

Error response

{
  "input_url": "http://notexist.example.com",
  "final_url": null,
  "redirect_count": 0,
  "redirect_chain": [],
  "error": "request_failed"
}

Error codes

invalid_urlThe URL is missing, malformed, or empty.
unsupported_protocolThe URL uses a protocol other than http or https.
blocked_hostThe target resolves to a private, reserved, or internal address.
redirect_loopA redirect loop was detected.
too_many_redirectsThe redirect chain exceeded the 10-hop limit.
missing_locationA redirect response was missing the Location header.
timeoutA hop or the overall resolution exceeded the time budget.
request_failedA network error prevented a hop from completing.
rate_limitedYou have exceeded the daily request limit.
internal_errorAn unexpected server error occurred.

Rate limiting

Requests are rate-limited via a global pool shared with url-check and dns-lookup. Successful resolutions and deterministic redirect errors (redirect_loop, too_many_redirects, and missing_location) are cached for 60 seconds. Transient failures (timeout, request_failed) and blocked_host results are not cached. When the limit is exceeded, the endpoint returns HTTP 429 with rate_limited.

Batch endpoint

Resolve up to 10 URLs in a single request.

MethodPOST
Path/api/url-resolve/batch

curl

curl -X POST "https://tinyutils.dev/api/url-resolve/batch" \
  -H "Content-Type: application/json" \
  -d '{"urls":["http://example.com","http://openai.com"]}'

JavaScript (fetch)

const res = await fetch("https://tinyutils.dev/api/url-resolve/batch", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ urls: ["http://example.com", "http://openai.com"] }),
});
const data = await res.json();

See also

Looking for use-case guidance? Find the final URL after a redirect walks through common redirect-following scenarios and integration patterns.