API

There is a sample application at https://pastebinrun.gitlab.io/apibin with the source code available at https://gitlab.com/pastebinrun/apibin if you prefer practical code samples.

GET /[pasteid].txt

Example URL: https://pastebin.run/ppKB-KvhpH.txt

Retrieves a raw paste. The returned response is text/plain and doesn't contain any metadata.

Sample response:

Hello, world.

GET /api/v1/languages

Example URL: https://pastebin.run/api/v1/languages

Retrieves a JSON object listing the languages.

Sample response:

[
    {
        "identifier":"plaintext",
        "name":"Plain text"
    },
    {
        "identifier":"c",
        "name":"C"
    }
]

POST /api/v1/pastes

The API uses x-www-form-urlencoded content type. Takes the following parameters.

  • code - paste to be uploaded.

  • language - language identifier, retrieved from /api/v1/languages API. Optional, if not specified, it's assumed to be plaintext. Language identifiers are intended to be stable, and in event an identifier gets removed or renamed the old one will keep working, so you can hardcode identifiers in your application.

  • expiration - an RFC 3339 duration (a subset of ISO 8601 duration). Using months and years in durations is currently not allowed. If not specified, the paste won't expire.

    Examples:

    • P1D - paste expires in one day
    • PT1H - paste expires in one hour
    • P33DT2H - paste expires in 33 days and 2 hours
    • P4DT12H30M5S - paste expires in 4 days, 12 hours, 30 minutes, and 5 seconds