Redirect Checker API
Follow every 301, 302, 307 and 308 redirect of a URL and get the full chain with status codes, the final URL and the number of hops.
Give a public url and the API follows its redirects one by one, recording each intermediate URL with its HTTP status code. The response contains the chain (every hop plus the final response), the final_url, final_status, the number of hops and the total response_ms.
Use it to verify HTTP to HTTPS and www to non-www redirects, to detect redirect loops or long chains that hurt SEO, and to resolve short links. Each redirect target is checked again, so redirects to private or internal hosts are refused.
At most 8 redirects are followed (more returns a too_many_redirects error), with a 10 second timeout overall. Only public http/https hosts on ports 80, 443, 8080 and 8443 are allowed.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
url | body|query | string | yes | Public http/https URL to trace (max 4096 characters). |
Example
curl "https://apibox.io.vn/v1/redirect-check?url=http://github.com" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/redirect-check?url=http://github.com', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/redirect-check?url=http://github.com",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/redirect-check?url=http://github.com');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"url": "http://github.com",
"final_url": "https://github.com/",
"final_status": 200,
"hops": 1,
"chain": [
{
"url": "http://github.com/",
"status": 301
},
{
"url": "https://github.com/",
"status": 200
}
],
"response_ms": 320
}
Use cases
- Verify HTTP to HTTPS and www redirects after a migration
- Find long redirect chains and loops that waste crawl budget
- Expand short links to see where they really go
- Monitor that old URLs still 301 to the right pages
FAQ
How many redirects are followed?
Up to 8. If a URL redirects more often, the API returns a 502 error with code too_many_redirects.
Does it show the status code of each redirect?
Yes. Every entry of chain has the URL and its status (301, 302, 307, 308...); the last entry is the final response.
Can I expand a shortened URL?
Yes. Pass the short link as url; final_url is the destination.
Related APIs
URL Metadata
Fetch any URL and get its title, description, Open Graph and Twitter Card tags, favicon, canonical, feeds and JSON-LD as JSON.
H:HTTP Headers
See the HTTP status and every response header of a URL, with a summary of security headers like HSTS, CSP and X-Frame-Options.
BOTrobots.txt Parser
Fetch and parse the robots.txt of any site into user-agent groups, allow/disallow rules and sitemaps, and test if a path is crawlable.