Lenpaste

About

Docs

Settings

Documentation / API v1

Table of content

POST /api/v1/new

Request parameters:

Field Required? Default Description
title Paste title.
body Yes Paste text.
lineEnd LF Line end in the text of the excerpt will automatically be replaced by the one specified by this parameter. Can be LF, CRLF or CR.
syntax plaintext Syntax highlighting in paste. A list of available syntaxes can be obtained using the getServerInfo method.
oneUse false If it is true, the paste can be opened only once and then it will be deleted.
expiration 0 Indicates expiration of paste in seconds. If this parameter is 0, the storage time will be unlimited.
author Author name.
authorEmail Author email.
authorURL Author URL.

Response example:

1{
2	"id": "XcmX9ON1"
3}

GET /api/v1/get

Request parameters:

Field Required? Default Description
id Yes Paste ID.
openOneUse false If true, the entire contents of the paste will be returned, after which it will be deleted. If false, the API will return only id and oneUse, and the paste will not be deleted.

Response example:

 1{
 2	"id": "XcmX9ON1",
 3	"title": "Paste title.",
 4	"body": "Line 1.\nLine 2.\nLine 3.\n\nLine 5.",
 5	"createTime": 1653387358,
 6	"deleteTime": 0,
 7	"oneUse": false,
 8	"syntax": "plaintext",
 9	"author": "Anon",
10	"authorEmail": "me@example.org",
11	"authorURL": "https://example.org"
12}
 1{
 2	"id": "5mqqHZRg",
 3	"title": "",
 4	"body": "",
 5	"createTime": 0,
 6	"deleteTime": 0,
 7	"oneUse": true,
 8	"syntax": "",
 9	"author": "",
10	"authorEmail": "",
11	"authorURL": ""
12}

GET /api/v1/getServerInfo

Response example:

 1{
 2	"version": "0.2-60-g3fcc9ce",
 3	"titleMaxlength": 100,
 4	"bodyMaxlength": 10000,
 5	"maxLifeTime": -1,
 6	"serverAbout": "<p>1 2 3 4</p>\n",
 7	"serverRules": "",
 8	"adminName": "Vasya Pupkin",
 9	"adminMail": "me@example.org",
10	"syntaxes": [
11		"ABAP",
12		"ABNF",
13		"AL",
14		"ANTLR",
15		"APL",
16		"ActionScript",
17		"ActionScript 3",
18		"Ada",
19		"Angular2",
20		"ApacheConf",
21		"AppleScript",
22		"Arduino",
23		"ArmAsm",
24		"Awk"
25	]
26}

Possible API errors

This API method exists on the server, but you passed the wrong arguments for it.

1{
2	"code": 400,
3	"error": "Bad Request"
4}

There is no paste with this ID.

1{
2	"code": 404,
3	"error": "Could not find ID"
4}

There is no such API method.

1{
2	"code": 404,
3	"error": "Not Found"
4}

You made a mistake with HTTP request (example: you made POST instead of GET).

1{
2	"code": 405,
3	"error": "Method Not Allowed"
4}

There was a failure on the server. Contact your server administrator to find out what the problem is.

1{
2	"code": 500,
3	"error": "Internal Server Error"
4}