CLI Entry point

Shlink provides a CLI entry point 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 your domains.

You can treat it as an alternative interface to manage your Shlink instance, that will be available out of the box.

The entry point is the bin/cli script, and you will usually run it as bin/cli [command] [arguments]. It is recommended to symlink the bin/cli script to a global shlink script, so that you can run the CLI from anywhere with shlink [command] [arguments].


Commands in Shlink’s CLI entry point are contextually namespaced in api-key, domain, short-url, tag and visit.

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

Running any command with the -h/--help 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 entry point:

  command [options] [arguments]

  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) 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:
  completion               Dump the shell completion script
  help                     Display help for a command
  list                     List 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.
  domain:list              List all domains that have been ever used for some short URL
  domain:redirects         Set specific "not found" redirects for individual domains.
  domain:visits            Returns the list of visits for provided domain.
  short-url:create         Generates a short URL for provided long URL and returns it
  short-url:delete         Deletes a short URL
  short-url:import         Allows to import short URLs from third party sources
  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
  short-url:visits-delete  Deletes visits from a short URL
  tag:delete               Deletes one or more tags.
  tag:list                 Lists existing tags.
  tag:rename               Renames one existing tag.
  tag:visits               Returns the list of visits for provided tag.
  visit:download-db        Checks if the GeoLite2 db file is too old or it does not exist, and tries to download an up-to-date copy if so.
  visit:locate             Resolves visits origin locations. It implicitly downloads/updates the GeoLite2 db file if needed.
  visit:non-orphan         Returns the list of non-orphan visits.
  visit:orphan             Returns the list of orphan visits.
  visit:orphan-delete      Deletes all orphan visits