← Back to Save 5m

API Reference

Save 5m can be used entirely from the command line. When curl or wget is detected (via User-Agent), responses are plain text instead of JSON.

Quick Start

# save text to slot 12
curl -X PUT -H 'X-Save5m: 1' -d 'hello world' save5m.com/api/12

# read it back
curl save5m.com/api/12

# pipe from stdin
echo 'hello' | curl -X PUT -H 'X-Save5m: 1' -d @- save5m.com/api/12

# delete
curl -X PUT -H 'X-Save5m: 1' -d '' save5m.com/api/12

# usage help
curl save5m.com

Endpoints

GET /

Home page. Returns a usage cheat sheet for CLI clients, or the slot grid for browsers.

GET /api/{slot}

Retrieve stored content from a slot.

PUT /api/{slot}

Save content to a slot. Requires the X-Save5m: 1 header (CSRF protection).

Plain text body — saves text. Empty body deletes the slot.

JSON body (Content-Type: application/json) — saves a file:

{"filename": "photo.jpg", "data": "<base64-encoded content>"}

curl Examples

Save and retrieve text

# save
curl -X PUT -H 'X-Save5m: 1' -d 'my secret note' save5m.com/api/42

# retrieve
curl save5m.com/api/42

Pipe a file's contents as text

cat ~/.ssh/config | curl -X PUT -H 'X-Save5m: 1' -d @- save5m.com/api/42

Upload a binary file

curl -X PUT -H 'X-Save5m: 1' \
  -H 'Content-Type: application/json' \
  -d "{\"filename\":\"photo.jpg\",\"data\":\"$(base64 -w0 photo.jpg)\"}" \
  save5m.com/api/42

Download a file (preserving filename)

curl -OJ save5m.com/api/42

wget Examples

Retrieve text

wget -qO- save5m.com/api/42

Download a file (preserving filename)

wget --content-disposition save5m.com/api/42

Slots

Valid slot IDs are 11 through 99 (89 slots). Invalid slot IDs return 404.

Limits

The X-Save5m: 1 header is required on all PUT requests. This prevents browsers from being tricked into saving data via cross-site requests. For CLI usage it's just one extra -H flag.