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.
https://pastes.ioBearer API keyJSON or form dataCreate 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.
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 | pastesIt is open source and MIT licensed. Read the CLI documentation for the full command reference, options, and CI setup, or browse the source.
Bearer API keys
Authenticate a request with this HTTP header:
Authorization: Bearer YOUR_API_KEYKey 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.
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.
| Plan | Paste creation | API reads + searches | Paste size |
|---|---|---|---|
| Free / anonymous | 2 per 5 minutes 20 per UTC day | 100 per UTC day, shared | 1 MB |
| Pro | 50 per 5 minutes 500 per UTC day | Unlimited | 25 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.
/api/pastecurl --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"}'API reference
JSON examples show the important fields. Read responses can include additional metadata such as timestamps, extension, status, user, and attachments.
/api/pasteCreate a paste
Requires an API key. Accepts application/json, multipart form data, or
URL-encoded form data.
| Field | Required | Description |
|---|---|---|
title | Yes | Title for the paste. |
content | Yes | Text content. The current API create endpoint does not upload attachments. |
syntax | No | Language slug such as txt, javascript, python, or markdown. Defaults to txt. |
expire | No | Defaults to 1M. Free accounts must use 1M. Pro also
supports 10M, 1H, 1D, 1W, 2W, 6M, 1Y, N, and SD. |
password | No | Password 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"
}
}/api/pastes/:slugGet 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"
}
}/api/pastes/:slugGet a password-protected paste
An API key is optional. Send the paste password in a JSON or form-data body.
{ "password": "your-paste-password" }/api/pastes?q=:query&page=:pageList or search your pastes
Requires an API key. Leave q empty to list your pastes. Each page contains up
to 50 results; page defaults to 1.
q— optional title/content search text allowed by your plan.page— optional positive integer.
/api/pastes/:slugDelete a paste
Requires an API key belonging to the paste owner. Deletion is permanent. A successful
request returns { "success": "Paste successfully deleted" }.
/raw/:slugGet 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.
HTTP status codes
400Invalid request or plan-restricted option401Missing key or invalid paste password403The authenticated user cannot perform the action404Paste not found, unavailable, or expired429Rate limit or daily quota exceeded503Temporary service or quota-enforcement failureNeed more room for automation?
Pro raises creation limits and removes the API read/search quota.