---
name: hop-rip
description: Shorten long URLs with hop.rip (or any hop-rip server), and look up, edit, or delete short links. Use when a link is too long to read or tap comfortably (chat on a phone, terminal output, SMS), or when asked to shorten, share, or clean up a link.
---

# hop-rip: short links

hop-rip is a small URL shortener. The public instance is https://hop.rip. There are no accounts:
creating a link returns an **edit key**, and that key is the only way to change or delete the link.

## Make a link

```bash
curl -s https://hop.rip/api/links -H 'content-type: application/json' \
  -d '{"url":"https://example.com/some/long/path","ttl":"10_days"}'
# 201 {"slug":"x7k2m","url":"...","short_url":"https://hop.rip/x7k2m","edit_key":"...","expires":1795000000}
```

- `url` must be `http` or `https`, up to 4,096 characters.
- `slug` is optional: lowercase `a-z`, `0-9`, `-`, and `_`, up to 64 characters. Without it you get a random
  5-character slug. A slug that is in use returns `409`.
- `ttl` is how long the link lives. **Every link expires**, and without a `ttl` it lives only 24 hours, so pick
  one that outlasts how long people will need the link. Use whole seconds (`3600`) or a count and a unit
  joined by an underscore (`30_minutes`, `4_hours`, `10_days`, `2_weeks`). The maximum is `365_days`.
- `expires` in the response is Unix seconds.

Show people the short link, ideally with the full URL as well, so they can see where it goes.

## Keep the edit key private

The edit key is shown once and the server stores only its hash. Don't print it into chat or logs. If you may
need to edit or delete the link later, save it somewhere private (the `hop` CLI keeps keys in
`~/.config/hop/keys.json`, mode 600).

## Look up, edit, delete

```bash
curl -s https://hop.rip/api/links/x7k2m                      # where does it go, and when does it expire?
curl -s -X PUT https://hop.rip/api/links/x7k2m -H "Authorization: Bearer $KEY" \
  -H 'content-type: application/json' -d '{"url":"https://example.com/elsewhere"}'
curl -s -X DELETE https://hop.rip/api/links/x7k2m -H "Authorization: Bearer $KEY"   # 204
```

Editing changes the URL and keeps the expiry. Errors are `{"error": "..."}` with `400` (bad input), `401` (no
key), `403` (wrong key), `404` (no such link, or expired), or `409` (slug taken). Delete links that were only
needed once.

## Never shorten secrets

Short links are **public and guessable**. Never shorten a URL that carries a secret: an OAuth `code=`, an
access or password-reset token, a signed or pre-authenticated URL (S3 presigned links, for example), or an
invite link. A link that only starts a sign-in is fine.

## CLI

```bash
cargo install --git https://github.com/dorkitude/hop-rip
hop new https://example.com/long --ttl 10_days     # prints the short link, saves the key
hop new https://example.com/ --slug bowling
hop get bowling
hop edit bowling https://example.com/elsewhere    # uses the saved key, or --key
hop rm bowling
```

Use `--server https://short.example.com` or `HOP_SERVER` for another hop-rip server. Its API is the same, and
its default and maximum TTL may differ.
