Skip to content

Pastes API

Full pastes support rich features including syntax highlighting, multiple visibility modes, expiry, burn-after-view, and client-side encryption.

Tier requirement: Paste endpoints require a Pro or Max account, except delete which is available on Free (10/mo).


Request body

FieldTypeDefaultDescription
namestringrequiredDisplay name for the paste
textstringrequiredThe text content
tagsstring''Comma-separated tags
modenumber1 (Public)Visibility: 0=Private, 1=Public, 2=Unlisted
neverExpirebooleantrueNever expire if true
expireDatestring (ISO)Expiry date (used when neverExpire is false)
burnAfterViewbooleanfalseDelete paste after first view

curl

Terminal window
curl -X POST https://api.anonpaste.com/api/dev/pastes/create \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "My Paste",
"text": "Hello, world!",
"tags": "hello,test",
"neverExpire": true
}'

Response

{
"success": true,
"id": "aB3xYz",
"remaining": 499
}

SDK

const { id } = await anonpaste.pastes.create({
name: 'My Paste',
text: 'Hello, world!',
tags: 'hello,test',
});

curl

Terminal window
curl https://api.anonpaste.com/api/dev/pastes/get/aB3xYz \
-H "x-api-key: your_api_key"

Response

{
"success": true,
"paste": {
"pasteID": 12345,
"ref": "aB3xYz",
"name": "My Paste",
"views": 3,
"encrypted": false,
"mode": 1,
"burnAfterView": false,
"content": [{ "contentType": 0, "data": "Hello, world!" }]
},
"remaining": 2999
}

Text content is stored compressed. The SDK automatically decompresses it. When using raw HTTP, the data field will be a compressed base64 string.

SDK

const paste = await anonpaste.pastes.get('aB3xYz');
console.log(paste.content[0].data); // already decompressed

Updates the text content of a paste you own.

curl

Terminal window
curl -X PUT https://api.anonpaste.com/api/dev/pastes/update/aB3xYz \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{ "text": "Updated content" }'

Response

{ "success": true, "remaining": 499 }

SDK

await anonpaste.pastes.update('aB3xYz', { text: 'Updated content' });

curl

Terminal window
curl -X DELETE https://api.anonpaste.com/api/dev/pastes/delete/aB3xYz \
-H "x-api-key: your_api_key"

Response

{ "success": true, "remaining": 499 }

SDK

await anonpaste.pastes.delete('aB3xYz');

StatusReasonDescription
400name and text are requiredMissing required fields
403API key does not have access to this pastePaste belongs to another account
404Paste not foundNo paste with that ref
429Monthly limit reached for paste.createQuota exhausted