<!-- BusyBot node reference — https://busybot.net/tools/yourls/ -->

> Node: YOURLS (`yourls`) · Action · v1
> Category: Utility · Credentials: YOURLS API (`yourlsApi`)
> Updated: 2026-08-16

# YOURLS

> Shorten, expand, and get stats for URLs via YOURLS

## Overview

YOURLS (Your Own URL Shortener) is a self-hosted PHP-based URL shortening service. This tool interacts with the YOURLS API to shorten long URLs into short links, expand short URLs back to their original form, and retrieve click statistics for shortened URLs. YOURLS must be self-hosted and the API must be enabled with a signature token for authentication.

**Category:** Utility  
**Tool Name:** `yourls`  
**Version:** 1

**Appearance:** Icon: `lucide-Link` | Color: `#396DB1`

## Node Type

**Action** — processes input items and produces output

## Input / Output

| Direction | Port(s) |
|-----------|--------|
| Input | `Input` |
| Output | `Output`, `Error` |

## Credentials

This tool requires **YOURLS API** credentials.
See the [Credentials Guide](https://busybot.net/credentials/yourls-api/) for setup instructions.

### Resources

| Resource | Value |
|----------|-------|
| URL | `url` |

### Operations

| Operation | Value | Description |
|-----------|-------|-------------|
| Expand | `expand` | Expand a short URL to its original long URL |
| Shorten | `shorten` | Shorten a long URL |
| Stats | `stats` | Get click statistics for a short URL |

### Parameters

#### URL: Shorten

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| URL | `string` | Yes | — | The long URL to shorten. Supports expressions like {{ $json.longUrl }}. |
| Additional Fields | `collection` | No | `{}` | Optional extra values sent with the shorten request. |
| — Keyword | `string` | No | — | Custom keyword (slug) for the short URL. If not specified, YOURLS will generate one automatically. |
| — Title | `string` | No | — | Title for the custom short URL. Used for display/organizational purposes. |

#### URL: Expand

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Short URL | `string` | Yes | — | The short URL or keyword to expand back to the original long URL. Supports expressions. |

#### URL: Stats

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Short URL | `string` | Yes | — | The short URL or keyword to get click statistics for. Supports expressions. |

#### All Operations

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Max Concurrency | `number` | No | `10` | Maximum number of items to process concurrently. |

## Output Data

One output item per input item — no operation fans out. The fields of the YOURLS API response are merged onto the top level of the item JSON; anything already on the item passes through, and binary data is forwarded unchanged.

| Operation | What lands on the item |
|-----------|------------------------|
| `shorten` | The `shorturl` response from YOURLS, including the generated short link, its keyword and the original URL |
| `expand` | The expand response, including the long URL the keyword points at |
| `stats` | The `link` object from the response is unwrapped first, so its click-count fields land directly on the item rather than nested under `link` |

Reference the result downstream by expression, for example `{{ $json.shorturl }}`.

## Usage Examples

- Shorten a long URL with YOURLS
- Expand a YOURLS short link to its original URL
- Get click stats for a YOURLS short URL
- Create a custom keyword short URL with YOURLS

## Example Configuration

Shorten a URL:

```json
{
  "type": "yourls",
  "parameters": {
    "resource": "url",
    "operation": "shorten",
    "url": "https://www.example.com/very/long/path/to/some/resource"
  }
}
```

Shorten a URL with a custom keyword and title:

```json
{
  "type": "yourls",
  "parameters": {
    "resource": "url",
    "operation": "shorten",
    "url": "https://www.example.com/very/long/path/to/some/resource",
    "additionalFields": {
      "keyword": "example-page",
      "title": "Example Resource Page"
    }
  }
}
```

Expand a short URL:

```json
{
  "type": "yourls",
  "parameters": {
    "resource": "url",
    "operation": "expand",
    "shortUrl": "abc123"
  }
}
```

Get statistics for a short URL:

```json
{
  "type": "yourls",
  "parameters": {
    "resource": "url",
    "operation": "stats",
    "shortUrl": "abc123"
  }
}
```

Shorten one URL per incoming item, taking the link and the title from the item:

```json
{
  "type": "yourls",
  "parameters": {
    "resource": "url",
    "operation": "shorten",
    "url": "{{ $json.longUrl }}",
    "maxConcurrency": 15,
    "additionalFields": {
      "title": "{{ $json.pageTitle }}"
    }
  }
}
```

### Error Handling

| Mode | Behavior |
|------|----------|
| **stop** | Halts workflow on first error |
| **continue** | Skips failed items, passes successful ones through |
| **errorPort** | Routes failed items to Error output port |

## Tips

Shorten URLs, expand short URLs, and get click stats using a self-hosted YOURLS URL shortener.

### Parameter Relationships

The YOURLS tool uses a conditional parameter system where the available parameters depend on the selected operation:

1. **Base requirement:** `resource` must be `"url"` (only option available)
2. **Operation selection:** `operation` determines which additional parameters are available
3. **Operation-specific parameters:**
   - `"shorten"` → requires `url`, optionally uses `additionalFields`
   - `"expand"` → requires `shortUrl`
   - `"stats"` → requires `shortUrl`

This hierarchical relationship ensures that only relevant parameters are presented based on the chosen operation type.