Langsung ke konten
POST AI agent ready /v1/link/expand

Link Expand API - Resolve Short URLs and Redirect Chains

Follows up to 10 HTTP redirects manually, recording each hop with its URL and status code. Returns the original URL, the final URL, the full hop array, and the redirect count. Useful for unshortening bit.ly, t.co, and tracking redirects without loading the destination in a browser.

Parameters

stringrequired

Short or redirecting URL to expand.

Code examples

curl -X POST https://api.botoi.com/v1/link/expand \
  -H "Content-Type: application/json" \
  -d '{"url":"https://bit.ly/3xE4AbC"}'

When to use this API

Safety-check links before following them

When a user-submitted short URL arrives in your app, expand it first. Display the final destination in the preview so users know where a click actually lands. Works well alongside /v1/phishing/check.

Attribute traffic past redirectors

When a campaign links to bit.ly/campaign, expand the link at ingest time to capture the real destination URL. Keeps your analytics accurate even when the shortener changes its target later.

Detect affiliate-link hijacking

Periodically expand each of your affiliate links. If the final URL changes from the expected merchant domain, something in the chain has been replaced (DNS hijack, compromised shortener).

Frequently asked questions

What is the redirect hop limit?
Up to 10 hops. Chains longer than 10 terminate at hop 10, and the final field contains the last reached URL. Malicious chains that bounce between redirectors to evade scanners are stopped by this limit.
Does it follow meta-refresh or JavaScript redirects?
No. Only HTTP Location headers (3xx responses) are followed. Client-side meta-refresh tags and JavaScript window.location redirects require a headless browser.
What happens if the shortener is down?
If the first hop fails entirely, the endpoint returns FETCH_FAILED with status 500. If it fails after at least one successful hop, partial results are returned with the accumulated hop chain.
Are relative redirects handled?
Yes. Relative Location headers (Location: /new-path) are resolved against the current URL using the WHATWG URL spec, then followed.
How is this different from /v1/redirect-trace?
/v1/link/expand returns just URL + status per hop. /v1/redirect-trace adds timing data, response size per hop, and final headers. Use expand for fast unshortening and trace for debugging.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.