Skip to main content

Pastes

These are the docs for the pastes endpoint, which you can use to create and return pastes (and much more).

Paste object

This is the structure of a single paste object.

{
"id": "1m8aa9xq",
"title": "api test paste",
"createdAt": "2025-03-26T18:23:18.941Z",
"editedAt": "2025-03-26T18:23:18.941Z", // nullable
"deletesAt": "2025-03-27T18:23:18.941Z", // timestamp when the paste expires, nullable
"expiresIn": "1d",
"ownerId": "0vzj9trh", // nullable
"pinned": false,
"private": false,
"stars": 0,
"tags": ["epik"],
"pasties": [
{
"id": "96lbou8v",
"title": "untitled",
"content": "some paste content",
"language": "text"
}
]
}

These are the valid expiresIn values: never, 1h, 2h, 10h, 1d, 2d, 1w, 1m, 1y.

Get a paste

Returns a single paste.

GET /api/v3/pastes/:pasteId

To view private pastes you must be logged in as the author of the paste.

If you are not logged in or not logged in as the author of the paste the returned tags array will be empty.

To view an encrypted paste, you must provide the decryption key as an HTTP header like so:

Encryption-Key: <key>
Required scope

paste:read (if logged in)

Response
{
"id": "1m8aa9xq",
"title": "api test paste",
"createdAt": "2025-03-26T18:23:18.941Z",
"editedAt": "2025-03-26T18:23:18.941Z", // nullable
"deletesAt": "2025-03-27T18:23:18.941Z", // timestamp when the paste expires, nullable
"expiresIn": "1d",
"ownerId": "0vzj9trh", // nullable
"pinned": false,
"private": false,
"stars": 0,
"tags": ["epik"],
"pasties": [
{
"id": "96lbou8v",
"title": "untitled",
"content": "some paste content",
"language": "text"
}
]
}

Create a paste

Creates a new paste.

POST /api/v3/pastes

To create a pinned, private, or tagged paste, you must be logged in.

To create a paste that is not anonymous (anonymous: false) you must be logged in.

To create an encrypted paste, provide the Encryption-Key header.

A pinned paste can't be private or anonymous.

A private paste can't be pinned or anonymous.

A tagged paste can't be anonymous.

Required scope

paste (if not anonymous)

Request
{
"title": "some title", // optional
"expiresIn": "never", // optional (defaults to never), allowed values: never, 1h, 2h, 10h, 1d, 2d, 1w, 1m, 1y
"anonymous": false, // optional (defaults to false if logged in)
"private": false, // optional (defaults to false)
"pinned": false, // optional (defaults to false)
"encrypted": false, // optional (defaults to false)
"tags": [], // optional,
"pasties": [
{
"title": "some title", // optional
"content": "some content",
"language": "text" // optional (defaults to text)
}
]
}

Get paste stats

Returns the line count, word count and total bytes of a paste. All rules apply as getting a single paste.

GET /api/v3/pastes/:pasteId/stats
Response
{
"bytes": 891,
"lines": 21,
"pasties": {
"96lbou8v": {
"bytes": 891,
"lines": 21,
"words": 80
}
},
"words": 80
}

Get paste language stats

Returns the language statistics of a single paste. All rules apply as getting a single paste.

GET /api/v3/pastes/:pasteId/langs
[
{
"language": {
"aliases": [
"ts"
],
"codemirrorMimeType": "application/typescript",
"codemirrorMode": "javascript",
"color": "#3178c6",
"extensions": [
".ts",
".cts",
".mts"
],
"name": "TypeScript",
"tmScope": "source.ts",
"type": "programming",
"wrap": false
},
"percentage": 67.00337
},
{
"language": {
"aliases": [
"csharp",
"cake",
"cakescript"
],
"codemirrorMimeType": "text/x-csharp",
"codemirrorMode": "clike",
"color": "#178600",
"extensions": [
".cs",
".cake",
".cs.pp",
".csx",
".linq"
],
"name": "C#",
"tmScope": "source.cs",
"type": "programming",
"wrap": false
},
"percentage": 32.996635
}
]

Get the compact history of a paste

Returns the list of all edits of paste, but only the ID of that edit, and when that edit was made.

GET /api/v3/pastes/:pasteId/history_compact
Response
[
{
"editedAt": "2025-04-22T21:29:10.134Z",
"id": "c6xfkaes"
},
{
"editedAt": "2025-04-22T21:29:06.534Z",
"id": "smu5ui1w"
}
]

Get the paste at a specific edit

Returns the paste at a specific point in time based on the history ID.

GET /api/v3/pastes/:pasteId/history/:historyId
Response

It returns the exact same data as getting a single paste.

Get the diff of the paste at a certain edit

Returns the diff of the paste at a certain point in the history with the version before the specified edit.

GET /api/v3/pastes/:pasteId/history/:historyId/diff
Response
{
"currentPaste": {}, // the latest paste data irrelevant of the edits, same object as getting a single paste
"newPaste": {
"editedAt": "...",
"id": "...",
"title": "...",
"pasties": []

},
"oldPaste": {
"editedAt": "...",
"id": "...",
"title": "...",
"pasties": []
}
}

Download the paste as a zip file

Downloads the entire paste as a single zip file. You must be logged in if it's a private paste.

GET /api/v3/pastes/:pasteId.zip
Response

A single zip file.

Check if the paste is encrypted

Checks if the paste is encrypted. If the paste is private you must be logged in as the author of the paste.

GET /api/v3/pastes/:pasteId/encrypted
Response

A single string: true or false

Check if you starred a paste

Checks if you starred a paste. You must be logged in.

GET /api/v3/pastes/:pasteId/star
Response

A single string: true or false

Star a paste

Stars a paste. If you already starred the paste, you wil unstar it. You must be logged in.

POST /api/v3/pastes/:pasteId/star

Pin a paste

Pins a paste on your profile. If you already starred the paste, you wil unstar it. You must be logged in as the author of the paste, since you can only pin your own pastes.

POST /api/v3/pastes/:pasteId/pin

You can't pin a paste that's private.

Required scope

user

Set a paste to be private

Sets a paste to be private. If the paste is already private, it will make it public. You must be logged in as the author of the paste.

POST /api/v3/pastes/:pasteId/private

You can't set a paste to be private if it's pinned.

Required scope

paste

Edit a paste

Edits a single paste. You must be logged in as the author of the paste.

PATCH /api/v3/pastes/:pasteId

To edit an existing pasty, in the pasties array provide the ID of the existing pasty.

If you don't provide a pasty ID that exists in the original paste, it will be deleted.

If you provide a pasty without an ID, it will be created as a new one.

Required scope

paste

Request
{
"title": "new paste title",
"pasties": [
{
"id": "id of an existing pasty",
"title": "new pasty title",
"content": "new pasty content",
"language": "new pasty language"
}
]
}
Response

Returns the new edited paste, same as getting as single paste

Edit the tags of a paste

Edits the tags of a paste. You must be logged in as the author of the paste.

PATCH /api/v3/pastes/:pasteId/tags
Required scope

paste

Request
["tag1", "tag2"]
Response

Returns the new edited paste, same as getting as single paste

Delete a paste

Delete a single paste. You must be logged in as the author of the paste.

DELETE /api/v3/pastes/:pasteId
Required scope

paste