POST https://api.paster.sh/v1/create
| 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) |
plain, javascript, python, html, css, bash, php, sql, json, xml, markdown, java, c, cpp, csharp, ruby, go, rust, typescript
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"
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 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 | 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 |