pastesite API and CLI
API keys are part of Plus, $5 USD/month, because a key replaces the browser captcha and turns an account into a script. Reading a normal paste needs no key at all: /raw/<id> returns plain text on both plans. Abuse limits apply to both. Manage subscriptions in Dashboard → Billing.
The pastesite API lets you create and read pastes from a terminal, script, or CI job. It is the same API the website uses. Browser paste creation is protected by Cloudflare Turnstile; for scripts, create a personal API key instead.
Short answer: create a Plus API key in Dashboard → Account, send JSON to POST /api/pastes with Authorization: Bearer ps_…, and read any normal paste as plain text from /raw/<id> without a key.
1. Create an API key
API keys need a Plus account. A Free account sees the same section, explains what Plus adds, and links to Billing — nothing is hidden.
- Sign in, open Dashboard → Billing, and subscribe to Plus.
- Open the Account tab, find API keys, and click Create key.
- Give it a label, choose its permissions and expiry, then copy the key when it appears. It is shown only once.
Keys act as your account, so scope them narrowly. Plus allows up to 100 keys; a new key defaults to create and read, and manage is only worth adding when a script needs to edit or delete pastes. If the subscription ends, its keys stop working — they are kept, not deleted, and work again after resubscribing. The dashboard offers an expiry of 30 days, 90 days, one year, or never, and the API accepts any whole number from 1 to 3,650 days. An expired key stops working and is deleted the first time it is presented.
| Permission | Allows |
|---|---|
create | POST /api/pastes |
read | Read your own pastes, revisions, folders and profile |
manage | Edit and delete your own pastes, folders and profile (also grants read) |
Do not commit keys to a repository or paste them into a public chat. Revoke a single key, or use Revoke all after a suspected leak.
2. Create a paste with curl
curl -s https://pastesite.com/api/pastes \
-H "Authorization: Bearer ps_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"content": "hello from the terminal",
"title": "Terminal test",
"language": "plaintext",
"visibility": "unlisted"
}'
The response includes the paste ID and shareable links:
{
"ok": true,
"paste": {
"id": "x7Km2Qp9aL",
"title": "Terminal test",
"language": "plaintext",
"visibility": "unlisted",
"created_at": "2026-10-17T08:30:00.000Z",
"views": 0,
"url": "https://pastesite.com/#/p/x7Km2Qp9aL",
"rawUrl": "https://pastesite.com/raw/x7Km2Qp9aL"
}
}
Extract the link with jq:
curl -s https://pastesite.com/api/pastes \
-H "Authorization: Bearer ps_your_api_key" \
-H "Content-Type: application/json" \
-d '{"content":"hello","language":"plaintext","visibility":"unlisted"}' \
| jq -r '.paste.url'
3. Pipe command output into a paste
content is a normal JSON string. Use jq -Rs to wrap stdin as a string:
./deploy.sh 2>&1 \
| jq -Rs '{content: ., title: "deploy log", language: "bash", visibility: "unlisted"}' \
| curl -s https://pastesite.com/api/pastes \
-H "Authorization: Bearer ps_your_api_key" \
-H "Content-Type: application/json" \
-d @- \
| jq -r '.paste.url'
4. Read a paste as plain text
Use the friendly raw URL for pipes and downloads:
curl -s https://pastesite.com/raw/x7Km2Qp9aL
For a normal paste it returns text/plain with no HTML. A password-protected paste needs the password in a header — a ?password= query parameter is deliberately not accepted, because URLs are logged by every proxy between you and the server:
curl -s https://pastesite.com/raw/x7Km2Qp9aL \
-H "x-paste-password: your-password"
Burn-after-read pastes are deleted after the first successful read — whether that read came from the browser or this endpoint. Expired pastes return a 410; unknown IDs return 404.
Endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/pastes | API key or Turnstile | Create a paste |
| GET | /raw/<id> | None (password if set) | Plain-text paste |
| GET | /api/pastes/<id>/raw | None (password if set) | Same as above |
| POST | /api/pastes/<id>/view | None (password if set) | JSON view used by the site |
| GET | /api/pastes/<id> | Session or key (read) | Your own paste, unlisted included |
| PATCH | /api/pastes/<id> | Session or key (manage) | Edit your own paste |
| DELETE | /api/pastes/<id> | Session or key (manage) | Delete your own paste |
| GET | /api/pastes/<id>/revisions | Session or key (read) | Edit-history summaries (id, title, language, created_at, content_length); bodies are loaded individually |
| GET | /api/pastes/<id>/revisions/<revision-id> | Session or key (read) | One full revision of your own unexpired paste |
| GET | /api/pastes/recent | None | Recent public pastes |
| GET | /api/pastes/trending | None | Trending public pastes from the last 30 days |
| GET | /api/me/pastes | Session or key (read) | Your pastes |
| GET | /api/me/usage | Session or key (read) | Your plan, rolling daily create usage and remaining budget |
| GET | /api/me/profile | Session or key (read) | Your profile, plus isAdmin |
| PUT | /api/me/profile | Session or key (manage) | Change your username or display name |
| GET | /api/me/api-keys | Session | List keys and your plan |
| POST | /api/me/api-keys | Session (Plus) | Create a key — 403 on Free |
| DELETE | /api/me/api-keys/<id> | Session | Revoke one key |
| DELETE | /api/me/api-keys | Session | Revoke every key |
| GET/POST | /api/folders | Key: read / manage | List or create folders |
| PATCH/DELETE | /api/folders/<id> | Key: manage | Rename or delete a folder |
| GET | /api/profiles/<username> | None | Public profile and its public pastes |
| GET | /api/import/pastebin?id=<id> | None (rate limited) | Read a public Pastebin paste for import |
| POST | /api/reports | None (Turnstile) | Report a paste for abuse |
| GET | /api/reports | Admin (manage) | List abuse reports |
| PATCH | /api/reports/<id> | Admin (manage) | Resolve or dismiss a report |
Admin routes additionally require the caller's address to be listed in the server's ADMIN_EMAILS variable; the same allowlist decides the isAdmin flag on GET /api/me/profile. API keys cannot manage other API keys — that needs a browser session.
GET /api/me/usage returns { "plan": "plus", "dailyLimit": 2000, "used": 2, "remaining": 1998, "windowHours": 24 }. The counter is the same rolling 24-hour account bucket that creation enforces. Each creation returns to the budget exactly 24 hours after it was made, not at midnight. Every registered account, including admins, has its own allowance; browser and API requests, plain and encrypted pastes share it. Failed submissions do not spend the daily budget, and deleting a paste does not refund a creation. A daily-quota refusal returns 429 with code: "daily_limit" and upgrade: true only for signed-in Free accounts; other abuse limits do not signal an upgrade. Upgrading raises the allowance without clearing usage.
The import endpoint accepts a bare Pastebin id or a pastebin.com link, fetches the public raw text on the server (a browser cannot read pastebin.com directly, because it sends no CORS headers), and returns { "ok": true, "text": "…", "chars": 1234, "source": "AbC123xY" }. Only public and unlisted pastes are readable; private or password-protected pastes come back as HTML from Pastebin and are rejected with 422. Limits are 10 imports per hour per network and 100,000 characters. Nothing is stored — creating the paste is a separate POST /api/pastes.
Fields for creating a paste
| Field | Type | Notes |
|---|---|---|
content | string | Required. Up to 250,000 characters for a key, because keys are a Plus feature; an encrypted payload has a bounded wire size allowing UTF-8, base64 and authentication-tag overhead. The server cannot inspect encrypted plaintext, so API clients must enforce the plaintext character limit before encryption. Client plan flags cannot upgrade access. |
title | string | Optional, up to 200 characters. |
language | string | Optional. One of the supported language IDs; defaults to plaintext. |
visibility | string | public or unlisted; defaults to public. |
password | string | Optional. Readers must supply it. |
expiryMinutes | number | Optional. 1 to 525,600 (one year). |
burnAfterRead | boolean | Optional. Deletes on first read. |
encrypted | boolean | Optional. Treats content as a v1 AES-256-GCM payload encrypted by the client. Forces visibility: "unlisted"; a password is ignored and an attached image is refused. |
customSlug | string | Optional. 3–30 lowercase letters, numbers, hyphens. Reserved words are refused: raw, embed, edit, report, admin, recent, trending, mine, account, verify, u, terms, api, p. |
screenshots | string[] | Optional. Up to 3 base64 data URLs, max 500,000 characters each and at most 1.4 MB together. Only png, jpeg, gif and webp are accepted — SVG is refused with a 400 because a data URL can carry active content. The older single screenshot field is still accepted. |
forkedFrom | string | Optional source paste ID. |
Encrypted payloads. With "encrypted": true, send content in the form enc1: + standard-base64(12-byte IV) + . + standard-base64(ciphertext), where the ciphertext is AES-256-GCM over the UTF-8 text with the 256-bit key the client generated. Padding is optional. This is standard base64 (+, /, optional =), not base64url: the payload travels in a JSON body, not a URL. The server validates the shape and stores it verbatim; it has no key. Such a paste is unlisted-only, never appears in a feed, is skipped by the automatic abuse checks, and cannot be edited. GET /raw/<id> returns 409 because there is nothing readable to serve, and the embed page shows a notice instead of ciphertext. POST /api/pastes/<id>/view returns the ciphertext to a reader with the link; GET /api/pastes/<id> returns it only to the owner. A client that holds the key can decrypt it; the browser app never sends that key, and removes it from the address bar before analytics scripts load. Metadata — title, language, size, dates, and any custom URL — is stored in the clear, because only the text is encrypted.
Rate limits and errors
Burst limits are per identity: anonymous creation has a per-network burst and a per-browser daily allowance, while a signed-in account has its own attempt budget. The daily creation quota follows the signed-in account and applies to API-key requests too:
- Anonymous: 10 per 10 minutes per network (pastes created), with 30 per 10 minutes per network (attempts, so failed captchas cannot be spammed)
- Signed-in: 30 per 10 minutes per account (creation attempts); the plan's daily quota is the sustained limit
- Daily creations — Free: 50 per 24 hours per account; Plus: 2,000 per 24 hours per account; anonymous: 50 per 24 hours per browser
- Shared network ceiling — accounts first seen in the last 24 hours share a daily ceiling on one network (150 per 24 hours), so creating another account on the same connection does not add a fresh allowance. Established accounts, anonymous visitors and Plus are not affected
- Browser allowance — anonymous visitors and Free accounts share one 50-per-24-hours allowance per browser; creating another Free account in that browser does not add more. Plus creations are not affected
- 300 paste reads per 10 minutes across paste views and
/raw/<id> - 8 password attempts per 15 minutes per network, and 30 per paste per 15 minutes across networks
- 5 abuse reports per hour
During a sustained flood, creation can pause site-wide for a short period; reading and existing links keep working, and the counter resets on its own. The plain-language version of these limits, including what a shared network or VPN changes, is limits and refusals.
Repeated reads from the same network count as one view for 24 hours, so view counts and the trending list cannot be pumped from one machine. Errors are JSON for API routes and plain text for raw routes:
400— invalid input (empty content, bad or reserved slug, expiry out of range, an unsupported or oversized image)401— missing/invalid API key, or a missing paste password403— the key lacks the required permission, the account is on Free (keys are a Plus feature), you are not the owner, or the route needs admin access404— paste not found409— that custom URL or username is already taken, or an encrypted paste has no plain-text raw form410— paste expired429— rate limit reached
Security notes
- API keys are stored as SHA-256 hashes — salted with
API_KEY_PEPPERwhen the server sets it — and the plaintext key is shown once. - Use one key per machine or script so you can revoke it independently.
- Do not put keys in URLs, screenshots, or public pastes.
- Password-protected pastes are access-controlled, not encrypted; the server still stores the text. Use
"encrypted": truewhen the server must not be able to read it. - Raw reads count as a view and can burn a burn-after-read paste.
Frequently asked questions
How do I create an API key?
Subscribe to Plus in Dashboard → Billing, then open the Account tab, find the API keys section, and click Create key. Copy the key when it appears — it is shown only once. Revoke it from the same section if it leaks.
Can I create a paste with curl?
Yes, with a Plus account. Send a POST request to /api/pastes with an Authorization: Bearer ps_... header and a JSON body containing content. The response includes a shareable url and rawUrl. A key whose account is on Free is refused with 403.
Does the raw endpoint work without JavaScript?
Yes. GET /raw/<id> returns text/plain from the server, so curl, wget, and shell pipes work without a browser.
Can I limit what an API key can do?
Yes. Keys carry permissions: create, read, and manage. New keys can create pastes and read your own data; add manage only when a script needs to edit or delete. Keys can expire after 30 days, 90 days, a year, or never, and you can revoke all keys at once if one leaks.
Do API keys bypass the captcha?
Yes. A key replaces the browser Turnstile challenge for scripted creation, which is why it is the paid capability. Paste creation is still rate-limited by IP.
Why do I get a 401 from /raw/<id>?
The paste is password-protected. Send the password in an x-paste-password header. A ?password= query parameter returns 401 as well — request lines are logged, so a password in the URL leaks into logs, shell history and any bookmark or referrer that carries the link.