$ man pasteshare-api

API documentation.

Complete reference for creating, listing, reading, editing, deleting, unlocking, downloading, and commenting on PasteShare pastes.

No API key requiredJSON + multipart512 KB max content

base url

https://paste.brianrianrehan.com

rate limit

10 requests / minute

HTTP 429 when the limit is reached.

edit key

Save it once

The key is required for edit and delete.

POST /api/pastePUBLIC
POST/api/paste

Create a JSON paste

Creates a public paste. The title is automatically set to the generated paste ID. The response contains an editKey; store it securely because it is the credential for future edits and deletion.

Request

curl -X POST "https://paste.brianrianrehan.com/api/paste" \
  -H "Content-Type: application/json" \
  -d '{"content":"console.log(\"hello\");"}'

JSON fields

FieldTypeDescription
contentstringRequired. Paste content, up to 512 KB.

Response: 201

{
  "message": "success",
  "id": "AbCdEf123",
  "title": "AbCdEf123",
  "content": "console.log(\"hello\");",
  "link": "https://paste.brianrianrehan.com/raw/AbCdEf123",
  "editKey": "save-this-securely"
}
POST /api/createPUBLIC
POST/api/create

Create a form-data paste

Creates a paste using multipart/form-data. Use format=json or an application/json Accept header for a JSON response; otherwise the browser request redirects to the new paste URL.

curl -i -X POST "https://paste.brianrianrehan.com/api/create?format=json" \
  -H "Accept: application/json" \
  -F "title=Deploy notes" \
  -F "content=Deployment completed successfully" \
  -F "exposure=public"

Form fields

FieldTypeDescription
titlestringOptional display title.
contentstringRequired. Paste content, up to 512 KB.
exposurepublic | privateOptional. Defaults to public.
passwordstringUse with private pastes to protect the content.

Response: 201

{
  "message": "success",
  "id": "AbCdEf123",
  "title": "AbCdEf123",
  "content": "console.log(\"hello\");",
  "link": "https://paste.brianrianrehan.com/raw/AbCdEf123",
  "editKey": "save-this-securely"
}
GET /api/pastesPUBLIC
GET/api/pastes

List public paste metadata

Returns the home registry with cursor pagination. Private paste content is never included in the list response.

curl "https://paste.brianrianrehan.com/api/pastes" \
  -H "Accept: application/json"

Search

curl "https://paste.brianrianrehan.com/api/pastes?q=deploy" \
  -H "Accept: application/json"
FieldTypeDescription
qstringOptional search query for title and public content.
cursorstringOptional nextCursor returned by the previous response.

The response contains pastes, total, totalViews, and nextCursor. Request the next page with ?cursor=….

GET /raw/:idPUBLIC
GET/raw/:id

Read raw content

Returns the paste as text/plain and increments its view counter. Public pastes can be read directly. Private pastes require a valid access cookie created by /api/password.

curl -b cookies.txt \
  "https://paste.brianrianrehan.com/raw/PrivatePaste123"

Responses: 200 text content, 401 password required or invalid, 404 paste not found.

GET /dl/:idPUBLIC
GET/dl/:id

Download a paste

Downloads the content as a text file named after the paste ID. Private paste access uses the same cookie flow as /raw/:id.

curl -L -b cookies.txt \
  -o PrivatePaste123.txt \
  "https://paste.brianrianrehan.com/dl/PrivatePaste123"
POST /api/editPUBLIC
POST/api/edit

Edit paste content

Updates the content of a paste when the generated edit key is valid. The title and visibility are unchanged.

curl -X POST "https://paste.brianrianrehan.com/api/edit" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "AbCdEf123",
    "content": "Updated content",
    "editKey": "save-this-securely"
  }'
FieldTypeDescription
idstringRequired paste ID.
contentstringRequired new content, up to 512 KB.
editKeystringRequired key returned when the paste was created.

Responses: 200 updated, 400 missing fields, 403 invalid key.

POST /api/deletePUBLIC
POST/api/delete

Delete a paste

Permanently deletes a paste and its comments. This action cannot be undone and requires the edit key.

curl -X POST "https://paste.brianrianrehan.com/api/delete" \
  -H "Content-Type: application/json" \
  -d '{"id":"AbCdEf123","editKey":"save-this-securely"}'

Response: 200 with {"success":true}. Invalid keys return 403.

POST /api/passwordPUBLIC
POST/api/password

Unlock a private paste

Accepts multipart/form-data, validates the password, sets a one-hour HTTP-only access cookie, and returns the decrypted content and comments.

curl -c cookies.txt -X POST "https://paste.brianrianrehan.com/api/password" \
  -F "id=PrivatePaste123" \
  -F "password=correct-password"
FieldTypeDescription
idstringRequired private paste ID.
passwordstringRequired private paste password.

The cookie must be sent on later /raw and /dl requests. Invalid passwords return 401.

POST /api/commentPUBLIC
POST/api/comment

Add a comment

Adds a comment to a paste using multipart/form-data. Browser clients are redirected back to the paste after success.

curl -i -X POST "https://paste.brianrianrehan.com/api/comment" \
  -F "pasteId=AbCdEf123" \
  -F "author=Alice" \
  -F "content=Useful snippet"
FieldTypeDescription
pasteIdstringRequired paste ID.
contentstringRequired comment text.
authorstringOptional author name. Defaults to Anonymous.

errors + security

Operational notes

  • 01Use Accept: application/json when you need machine-readable responses.
  • 02HTTP 429 means the request limit was exceeded. Respect the Retry-After header.
  • 03Never publish an edit key in public content, logs, screenshots, or source control.
  • 04Admin endpoints under /api/admin require an authenticated admin session and are not public API endpoints.
cd /home