pste-server
Self-hosted paste server inspired by sprunge. Pastes are world-readable; creating requires an API key.
HTTPS is required in production. API keys appear in the Authorization header and in the /?key=<key> query string used by the web form — both are exposed over plain HTTP. pste-server speaks plain HTTP on port 8000; use a reverse proxy or tunnel to terminate TLS. See examples/Caddyfile and examples/compose-cloudflare.yml.
Quick start
pip install -e .
BASE_URL=https://pste.example.com pste-server
# Add your first API key — prints the bookmark URL directly
pste-admin key add --user alice
# -> https://pste.example.com/?key=AbCd1234...
# Set PSTE_URL on the client to that URL, then:
echo "hello" | pste
# -> https://pste.example.com/AB1234
pste AB1234
# -> hello
See examples/ for Docker Compose, Cloudflare Tunnel, and cloud deployment configurations.
API
GET / Help page (add ?key=<key> for the paste web form)
POST / Create paste (requires Authorization: Bearer <key>)
GET /<id> Fetch paste as plain text
GET /<id>?<lang> Fetch with Pygments syntax highlighting + copy button
Creating pastes:
| Field | Type | Description |
|---|---|---|
pste |
string | Paste content (required) |
lang |
string | Pygments lexer name for syntax highlighting |
auto_detect |
1 |
Auto-detect language (Pygments, >0.5 confidence threshold) |
single_view |
1 |
Delete after first read |
expires_at |
ISO8601 UTC | Absolute expiry timestamp |
expires_in_n |
integer | Expiry amount (used with expires_in_unit) |
expires_in_unit |
H/D/W/M | Expiry unit: hours, days, weeks, minutes |
lang and auto_detect are mutually exclusive — if lang is provided, auto-detection is skipped. expires_at and expires_in_n/expires_in_unit are also mutually exclusive.
Fetching pastes:
GET /<id>— always plain text, regardless of stored langGET /<id>?<lang>— Pygments-highlighted HTML with table line numbers (line numbers haveuser-select: noneso Ctrl-A copies only code) and a Copy buttonGET /<id>?none— plain text (same as bare GET)
Web form
Open /?key=<key> in a browser to use the paste web form. The key is embedded in the bookmark URL; paste it from pste-admin key add output. The form includes:
- Textarea for paste content
- Single-view checkbox
- Expiry controls (number + H/D/W/M dropdown)
- Language dropdown (auto-detect default, 27 common lexers)
When submitted with language auto-detect (default), if Pygments identifies the language with >0.5 confidence the result page shows both the plain URL and a highlighted URL. When a specific language is selected the result shows only the highlighted ?<lang> URL.
Managing API keys
# Add a key (prints the full bookmark URL)
pste-admin key add --user alice --notes "personal laptop"
# Specify your own key value (must be [A-Za-z0-9])
pste-admin key add --key MySecretKey --user alice
# List all keys
pste-admin key list
# Revoke by key value (immediate, no confirmation)
pste-admin key revoke --key <key-value>
# Revoke all keys for a user or matching notes (lists keys, requires y to confirm)
pste-admin key revoke --user alice
pste-admin key revoke --notes "old laptop"
# Update key metadata
pste-admin key set --user alice --notes "rotated 2026-07"
pste-admin key set --key <key-value> --disabled true
# List pastes (shows ID, created, lang, key, deleted status)
pste-admin paste list --user alice
Keys take effect immediately — no restart required.
Environment variables
| Variable | Default | Description |
|---|---|---|
BASE_URL |
http://localhost:8000 |
Public URL used in paste links and key add output |
PORT |
8000 |
Listen port |
STORAGE_BACKEND |
sqlite |
sqlite, postgresql, or gcs |
SQLITE_PATH |
./data/pste.db |
SQLite DB path |
DATABASE_URL |
— | PostgreSQL connection string |
GCS_BUCKET |
— | GCS bucket name |
MAX_PASTE_BYTES |
1048576 |
Max paste size (bytes) |
DARK_MODE |
false |
Use github-dark as the highlight style; default (unset) uses default (light) |
HIGHLIGHT_STYLE |
— | Pin to any Pygments style name, ignoring DARK_MODE |
Deletion
By default, expired and single-view pastes are soft-deleted — deleted_at is set and they become inaccessible, but the row is retained. The variables below control hard deletion.
| Variable | Default | Description |
|---|---|---|
DELETE_ON_EXPIRE |
false |
Hard-delete immediately on expiry |
DELETE_ON_SINGLE_VIEW |
false |
Hard-delete immediately on first view |
DELETE_AFTER_EXPIRE |
7D |
Hard-delete soft-deleted expired rows after this duration |
DELETE_AFTER_SINGLE_VIEW |
7D |
Hard-delete soft-deleted single-view rows after this duration |
Duration format for DELETE_AFTER_*: integer + H (hours), D (days), W (weeks), or M (minutes). Set to empty string (DELETE_AFTER_EXPIRE=) to disable deferred hard-deletion entirely. DELETE_AFTER_* runs on a 30-minute cycle, independently of DELETE_ON_*.
Metadata
Release files for pste-server 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pste_server-0.3.0.tar.gz | 31.9 kB | With provenance | Details for pste_server-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pste_server-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for pste_server-0.3.0-py3-none-any.whl |
Total release size: 50.6 kB
Release files / pste_server-0.3.0.tar.gz
| Download URL | pste_server-0.3.0.tar.gz |
|---|---|
| Size | 31.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba8ab691f76d9937c2f898d1442e66332fc91cd56850b7341edd9f5ce61ed8ed
|
|
BLAKE2b-256 checksum How to use checksums |
0abf8224ae0d6190ddbae799d06f410aea846302c3a0f6bbf072291720dc4538
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.
Transparency logRelease files / pste_server-0.3.0-py3-none-any.whl
| Download URL | pste_server-0.3.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3347260baf628221b7b6c8733f9a55b8b38d789bd61d010056f91ca032692f4
|
|
BLAKE2b-256 checksum How to use checksums |
04577386ed95b9e0aa53fb4adf6bd083b0e8a53c7e4b12327a61a019b387d39b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.
Transparency logSecurity for pste-server 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pste_server-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.