# URL Unshortener & Link Preview: Expand Short Links API (`zaiq/url-unshortener`) Actor

Expand short links in bulk (bit.ly, t.co, tinyurl and any other) and follow every redirect, including meta-refresh and JavaScript hops. Each link gets its final URL, every hop with its status code, and a preview of the page: title, description, image and site name. No login.

- **URL**: https://apify.com/zaiq/url-unshortener.md
- **Developed by:** [Zaiq](https://apify.com/zaiq) (community)
- **Categories:** Developer tools, SEO tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 resolved urls

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## URL Unshortener & Link Preview API: expand short links, every redirect hop, page preview

![URL Unshortener & Link Preview: Expand Short Links API](https://api.apify.com/v2/key-value-stores/4VJNANhwKgqPpXtAi/records/hero-url-unshortener.jpg)

Expand **short links in bulk**: **bit.ly, t.co, tinyurl, lnkd.in, ow.ly, buff.ly, rebrand.ly, cutt.ly** and any other link that redirects. Each link is followed **hop by hop**, including the **meta-refresh and JavaScript hops** that t.co and others use, and the **preview pages** some shorteners show, to its **final URL**, with **every hop's status code**.

Each row also carries a **link preview** of the page it ends on: **title, description, image, site name, canonical URL, favicon and language**. Built for **marketing and social teams** cleaning tracked links, **ad and link-safety checks**, **SEO redirect audits**, **data pipelines** and **AI agents**. From **$0.30 per 1,000 links**, preview included.

### What you get

| Field | What it holds |
|---|---|
| Final address | `finalUrl`, `finalDomain`, `finalStatus`, `redirectCount`, `contentType` |
| Every hop | `hops`: `url`, `status`, `redirectTo`, `via` (301, 302, 303, 307, 308, meta refresh, javascript, shortener preview page) |
| Preview | `title`, `description`, `image`, `siteName`, `type`, `canonicalUrl`, `favicon`, `language` |
| Checks | `isShortLink`, `inputDomain`, `loop`, `tooManyRedirects`, `stoppedAtShortener`, `note` |
| Run facts | `status` (ok, invalid, failed), `error`, `route`, `resolvedAt` |

### What people use it for

- **Link cleaning:** turn tracked short links into the real address before you store or share them
- **Link safety:** see where a short link really goes, and whether the shortener has flagged it
- **SEO redirect audits:** every hop and status code for a list of old URLs
- **Social listening:** expand the t.co and lnkd.in links in posts to the articles they point to
- **Link previews:** title, description and image for cards in your app or newsletter
- **AI agents:** know what a link is before reading it

### How to use it

1. Paste **links**, one per line (short or not).
2. Keep **Read the final page's preview** on for title, description and image.
3. Click **Start**. Each link gets one row.

### Input

| Field | Example | Notes |
|---|---|---|
| Links | `https://bit.ly/...`, `https://t.co/...`, `example.com/page` | Up to 10,000; a missing https:// is added |
| Read the final page's preview | on | Included in the price |
| Most redirects to follow | `15` | Up to 30; loops are caught |

### Output

Each result is one row in the run's dataset (download it as JSON, CSV, Excel, XML or HTML, or read it through the API). An example row (values shortened):

```json
{
  "url": "https://bit.ly/example-link",
  "index": 0,
  "isShortLink": true,
  "inputDomain": "bit.ly",
  "finalUrl": "https://example.com/blog/sample-post?utm_source=newsletter",
  "finalDomain": "example.com",
  "finalStatus": 200,
  "redirectCount": 2,
  "hops": [
    {
      "url": "https://bit.ly/example-link",
      "status": 301,
      "redirectTo": "http://example.com/blog/sample-post?utm_source=newsletter",
      "via": "301"
    },
    {
      "url": "http://example.com/blog/sample-post?utm_source=newsletter",
      "status": 301,
      "redirectTo": "https://example.com/blog/sample-post?utm_source=newsletter",
      "via": "301"
    },
    {
      "url": "https://example.com/blog/sample-post?utm_source=newsletter",
      "status": 200,
      "redirectTo": null,
      "via": null
    }
  ],
  "contentType": "text/html",
  "loop": false,
  "tooManyRedirects": false,
  "stoppedAtShortener": false,
  "title": "Sample post title",
  "description": "A short description of the sample post.",
  "image": "https://example.com/images/sample-post.jpg",
  "siteName": "Example Blog",
  "type": "article",
  "canonicalUrl": "https://example.com/blog/sample-post",
  "favicon": "https://example.com/favicon.ico",
  "language": "en",
  "status": "ok",
  "note": null,
  "resolvedAt": "2026-11-07T10:40:12Z"
}
```

A record named `SUMMARY` in the run's key-value store says what each input returned, with any notes (for example an account that does not exist), what was charged and how much traffic the run used.

### Pricing

- **$0.0004 per resolved URL** ($0.40 per 1,000), **$0.30 per 1,000 on Gold and above**, preview included
- **$0.0005 per run**
- Entries that are not links, and links no server answers at all, are free
- A link whose shortener answers but whose site is gone is charged: you still get the expanded URL.

What typical jobs cost at the list price:

| Job | Cost |
|---|---|
| One link | $0.0009 (with the run fee) |
| 100 links | $0.04 |
| 1,000 links | $0.40 ($0.30 on Gold) |
| 10,000 links | $4.00 ($3.00 on Gold) |

On Apify's Scale and Business plans the per-event prices are lower (Store discounts). Set **Maximum cost per run** and the Actor stops cleanly when it is reached: you never pay more than that.

### Tips

- Turn the preview off when you only need hops and status codes; the price is the same.
- `note` explains anything unusual: a loop, a flagged link, a dead site, or a site that refuses cloud addresses (its final URL is still known from the last redirect).
- Run many links in one run: the $0.0005 run fee is paid once.

### Use it through the API

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("zaiq/url-unshortener").call(run_input={"urls": ["https://bit.ly/example-link", "https://t.co/example"], "includePreview": true})
for row in client.dataset(run.default_dataset_id).iterate_items():
    print(row)
```

**JavaScript**

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('zaiq/url-unshortener').call({"urls": ["https://bit.ly/example-link", "https://t.co/example"], "includePreview": true});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**HTTP (one call, results back)**

```bash
curl -X POST 'https://api.apify.com/v2/acts/zaiq~url-unshortener/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"urls": ["https://bit.ly/example-link", "https://t.co/example"], "includePreview": true}'
```

### Integrations and schedules

- **Schedules:** run it every hour, day or week from the Apify Console (Schedules) and keep a history of results.
- **Make, Zapier, n8n, Google Sheets, Slack, Airtable:** connect it through Apify's integrations, or send each finished run to a **webhook**.
- **Datasets:** results stay in the run's dataset; export them or read them by API whenever you need them.

### Use it with AI agents (MCP)

Add Apify's MCP server with this Actor already pinned (`https://mcp.apify.com?tools=zaiq/url-unshortener`) to Claude, ChatGPT, Cursor, VS Code or any MCP client. The agent can find this Actor and run it for you: ask it for "where does this bit.ly link really go, and what is the page about". AI agents can also pay for runs directly through Apify's agentic payments.

### Limits

- Some sites refuse requests from cloud addresses; for those the final URL comes from the last redirect and the preview is empty (see `note`).
- Redirects made by JavaScript are followed only on small redirect pages (t.co style), not inside full websites.
- Shorteners that have disabled or flagged a link stop at their own warning page (`stoppedAtShortener`).
- Only the first 512 KB of the final page is read for the preview.
- Apify's free plan: the first 20 links.

### FAQ

**Which short links work?**

Any link that redirects: bit.ly, t.co, tinyurl, ow.ly, is.gd, buff.ly, rebrand.ly, lnkd.in, cutt.ly and custom domains. In our tests every one of these resolved.

**Does it follow t.co's meta refresh?**

Yes. t.co answers with an HTML page that redirects by meta refresh and JavaScript; both are followed and shown as hops.

**What about bit.ly's preview page?**

Some visitors get a bit.ly preview page instead of a redirect; the destination named on it is followed and the hop shows as shortener preview page.

**Is the preview extra?**

No. Title, description, image and site name are included in the price.

**What if the site is gone?**

You still get the expanded URL and every hop; the note says the final address did not answer.

**Can it audit my own redirects?**

Yes: paste your old URLs and read each hop's status code.

### Related Actors from Zaiq

- [contact-details-extractor](https://apify.com/zaiq/contact-details-extractor): emails, phones and social links from the final websites
- [tech-stack-detector](https://apify.com/zaiq/tech-stack-detector): the technology behind each final website
- [website-crawler-by-country](https://apify.com/zaiq/website-crawler-by-country): the whole page as Markdown, from any country

### Support

Questions, a site that changed, or a field you need? Open an issue on this Actor's **Issues** tab: we answer there, usually within a day.

***

Also found as: url unshortener, unshorten url, expand short url, url expander, redirect checker, redirect chain, link preview api, bitly expander, t.co expander, short link resolver.

# Actor input Schema

## `urls` (type: `array`):

Short links or any links, one per line: bit.ly, t.co, tinyurl, lnkd.in, ow.ly, buff.ly, rebrand.ly, cutt.ly or your own. Up to 10,000.

## `includePreview` (type: `boolean`):

Title, description, image, site name, canonical URL, favicon and language of the page each link ends on. Included in the price.

## `maxRedirects` (type: `integer`):

Stop after this many hops (redirect loops are caught either way). Up to 30.

## Actor input object example

```json
{
  "urls": [
    "http://tinyurl.com/y2vlzv",
    "https://cutt.ly/Analyticsindiamag-Lyft-Flyte-opensource"
  ],
  "includePreview": true,
  "maxRedirects": 15
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset: the results.

## `summary` (type: `string`):

What each input returned, and notes.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "http://tinyurl.com/y2vlzv",
        "https://cutt.ly/Analyticsindiamag-Lyft-Flyte-opensource"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zaiq/url-unshortener").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "http://tinyurl.com/y2vlzv",
        "https://cutt.ly/Analyticsindiamag-Lyft-Flyte-opensource",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("zaiq/url-unshortener").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "http://tinyurl.com/y2vlzv",
    "https://cutt.ly/Analyticsindiamag-Lyft-Flyte-opensource"
  ]
}' |
apify call zaiq/url-unshortener --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zaiq/url-unshortener"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uTepPbjsSy4hjBTgE/builds/sjf8SYyDfhuxnqPcM/openapi.json
