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
Grab your key
The same key the upload API uses, from your dashboard.
POST the text
As the body of /api/v1/paste, nothing else needed.
Share the link
It opens in the viewer, highlighted and decrypted in the browser.
Endpoint
https://imageserver.pw/api/v1/paste
application/json
X-IMAGESERVER-AUTH-KEY
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
# 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.
$headers = @{ "X-IMAGESERVER-AUTH-KEY" = "your-user-key" }
$text = Get-Content .\latest.log -Raw
$result = Invoke-RestMethod -Uri "https://imageserver.pw/api/v1/paste?name=latest.log" `
-Method Post -Headers $headers `
-ContentType "text/plain; charset=utf-8" `
-Body ([System.Text.Encoding]::UTF8.GetBytes($text))
$result.url
const res = await fetch('https://imageserver.pw/api/v1/paste', {
method: 'POST',
headers: {
'X-IMAGESERVER-AUTH-KEY': 'your-user-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'console.log("hello");\n',
language: 'javascript',
maxDownloads: '1'
})
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);
console.log(data.url, data.deletionUrl);
import requests
with open("traceback.txt", encoding="utf-8") as f:
text = f.read()
response = requests.post(
"https://imageserver.pw/api/v1/paste",
headers={"X-IMAGESERVER-AUTH-KEY": "your-user-key"},
json={"content": text, "language": "python", "expires": "24h"},
timeout=30,
)
response.raise_for_status()
print(response.json()["url"])
Response
200 OK
{
"url": "https://imageserver.pw/p/aB3dK9.txt#key=…",
"deletionUrl": "https://imageserver.pw/delete/aB3dK9?key=…"
}
-
With
format=urlthe 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
deletionUrlif 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.