API Documentation

Premium Feature

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

https://cloakbin.com/api/v1

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

Authorization: Bearer YOUR_API_KEY

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

POST /paste

Create a new encrypted paste

Request Body

FieldTypeRequiredDescription
contentstringYesEncrypted paste content
expirystringYes"1h", "1d", "7d", "30d", "never", or ISO date
languagestringNoSyntax highlighting language
passwordstringNoPassword protection
customUrlstringNoCustom URL slug (premium)
burnAfterReadbooleanNoDelete 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
  }'
GET /paste/:id

Get 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"
DELETE /paste/:id

Delete 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.

EndpointRate Limit
POST /paste60 requests/minute
GET /paste/:id120 requests/minute
DELETE /paste/:id30 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.

CodeStatusDescription
200OKRequest successful
201CreatedPaste created successfully
400Bad RequestInvalid request parameters or body
401UnauthorizedMissing or invalid API key
403ForbiddenPremium subscription required
404Not FoundPaste not found or expired
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer 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.