Paste API

Send text as the request body, or as JSON, and get back an encrypted link to a highlighted paste. Made for piping logs and command output straight out of a terminal.

Quick start

1

Grab your key

The same key the upload API uses, from your dashboard.

2

POST the text

As the body of /api/v1/paste, nothing else needed.

3

Share the link

It opens in the viewer, highlighted and decrypted in the browser.

Endpoint

POST https://imageserver.pw/api/v1/paste
Body as raw text with any content type, or application/json
Auth header X-IMAGESERVER-AUTH-KEY
Shares the upload limit of 30 per minute
Up to 1.00 MB of UTF-8 text

A paste is an upload like any other. It counts towards your storage, shows up in the dashboard, and /api/v1/upload takes the same text as a .txt file if your client can only send files.

Request fields

With a raw body the options go into the query string. With JSON they are fields next to content.

Field Required Description
content JSON only The text. With a raw body the whole body is the text and this field does not exist.
language no How the viewer highlights it: bash, c, cpp, csharp, css, diff, dockerfile, dos, go, gradle, ini, java, javascript, json, kotlin, lua, markdown, php, plaintext, powershell, properties, python, ruby, rust, scss, sql, swift, typescript, xml, yaml. Leave it out and the extension of name decides, or plain text when there is none.
name no A file name such as build.log or main.py. Its extension suggests the language, and a downloaded copy is called after it, always ending in .txt.
expires no never, 1h, 6h, 12h, 24h, 7d or 30d. Leave it out for your dashboard setting.
maxDownloads no 1 deletes the paste after it is read once. Also 5, 10, 25, 100 or unlimited.
folder, tags no Filed into your dashboard the same way as uploads, see the Upload API.
urlStyle no private keeps the key after the #, raw links the plain text itself. Leave it out for your dashboard setting.
format no url answers with the link as plain text and a newline, instead of JSON.

Examples

Linux, macOS, WSL
# Pipe anything in, get the link back
tail -n 200 server.log | curl -s --data-binary @- \
  -H "X-IMAGESERVER-AUTH-KEY: your-user-key" \
  "https://imageserver.pw/api/v1/paste?name=server.log&expires=7d&format=url"

Use --data-binary, not -d: -d @- strips the newlines out of what it reads.

Response

200 OK

{
  "url": "https://imageserver.pw/p/aB3dK9.txt#key=…",
  "deletionUrl": "https://imageserver.pw/delete/aB3dK9?key=…"
}
  • With format=url the body is only the link, followed by a newline.
  • The key is in the link and nowhere else, so a lost link is a lost paste. Keep the deletionUrl if you may want to take it down.

Errors

Status Message What to do
400 Send the text as the request body. The body was empty. With JSON, the text belongs in content.
400 This file is not plain UTF-8 text. Binary data and other encodings are refused. Convert to UTF-8, or upload the file through the Upload API.
400 Missing auth key or file. The X-IMAGESERVER-AUTH-KEY header is missing.
401 Invalid user key. Copy the key again from the dashboard. Too many wrong keys from one address are refused for a few minutes.
413 Text uploads can be up to 1.00 MB. Trim it, for example to the last few hundred lines of a log.
413 Storage quota exceeded. Pastes count towards your storage. Delete old uploads in the dashboard.
429 Too many uploads, or the daily limit for new accounts. 30 per minute. Accounts in their first week without a confirmed email address are also limited per day, and the message says how to lift it.

All of these are JSON in the shape { "error": "..." }, also with format=url.

Rather paste by hand?

The paste page does the same in the browser, with a language picker, expiry and delete after the first read.