PASTES.IO FOR DEVELOPERS

A paste API you can try right here.

Create, retrieve, search, and delete pastes over a small HTTP API. Use the live playground, copy a cURL request, then move the same call into your application or CLI.

Base URLhttps://pastes.io
AuthenticationBearer API key
Request bodiesJSON or form data
QUICKSTART

Create your first paste

Create an API key in your profile, place it in an environment variable, and send JSON to /api/paste.

curl --request POST \
  'https://pastes.io/api/paste' \
  --header 'Authorization: Bearer $PASTES_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"title":"Hello from the API","content":"Hello, world!","syntax":"txt","expire":"1M"}'

Keep API keys out of source control and logs. Send them in the Authorization header, never in a query string.

Not writing HTTP calls by hand? The pastes CLI does the same thing in one command: cat error.log | pastes.

COMMAND LINE

Prefer the terminal?

The pastes CLI wraps this API so you can pipe a command's output straight into a link. It prints only the paste URL on stdout, so it composes with other tools, and pastes login works over SSH on machines with no browser.

npm install -g pastes
pastes login

./deploy.sh 2>&1 | pastes

It is open source and MIT licensed. Read the CLI documentation for the full command reference, options, and CI setup, or browse the source.

AUTHENTICATION

Bearer API keys

Authenticate a request with this HTTP header:

Authorization: Bearer YOUR_API_KEY

Key required

Creating, listing/searching, and deleting pastes require an API key.

Key optional for reads

Public paste reads work without a key. Include one so your account plan and quota are applied instead of the caller's IP quota.

LIMITS

Rate limits and daily quotas

Daily limits reset at 00:00 UTC. Paste creation limits are shared between the website and API for the same user or anonymous client.

PlanPaste creationAPI reads + searchesPaste size
Free / anonymous2 per 5 minutes
20 per UTC day
100 per UTC day, shared1 MB
Pro50 per 5 minutes
500 per UTC day
Unlimited25 MB

Paste size is the combined text and attachment size in upload flows that support attachments. The current create API accepts text content only.

Responses may include RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset. A 429 response also includes Retry-After, in seconds.

Send a real request

Requests go directly from this page to the Pastes.io API.

pastes.io only
Checking your profile for an API key… The key is kept only in this page and is never placed in the URL.
Endpoint
POST /api/paste
This endpoint requires an API key.
cURL
curl --request POST \
  'https://pastes.io/api/paste' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer $PASTES_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"title":"Hello from the API","content":"Created from the Pastes.io API playground.","syntax":"txt","expire":"1M"}'
ENDPOINTS

API reference

JSON examples show the important fields. Read responses can include additional metadata such as timestamps, extension, status, user, and attachments.

POST/api/paste

Create a paste

Requires an API key. Accepts application/json, multipart form data, or URL-encoded form data.

FieldRequiredDescription
titleYesTitle for the paste.
contentYesText content. The current API create endpoint does not upload attachments.
syntaxNoLanguage slug such as txt, javascript, python, or markdown. Defaults to txt.
expireNoDefaults to 1M. Free accounts must use 1M. Pro also supports 10M, 1H, 1D, 1W, 2W, 6M, 1Y, N, and SD.
passwordNoPassword used to protect the paste.
{
  "success": {
    "messages": "Paste successfully created",
    "slug": "hello-from-the-api-123",
    "paste_url": "https://pastes.io/hello-from-the-api-123"
  }
}
GET/api/pastes/:slug

Get a paste

Returns paste content and metadata. An API key is optional. Password-protected pastes return 401; use the POST form below for those pastes.

{
  "success": {
    "title": "Hello from the API",
    "slug": "hello-from-the-api-123",
    "syntax": "txt",
    "content": "Hello, world!",
    "views": 0,
    "url": "https://pastes.io/hello-from-the-api-123"
  }
}
POST/api/pastes/:slug

Get a password-protected paste

An API key is optional. Send the paste password in a JSON or form-data body.

{ "password": "your-paste-password" }
DELETE/api/pastes/:slug

Delete a paste

Requires an API key belonging to the paste owner. Deletion is permanent. A successful request returns { "success": "Paste successfully deleted" }.

GET/raw/:slug

Get raw content

Returns text/plain instead of JSON. This is a website content route, not an API-key endpoint: it uses the normal Pastes.io session and is generally a Pro feature. Password-protected pastes accept an x-password header. Prefer the header over putting a password in the URL.

ERRORS

HTTP status codes

400Invalid request or plan-restricted option
401Missing key or invalid paste password
403The authenticated user cannot perform the action
404Paste not found, unavailable, or expired
429Rate limit or daily quota exceeded
503Temporary service or quota-enforcement failure

Need more room for automation?

Pro raises creation limits and removes the API read/search quota.

Compare plans