Loading...
Create a new paste (text/code) with optional metadata:
Retrieve a paste by short URL
Delete a paste (authenticated only)
Creates a new paste.
Request
{
"content": "print('Hello')",
"expires_in": 3600,
"syntax": "python",
"visibility": "unlisted"
}
Response
{
"paste_id": "abc123",
"url": "https://paste.io/abc123",
"expires_at": "2025-11-30T10:00:00Z"
}
Retrive a paste by ID.
Error Responses:
Deletes a user-owned paste (if private or owned).
While the MVP allows anonymous paste creation, user account integration enables:
POST /pastepaste_idGET /paste/{id}[Client]
↓
[API Gateway / Load Balancer]
↓
[Paste Service (Create/Retrieve/Delete)]
↓ ↘
[Redis Cache] [Database Store]
↓ ↓
[TTL Processor] [Backup Storage]
Relational (PostgreSQL)
Table: pastes
- paste_id (PK)
- content (TEXT)
- syntax (STRING)
- visibility (ENUM)
- owner_id (NULLABLE)
- created_at (TIMESTAMP)
- expires_at (TIMESTAMP)
- access_count (INT)
Indexes:
10M × 1 KB/day = 10 GB/day
7-day retention = 70 GB live data
3x replication → 210 GB
Background sweeper: DELETE from pastes WHERE expires_at < now() LIMIT 1000
| FailureRecovery Strategy | |
| DB outage | Use read replicas, failover DB endpoint |
| Redis crash | Use AOF persistence + fallback to DB |
| PasteService failure | Auto-restart + stateless deployment |
| Surge in traffic (DoS) | API Gateway rate-limiting + CAPTCHA |
| Cache invalidation issue | TTL-based purge + on-demand DB lookup |
| Data loss |
| DecisionTrade-off / Justification | |
| Redis for caching | Fast reads vs memory usage; TTL reduces footprint |
| Base62 ID | Short + user-friendly vs potential for collisions |
| PostgreSQL vs DynamoDB | SQL query flexibility vs auto-scaling |
| User auth optional | Simpler MVP vs limited access control / management |
| Public pastes in CDN | Great performance vs cache invalidation complexity |
To allow users to manage their pastes: