← Back to PasteVault

📋 PasteVault API

Complete API documentation for PasteVault - Secure text sharing service

🔗 Base URL

https://pastevault-saas.nwaojeiedgar.workers.dev

🚀 Features

🔐 Password Protection

Encrypt your pastes with AES-256 encryption

🎨 Syntax Highlighting

Support for 20+ programming languages

🔗 Custom URLs

Create memorable, custom URLs for your pastes

📊 Usage Tracking

Server-side usage limits with IP fingerprinting

⏰ Auto-Expiry

Automatic deletion after specified time

📈 View Counting

Track how many times your paste has been viewed

📝 Create Paste

POST /api/paste

Parameters:

content string (required)
language string (optional)
password string (optional)
customUrl string (optional)
expiry string (required)

Request Example:

{
  "content": "console.log('Hello, World!');",
  "language": "javascript",
  "password": "mysecret123",
  "customUrl": "my-awesome-code",
  "expiry": "1d"
}

Success Response:

201 Created
{
  "id": "my-awesome-code",
  "usage": {
    "used": 5,
    "limit": 10,
    "remaining": 5
  }
}

Error Responses:

429 Too Many Requests
{
  "error": "Monthly limit reached",
  "message": "You've reached your monthly limit of 10 pastes",
  "upgradeUrl": "https://pastevault-saas-landing.pages.dev#pricing"
}
413 Payload Too Large
{
  "error": "Content too large",
  "message": "Content must be less than 1KB for free plan"
}

📖 Get Paste

GET /api/paste/{pasteId}

Success Response:

200 OK
{
  "content": "console.log('Hello, World!');",
  "language": "javascript",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "expiresAt": "2024-01-16T10:30:00.000Z",
  "views": 5,
  "encrypted": false
}

Password Protected Response:

200 OK
{
  "encrypted": true,
  "language": "javascript",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "expiresAt": "2024-01-16T10:30:00.000Z",
  "views": 0
}

🔓 Verify Password

POST /api/paste/{pasteId}/verify

Parameters:

password string (required)

Request Example:

{
  "password": "mysecret123"
}

Success Response:

200 OK
{
  "content": "console.log('Hello, World!');",
  "language": "javascript",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "expiresAt": "2024-01-16T10:30:00.000Z",
  "views": 1
}

Error Response:

401 Unauthorized
{
  "error": "Incorrect password"
}

📊 Get Usage

GET /api/usage

Success Response:

200 OK
{
  "used": 5,
  "limit": 10,
  "remaining": 5,
  "plan": "free"
}

💳 Stripe Integration

POST /api/create-checkout-session

Parameters:

priceId string (required)
planType string (optional)

Request Example:

{
  "priceId": "price_1RoLaZFPVsTFburHTmqLOJBu",
  "planType": "pro"
}

Success Response:

200 OK
{
  "url": "https://checkout.stripe.com/pay/cs_test_..."
}

📋 Supported Languages

Programming

JavaScript, Python, Java, C++, C#, PHP, Ruby, Go, Rust

Web

HTML, CSS, JSON, XML, YAML

Data

SQL, Markdown

Shell

Bash, PowerShell

⏰ Expiry Options

1 Hour

Perfect for temporary sharing

1 Day

Default option for most use cases

7 Days

Extended sharing for longer projects

🔒 Rate Limits

Free Plan

10 pastes/month, 1KB max size

Pro Plan

100 pastes/month, 10KB max size

Team Plan

1000 pastes/month, 100KB max size