111 lines | UTF-8 | 2 KB


crash.link API Client for Go and CLI tool

crash.link URL shortener

  • Custom domain
  • Password for the URL
  • Managing links

This is a Go wrapper for the API and CLI tool. To get shorter url, you need to signup at crash.link and obtain API key from settings.

$ go get -u crash.software/crash.link/clink.go


This is a example to get shorter url. The full example is in _example directory.

For API details, please refer official documentation.

package main

import (


func main() {
	cli := clink.NewClient("<api key>")

	// create shorter url for this repository
	target := "https://crash.software/crash.link/clink.go"
	URL, err := cli.Submit(
		// clink.WithCustomURL("clink.go"),
		// clink.WithPassword("foobar"),
		// clink.WithReuse(true),
	if err != nil {

	fmt.Println(URL.ShortURL) // https://crash.link/clink.go
type URL struct {
	ID         string    `json:"id"`
	Target     string    `json:"target"`
	ShortURL   string    `json:"shortUrl"`
	Password   bool      `json:"password"`
	Reuse      bool      `json:"reuse"`
	DomainID   string    `json:"domain_id"`
	VisitCount int       `json:"visit_count"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`


$ go install crash.software/crash.link/clink.go/cmd/clink

You can register your API key to CLI with clink apikey <key>.

❯ clink --help
CLI tool for crash.link (URL Shortener)

  clink [command]

Available Commands:
  apikey      Register your api key to cli
  delete      Delete a shorted link (Give me url id or url shorted)
  list        List of last 5 URL objects.
  submit      Submit a new short URL
  help        Help about any command

  -k, --apikey string   api key for crash.link
  -h, --help            help for clink

Use "clink [command] --help" for more information about a command.




Code released under the MIT License.

Please wait...
Page is in error, reload to recover