API Documentation

Create Paste

Endpoint: POST https://api.paster.sh/v1/create

Request Parameters

Parameter Type Required Description
content string Yes The paste content (max 512KB)
title string No Paste title (defaults to "Untitled" if not provided)
visibility string No public, unlisted, or private (default: public)
syntax string No Syntax highlighting language (default: plain)
expiration string No never, 10min, 1hour, 1day, 1week (default: never)
csrf_token string Yes CSRF token for security (get from session)

Supported Syntax Languages

plain, javascript, python, html, css, bash, php, sql, json, xml, markdown, java, c, cpp, csharp, ruby, go, rust, typescript

Example Request (cURL)

curl -X POST https://api.paster.sh/v1/create \
  -d "content=Hello World" \
  -d "title=My Paste" \
  -d "visibility=public" \
  -d "syntax=plain" \
  -d "csrf_token=YOUR_CSRF_TOKEN"

Response

On success, you will be redirected to the paste view page:

HTTP/1.1 302 Found
Location: https://paster.sh/view-paste.php?id=PASTE_TOKEN

Get Raw Paste Content

Endpoint: GET https://api.paster.sh/v1/raw/PASTE_TOKEN

Retrieve the raw content of a paste:

curl https://api.paster.sh/v1/raw/PASTE_TOKEN

Error Responses

Error Description
Invalid security token CSRF token is missing or invalid
Too many requests Rate limit exceeded (max 5 requests per 60 seconds)
Content is required The content field is empty
Paste exceeds maximum size Content size exceeds the limit

Notes

  • All requests must be made via POST (except raw content retrieval)
  • CSRF tokens are required for security
  • Rate limiting is applied per IP address
  • Private pastes can only be viewed with the direct link
  • Unlisted pastes are not shown in the public list but are viewable with the link