API Access (Premium Feature)
The CloakBin API is available exclusively to premium subscribers. All endpoints require authentication via API key. Upgrade to Premium to get started, then generate your API key.
Getting Started
The CloakBin API allows you to programmatically create and manage encrypted pastes. All API endpoints require authentication via API key and are available exclusively to premium subscribers.
Premium Required
API access requires an active premium subscription. Upgrade now to get started.
Base URL
Authentication
All API requests must include your API key in the Authorization header using Bearer authentication.
Generate API Key
Generate your API key from your API key settings. Keep it secure and never share it publicly.
Header Format
Security Note
Never expose your API key in client-side code or public repositories. Use environment variables and keep keys server-side only.
API Endpoints
/pasteCreate a new encrypted paste
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | Encrypted paste content |
| expiry | string | Yes | "1h", "1d", "7d", "30d", "never", or ISO date |
| language | string | No | Syntax highlighting language |
| password | string | No | Password protection |
| customUrl | string | No | Custom URL slug (premium) |
| burnAfterRead | boolean | No | Delete after first view |
Expiry Options
"1h"- Expires in 1 hour"1d"- Expires in 1 day (24 hours)"7d"- Expires in 7 days"30d"- Expires in 30 days"never"- Never expires (paste persists indefinitely)"2025-12-31T23:59:59Z"- Custom ISO 8601 date/time
Response
{
"success": true,
"id": "abc123xy",
"url": "https://cloakbin.com/abc123xy",
"expiresAt": "2024-01-15T12:00:00Z"
}Examples
curl -X POST https://cloakbin.com/api/v1/paste \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "U2FsdGVkX1...",
"language": "javascript",
"expiry": "24h",
"burnAfterRead": false
}' /paste/:idGet paste metadata (not content - requires client-side decryption)
Response
{
"success": true,
"paste": {
"id": "abc123xy",
"language": "javascript",
"createdAt": "2024-01-14T12:00:00Z",
"expiresAt": "2024-01-15T12:00:00Z",
"hasPassword": false,
"burnAfterRead": false
}
}Examples
curl -X GET https://cloakbin.com/api/v1/paste/abc123xy \
-H "Authorization: Bearer YOUR_API_KEY" /paste/:idDelete a paste (must be owner)
Response
{
"success": true
}Examples
curl -X DELETE https://cloakbin.com/api/v1/paste/abc123xy \
-H "Authorization: Bearer YOUR_API_KEY" Rate Limits
API requests are rate-limited per API key to ensure fair usage and system stability.
| Endpoint | Rate Limit |
|---|---|
| POST /paste | 60 requests/minute |
| GET /paste/:id | 120 requests/minute |
| DELETE /paste/:id | 30 requests/minute |
Rate Limit Headers
Every API response includes rate limit information in the headers:
- X-RateLimit-Limit: Maximum requests per window
- X-RateLimit-Remaining: Requests remaining in current window
- X-RateLimit-Reset: Time when the rate limit resets (Unix timestamp)
Error Codes
The API uses standard HTTP status codes to indicate success or failure. Error responses include a JSON body with details.
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Paste created successfully |
| 400 | Bad Request | Invalid request parameters or body |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Premium subscription required |
| 404 | Not Found | Paste not found or expired |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error occurred |
Error Response Format
{
"success": false,
"error": "Detailed error message"
}Need Help?
If you have questions or need assistance with the API, visit your API key settings to manage your API keys or upgrade to premium.