Reference · Tools

YOURLS

Shorten, expand, and get stats for URLs using a self-hosted YOURLS instance

Action Utility v1

The YOURLS node shortens URLs, expands short links back to their targets, and retrieves click statistics from a self-hosted YOURLS instance. A typical build is shortening every campaign link automatically and reporting the click counts back into a dashboard.

Node type
Action
Parameters
7
Outputs
Output, Error
Credentials
YOURLS API

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

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires YOURLS API credentials. See the Credentials Guide for setup instructions.

Resources

ResourceValue
URLurl

Operations

OperationValueDescription
ExpandexpandExpand a short URL to its original long URL
ShortenshortenShorten a long URL
StatsstatsGet click statistics for a short URL

Parameters

URL: Shorten

ParameterTypeRequiredDefaultDescription
URLstringYesThe long URL to shorten. Supports expressions like {{ $json.longUrl }}.
Additional FieldscollectionNo{}Optional extra values sent with the shorten request.
— KeywordstringNoCustom keyword (slug) for the short URL. If not specified, YOURLS will generate one automatically.
— TitlestringNoTitle for the custom short URL. Used for display/organizational purposes.

URL: Expand

ParameterTypeRequiredDefaultDescription
Short URLstringYesThe short URL or keyword to expand back to the original long URL. Supports expressions.

URL: Stats

ParameterTypeRequiredDefaultDescription
Short URLstringYesThe short URL or keyword to get click statistics for. Supports expressions.

All Operations

ParameterTypeRequiredDefaultDescription
Max ConcurrencynumberNo10Maximum 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.

OperationWhat lands on the item
shortenThe shorturl response from YOURLS, including the generated short link, its keyword and the original URL
expandThe expand response, including the long URL the keyword points at
statsThe 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:

{
  "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:

{
  "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:

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

Get statistics for a short URL:

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

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

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

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes 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.

Frequently asked questions

Which operations are available?

Shorten, expand and stats, on the single `url` resource. The operation you choose determines which additional parameters appear.

Why self-host a shortener?

Branded short links and full ownership of the click data, which is the main reason teams run YOURLS rather than using a hosted service.

Can it report on link performance?

Yes — the stats operation returns click statistics, so campaign reporting can be automated.

Which credential does it need?

A YOURLS API credential pointing at your instance.

Build with the YOURLS node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need YOURLS API credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.