Command Line Interface

Shlink provides a CLI tool which exposes a set of commands to perform a variety of operations.

From creating, updating or listing short URLs, to manage API keys or handle the list of tags.


Commands in shlink are contextually namespaced in api-key, db, short-url, tag and visit.

By running the bin/cli script you will see the full list of commands with a description for each one of them.

Running any command with the -h flag will display an extended help for that specific command, showing the list of arguments and a descriptive explanation on how to use it.

This is the full list of commands exposed by Shlink's CLI tool:

  command [options] [arguments]

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help                Displays help for a command
  list                Lists commands
  api-key:disable     Disables an API key.
  api-key:generate    Generates a new valid API key.
  api-key:list        Lists all the available API keys.
  db:create           Creates the database needed for shlink to work. It will do nothing if the database already exists
  db:migrate          Runs database migrations, which will ensure the shlink database is up to date.
  short-url:delete    Deletes a short URL
  short-url:generate  Generates a short URL for provided long URL and returns it
  short-url:list      List all short URLs
  short-url:parse     Returns the long URL behind a short code
  short-url:visits    Returns the detailed visits information for provided short code
  tag:create          Creates one or more tags.
  tag:delete          Deletes one or more tags.
  tag:list            Lists existing tags.
  tag:rename          Renames one existing tag.
  visit:locate        Resolves visits origin locations.