https://paste.alokranjan.me/api/v1
No authentication required. Rate limiting applies (60 requests/minute by default).
POST /pastes
Creates a new paste with optional password protection and expiration.
Request Body:
{
"content": "Your paste content here",
"language": "auto",
"expires_in_minutes": 1440,
"password": "optional_password"
}Parameters:
content(string, required): The paste contentlanguage(string, optional): Language for syntax highlighting. Use "auto" for detectionexpires_in_minutes(integer, optional): Expiration time (0 = never, 10, 60, 1440, 10080)password(string, optional): Password protection using AES-256-GCM encryption
Response (201 Created):
{
"id": "aB3kX9mP",
"url": "https://paste.alokranjan.me/aB3kX9mP/",
"expires_at": "2025-07-11T06:00:00Z"
}Example:
curl -X POST https://paste.alokranjan.me/api/v1/pastes \
-H "Content-Type: application/json" \
-d '{
"content": "func main() { fmt.Println(\"Hello, World!\") }",
"language": "go",
"expires_in_minutes": 1440
}'Password-protected paste:
curl -X POST https://paste.alokranjan.me/api/v1/pastes \
-H "Content-Type: application/json" \
-d '{
"content": "SECRET_KEY=super_classified_data",
"language": "bash",
"password": "secure_password_123",
"expires_in_minutes": 60
}'GET /pastes/{id}
Retrieves a paste by its ID.
Parameters:
id(path): The paste IDpassword(query, optional): Required for password-protected pastes
Response (200 OK):
{
"id": "aB3kX9mP",
"content": "func main() { fmt.Println(\"Hello, World!\") }",
"language": "go",
"created_at": "2025-07-10T06:00:00Z",
"expires_at": "2025-07-11T06:00:00Z",
"is_file": false,
"filename": null
}Examples:
# Public paste
curl https://paste.alokranjan.me/api/v1/pastes/aB3kX9mP
# Password-protected paste
curl "https://paste.alokranjan.me/api/v1/pastes/aB3kX9mP?password=secure_password_123"POST / (multipart form)
Upload files up to 30MB via multipart form data.
Form Fields:
file(file): The file to uploadlanguage(string, optional): Language overrideexpires_in_minutes(integer, optional): Expiration timepassword(string, optional): Password protection
Example:
curl -X POST https://paste.alokranjan.me/ \
-F "file=@config.yaml" \
-F "language=yaml" \
-F "expires_in_minutes=1440"400 Bad Request:
{
"error": "Paste content cannot be empty"
}401 Unauthorized:
{
"error": "Invalid password"
}404 Not Found:
{
"error": "Paste not found or has expired"
}413 Payload Too Large:
{
"error": "Content exceeds maximum size limit"
}429 Too Many Requests:
{
"error": "Rate limit exceeded"
}Auto-detection and syntax highlighting support for:
bash, c, cpp, csharp, css, dart, diff, dockerfile, elixir, go, graphql, haskell, html, java, javascript, json, kotlin, lua, makefile, markdown, nginx, objectivec, perl, php, python, r, ruby, rust, scss, shell, sql, swift, typescript, vim, xml, yaml
- Default limit: 60 requests per minute per IP
- Headers included in response:
X-RateLimit-Limit: Request limit per windowX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Time when rate limit resets
- AES-256-GCM encryption for password-protected pastes
- PBKDF2 key derivation with 100,000 iterations
- Cryptographically secure ID generation using Base62 encoding
- Content Security Policy headers on all responses
- Input validation and sanitization
- XSS protection for all user content