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 |
The end of a line in the paste body.
The text will be automatically recoded to match the selected end of line.
Can accept LF , CRLF or CR .
|
|
syntax |
plaintext |
Paste syntax. You can get a list of semi-retained syntaxes using the getServerInfo method. |
|
oneUse |
false |
If true then the paste is removed after opening. |
|
expiration |
0 |
The "lifetime" of the paste in seconds. To prevent the paste from expiring, simply do not set this parameter. |
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 , it will be all the contents of the paste after which it will be deleted.
If it's false , you will only get the id and oneUse , but the paste will stay on the server.
|
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}
1{
2 "id": "5mqqHZRg",
3 "title": "",
4 "body": "",
5 "createTime": 0,
6 "deleteTime": 0,
7 "oneUse": true,
8 "syntax": ""
9}
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}