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

The kind of data this API exposes, based on its documentation. We could not call the endpoint to confirm the exact field names.

Use case: Integrate plain text storage data into web and mobile applications
Pastebin data via REST API

Example Response

Illustrative shape only — we were not able to call this endpoint (it requires credentials or exposes no public sample URL), so the fields below show the kind of data this API returns rather than a recorded response.

JSON Response · Illustrative
{
  "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

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://pastebin.com/api/api_post.php";
// 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

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

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

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Difficulty Intermediate
Listing details not endpoint-verified

Similar APIs

View All →