Pastebin API
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
Example 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
Matrix Score Breakdown
Partially tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →ddownload
ddownload is a file hosting and sharing service that exposes an API for uploading files, checking account stats, and managing stored files programmatically.
Filestack
Filestack is a file handling API that lets you upload, transform, and deliver files from any source — local disk, URL, cloud storage, or social network.
GoFile
⭐ Beginner's PickGoFile is a free file hosting API that lets you upload files of any size without an account and receive a generated download link in return.
Gyazo
Gyazo is a screenshot hosting API that accepts an image upload and returns a permanent shareable URL with associated metadata like capture time and application info.
Imgbb
⭐ Beginner's PickImgbb is a free image hosting API that accepts an image via URL, base64 string, or multipart upload and returns a permanent hosted link along with thumbnail variants.