shortn
Docs/Errors

Error codes

Every error is a JSON object with one field, error, holding a sentence written to be shown to a person rather than a code to be looked up. This page is that list, with what causes each one.

All errors are JSON · the error field is always present

Branch on the status, show the sentence The status code is the stable part. The wording is not: it is written for humans and may be reworded without a version bump. Put error straight into your interface and nobody has to look anything up.

The list

StatusMessageWhat it means
400invalid jsonThe body was not parseable JSON.
400url requiredPreview was given nothing to look at.
400slug requiredNo slug was given.
400invalid slugThe slug was the wrong shape, or a full URL from another host was passed to the reveal endpoint.
400slug must be 3-32 chars: a-z 0-9 _ -A custom slug was the wrong shape. Checked before storage is touched.
400password must be 4-64 charactersThe password was outside that range.
400urls array requiredBulk needs an array of addresses.
400max 10 links per requestBulk takes ten at a time.
400that address will not be fetchedPreview was pointed at a private or loopback address, or a port that is not an ordinary one. Carries a reason of host, private or port.
400confirmation requiredA sweep was posted to without the confirmation word.
403wrong passwordUnlock was attempted and the password did not match.
404no such linkNothing live under that slug.
404that link has expiredIt existed and its seven days are up.
404that link is not protectedUnlock was attempted on a link with no password.
409slug takenSomeone has that slug, right now. Retrying will not help.
409slug reservedThe site needs that slug for itself. Nobody can have it, ever.
429rate limited or rate limited, wait a minuteToo many requests in the current minute, with a retry-after header. See the limits page.

Three that are easy to confuse

slug taken vs slug reserved
The first is a collision and the other slug will do. The second is permanent and no amount of retrying will help. Treating them the same means either giving up too early or retrying forever.
no such link vs that link has expired
The first means it never existed. The second means it did, and its seven days are up. Only the second is worth retrying with a different link.
429 vs a slow response
A 429 arrives immediately with a header telling you how long to wait. A slow response is not a 429 and waiting will not change it.

Handling them