Developer API

Pastes, programmatically

A tiny JSON API — no keys, no SDK. Create a paste with one POST and fetch it with a GET.

Create a paste

POST https://thpaste.com/api/paste with a JSON body. Only content is required.

FieldTypeDescription
contentstringThe paste body. Required. Up to 512.0 KB.
titlestringOptional title, up to 120 chars.
languagestringSyntax language, e.g. javascript, python, sql. Default plain.
expirystringnever · 10m · 1h · 1d · 1w · 1m · burn. Default never.
visibilitystringpublic or unlisted. Default public.
passwordstringOptional password to protect the paste.

Request

curl -X POST https://thpaste.com/api/paste \
  -H "Content-Type: application/json" \
  -d '{
    "content": "console.log(\"hello\")",
    "title": "hello world",
    "language": "javascript",
    "expiry": "1d",
    "visibility": "unlisted"
  }'

Response · 201

{
  "id": "aZ3k9Qp2",
  "url": "https://thpaste.com/p/aZ3k9Qp2",
  "raw": "https://thpaste.com/raw/aZ3k9Qp2"
}

Fetch a paste

Read a paste as JSON or as raw text. Password-protected pastes can only be opened in the browser.

# JSON metadata + content
curl https://thpaste.com/api/paste/aZ3k9Qp2

# Just the plain text
curl https://thpaste.com/raw/aZ3k9Qp2

Pipe from the terminal

Turn any command's output into a shareable link.

# Pipe any command's output straight into a link
git log --oneline -20 | curl -s -X POST https://thpaste.com/api/paste \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{ "content": "$(git log --oneline -20)", "language": "plain" }
JSON

Try it now.

Create your first paste in the browser, then automate it.

New paste