Pastebin API

⭐ Beginner's Pick Cloud Storage & File Sharing / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

Pastebin's API lets you create, read, and delete pastes — snippets of text or code stored at a shareable URL — programmatically. You can set expiry times, visibility (public, unlisted, private), and syntax highlighting language when creating a paste. It is commonly used for logging crash reports, sharing config snippets from CLI tools, or storing small text outputs in automated pipelines.

💡

Beginner Tip

Get a free API developer key from pastebin.com/api under your account settings. Note that the POST endpoint uses form-encoded data, not JSON — use -d with curl rather than --json, and the successful response is a plain text URL, not a JSON object.

Available Data

Use case: Integrate plain text storage data into web and mobile applications
Pastebin data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "file_id": "f_abc123",
  "filename": "document.pdf",
  "size_bytes": 1048576,
  "mime_type": "application/pdf",
  "download_url": "https://example.com/files/f_abc123",
  "created_at": "2025-01-15T10:00:00Z"
}

Field Reference

response body (plain text) On success the API returns the paste URL as plain text, e.g. https://pastebin.com/abc12345 — not a JSON object
paste_key The unique key portion of the paste URL (after pastebin.com/), used to construct access and delete requests
paste_title Title of the paste as set at creation, returned when listing pastes for a user account
paste_expire_date Unix timestamp of when the paste is automatically deleted; 0 means it never expires
paste_private Visibility setting: 0 = public, 1 = unlisted, 2 = private (private pastes require a user session key)

Implementation Example

const url = "https://pastebin.com/doc_api";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Bad API request, invalid api_dev_key The API developer key is wrong or not yet activated on a new account
Copy the exact key from pastebin.com/api under "Your Unique Developer API Key" and wait a few minutes after account creation for it to activate
Bad API request, maximum number of 25 unlisted pastes Free accounts can only hold 25 unlisted pastes at once
Delete old pastes via api_option=delete or change api_paste_private to 0 (public) to bypass the unlisted limit
Post request too large Paste content exceeds 512 KB for free accounts
Truncate or compress the content before sending; the Pastebin Pro limit is 10 MB

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 10/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →