📚

API Documentation

Integrate TextShare into your applications with our simple RESTful API

Getting Started

The TextShare API is a RESTful API that allows you to programmatically create pastes, upload files, shorten URLs, and more.

Base URL:

https://your-deployment-url.vercel.app/api

Replace with your actual deployment URL (e.g., textshare.vercel.app, textshare.netlify.app)

💡 Note: No authentication required. Rate limiting applied per IP address.

✨ Works perfectly on free hosting platforms (Vercel, Railway, Netlify) - no custom domain needed!

POST/api/pastes

Create Text Paste

Create a new text paste with optional password protection and expiry

Request Body:

{
  "content": "Your text content here",
  "title": "Optional title",
  "password": "optional_password",
  "expiresIn": "1h | 1d | 7d"
}

Response:

{
  "success": true,
  "slug": "abc123def456",
  "url": "https://your-deployment-url.vercel.app/p/abc123def456",
  "expiresAt": "2025-10-04T12:00:00Z"
}
POST/api/files

Upload File

Upload one or multiple files (max 10MB per file)

Request Body:

FormData with 'files' field

Response:

{
  "success": true,
  "files": [
    {
      "slug": "file123abc",
      "filename": "document.pdf",
      "size": 1024000,
      "url": "https://your-deployment-url.vercel.app/f/file123abc"
    }
  ]
}
POST/api/shorten

Shorten URL

Create a shortened URL with optional custom slug

Request Body:

{
  "url": "https://very-long-url.com/path/to/page",
  "customSlug": "optional-custom-slug",
  "expiresIn": "7d"
}

Response:

{
  "success": true,
  "slug": "abc123",
  "shortUrl": "https://your-deployment-url.vercel.app/s/abc123",
  "originalUrl": "https://very-long-url.com/path/to/page"
}
GET/api/pastes/{slug}

Get Paste

Retrieve a text paste by its slug

Response:

{
  "success": true,
  "content": "Text content",
  "title": "Paste title",
  "createdAt": "2025-10-03T12:00:00Z",
  "expiresAt": "2025-10-04T12:00:00Z",
  "hasPassword": false
}
GET/api/files/{slug}

Download File

Download a file by its slug

Response:

Binary file data with appropriate Content-Type header

Rate Limiting

To ensure fair usage, the API has the following rate limits:

  • 100 requests per 15 minutes per IP address
  • 500 requests per hour per IP address
  • File uploads limited to 10MB per file

Need Help?

Have questions about the API? We're here to help!

Contact Support