API Reference

GET /

Return the index page.

GET /<name>[.<ext>] or /<name>/<filename>[.<ext>]

Fetch the paste with name <name>. By default, it will return the raw content of the paste.

The Content-Type header is set to text/plain;charset=UTF-8. If <ext> is given, the worker will infer mime-type from <ext> and change Content-Type. This method accepts the following query string parameters:

The Content-Disposition header is set to inline by default. But can be overriden by ?a query string. If the paste is uploaded with filename, or <filename> is set in given request URL, Content-Disposition is appended with filename* indicating the filename (with <ext> if it exists).

Examples: GET /abcd?lang=js, GET /abcd?mime=application/json.

If error occurs, the worker returns status code different from 200:

Usage example:

$ curl https://pastebin.angelrose.us.kg/i-p-
https://web.archive.org/web/20210328091143/https://mp.weixin.qq.com/s/5phCQP7i-JpSvzPEMGk56Q

$ curl https://pastebin.angelrose.us.kg/~panty.jpg | feh -

$ firefox 'https://pastebin.angelrose.us.kg/kf7z?lang=nix'

$ curl 'https://pastebin.angelrose.us.kg/~panty.jpg?mime=image/png' -w '%{content_type}' -o /dev/null -sS
image/png;charset=UTF-8

GET /<name>:<passwd>

Return the web page to edit the paste of name <name> and password <passwd>.

If error occurs, the worker returns status code different from 200:

GET /u/<name>

Redirect to the URL recorded in the paste of name <name>.

If error occurs, the worker returns status code different from 302:

Usage example:

$ firefox https://pastebin.angelrose.us.kg/u/i-p-

$ curl -L https://pastebin.angelrose.us.kg/u/i-p-

GET /a/<name>

Return the HTML converted from the markdown file stored in the paste of name <name>. The markdown conversion follows GitHub Flavored Markdown (GFM) Spec, supported by remark-gfm.

Syntax highlighting is supported by prims.js. LaTeX mathematics is supported by MathJax.

If error occurs, the worker returns status code different from 200:

Usage example:

# Header 1
This is the content of `test.md`

<script>
alert("Script should be removed")
</script>

## Header 2

| abc | defghi |
:-: | -----------:
bar | baz

**Bold**, `Monospace`, *Italics*, ~~Strikethrough~~, [URL](https://github.com)

- A
 - A1
 - A2
- B

![Panty](https://pastebin.angelrose.us.kg/~panty.jpg)

1. first
2. second

> Quotation

$$
\int_{-\infty}^{\infty} e^{-x^2} = \sqrt{\pi}
$$

$ curl -Fc=@test.md -Fn=test-md https://pastebin.angelrose.us.kg

$ firefox https://pastebin.angelrose.us.kg/a/~test-md

POST /

Upload your paste. It accept parameters in form-data:

POST method returns a JSON string by default, if no error occurs, for example:

{
    "url": "https://pastebin.angelrose.us.kg/abcd",
    "admin": "https://pastebin.angelrose.us.kg/abcd:w2eHqyZGc@CQzWLN=BiJiQxZ",
    "expire": 100,
    "isPrivate": false
}

Explanation of the fields:

If error occurs, the worker returns status code different from 200:

Usage example:

$ curl -Fc="kawaii" -Fe=300 -Fn=hitagi https://pastebin.angelrose.us.kg  # uploading some text
{
  "url": "https://pastebin.angelrose.us.kg/~hitagi",
  "admin": "https://pastebin.angelrose.us.kg/~hitagi:22@-OJWcTOH2jprTJWYadmDv",
  "isPrivate": false,
  "expire": 300
}

$ curl -Fc=@panty.jpg -Fn=panty -Fs=12345678 https://pastebin.angelrose.us.kg   # uploading a file
{
  "url": "https://pastebin.angelrose.us.kg/~panty",
  "admin": "https://pastebin.angelrose.us.kg/~panty:12345678",
  "isPrivate": false
}

# because `curl` takes some characters as filed separator, the fields should be
# quoted by double-quotes if the field contains semicolon or comma
$ curl -Fc=@panty.jpg -Fn='"hi/hello;g,ood"' -Fs=12345678 https://pastebin.angelrose.us.kg
{
  "url": "https://pastebin.angelrose.us.kg/~hi/hello;g,ood",
  "admin": "https://pastebin.angelrose.us.kg/~hi/hello;g,ood:QJhMKh5WR6z36QRAAn5Q5GZh",
  "isPrivate": false
}

PUT /<name>:<passwd>

Update you paste of the name <name> and password <passwd>. It accept the parameters in form-data:

The returning of PUT method is the same as POST method.

If error occurs, the worker returns status code different from 200:

Usage example:

$ curl -X PUT -Fc="kawaii~" -Fe=500 https://pastebin.angelrose.us.kg/~hitagi:22@-OJWcTOH2jprTJWYadmDv
{
  "url": "https://pastebin.angelrose.us.kg/~hitagi",
  "admin": "https://pastebin.angelrose.us.kg/~hitagi:22@-OJWcTOH2jprTJWYadmDv",
  "isPrivate": false,
  "expire": 500
}

$ curl -X PUT -Fc="kawaii~" https://pastebin.angelrose.us.kg/~hitagi:22@-OJWcTOH2jprTJWYadmDv
{
  "url": "https://pastebin.angelrose.us.kg/~hitagi",
  "admin": "https://pastebin.angelrose.us.kg/~hitagi:22@-OJWcTOH2jprTJWYadmDv",
  "isPrivate": false
}

DELETE /<name>:<passwd>

Delete the paste of name <name> and password <passwd>. It may take seconds to synchronize the deletion globally.

If error occurs, the worker returns status code different from 200:

Usage example:

$ curl -X DELETE https://pastebin.angelrose.us.kg/~hitagi:22@-OJWcTOH2jprTJWYadmDv
the paste will be deleted in seconds

$ curl https://pastebin.angelrose.us.kg/~hitagi
not found