Using the API


Authentication and authorization

To get a permanent Api key log into your Quickpaste account, then go to Settings > Generate Api Key and click Genereate Api Key.


To authenticate when using the API include the API key in the Authorization header

    Authorization: ApiKey eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

For password protected pastes use Paste-Authorization header to send the required password:

    Paste-Authorization: sOme PaSSword1

Limits

Guest users are limited to 3 daily pastes and only 5 paste fragments per paste. Logged in users have 30 daily pastes with a limit of 500 paste fragments.

Each paste will be deleted after 1 month on no activity (will not be viewed/modified).


Paste format

Paste format used when sending paste to API

title Type: string
Length: 1-50 characters
Required
fragments Type: array
Array of paste fragments.
Min. length: 1
Required
isPrivate Type: boolean
Default: false
Optional
password Type: string
Content of password protected pastes is encrypted with AES-256. If empty string provided no passowrd is applied
Optional
    {
        "title": "Test",
        "fragments": [
            {

            }
        ],
        "isPrivate": false,
        "password": ""
    }

Paste fragment

Format for paste fragments.

name Type: string
Length: 1-50 characters
Required
content Type: string
Content of paste fragment.
Required
syntax Type: string
Default: text
text or one of supported syntaxes (see here).
Optional

Sample upload ready paste

    {
        "title": "A new post",
        "isPrivate": true,
        "password": "",
        "fragments": [
            {
                "name": "Sample text",
                "syntax": "text",
                "content": "Some sample text like Lorem Ipsum Dolores."
            }
        ]
    }

Creating a paste

    POST /api/paste

Request body schema: Paste

Sample responses:

  • 200
    {
        "ok": true,
        "result": {
            "pasteId": "AabBcCX0"
        }
    }
  • 403
    {
        "ok": false,
        "result": string
    }

Getting a paste

    GET /api/paste/{id}

Path parameters

  • id - 8 character length alphanumerical string

Sample responses:

  • 200
    {
        "title": "Sample",
        "fragments": [
            {
                "name": "Sample",
                "syntax": "text",
                "content": "Congratulations!"
            }
        ],
        "isPrivate": false,
        "created": "2022-07-28T11:30:08.572Z",
        "password": false,
        "owner": {
            "id": 0,
            "username": "anonymus"
        }
    }
  • 403
    {
        "ok": false,
        "result": string
    }
  • 404
    {
        "ok": false,
        "result": "Resource not found"
    }

Deleting a paste

    DELETE /api/paste/{id}

Path parameters

  • id - 8 character length alphanumerical string

Sample responses:

  • 200
    {
    "ok": true,
    "result": "Paste deleted"
}
  • 403
    {
        "ok": false,
        "result": string
    }
  • 404
    {
        "ok": false,
        "result": "Resource not found"
    }

Editing a paste

    PUT /api/paste/{id}

Request body schema: Paste

Path parameters

  • id - 8 character length alphanumerical string

Sample responses:

  • 200
    {
        "ok": true,
        "result": {
            "pasteId": "faQSOcNP",
            "message": "Updated paste"
        }
    }
  • 403
    {
        "ok": false,
        "result": string
    }
  • 404
    {
        "ok": false,
        "result": "Resource not found"
    }

Getting authenticated users info

    GET /api/user

Sample responses:

  • 200
    {
        "id": 2,
        "username": "jade",
        "joined": "2022-07-02T21:29:17.045Z"
    }
  • 403
    {
        "ok": false,
        "result": string
    }

Getting authenticated users pastes

    GET /api/user/pastes

Query parameters

  • amount - number of pastes to return per page | Default is 20, Optional
  • pageId - id of page to display (returned from request) | Optional

Sample responses:

  • 200
    {
    "ok": true,
    "result": {
        pastes: [
            {
                "title": "A new post",
                "isPrivate": true,
                "password": false,
                "created": "2022-07-28T11:27:47.580Z",
                "owner": {
                    "username": "reKOmo",
                    "id": 2
                },
                "uuid": "faQSOcNP"
            },
            {
                "title": "e",
                "isPrivate": false,
                "password": false,
                "created": "2022-07-28T11:25:02.333Z",
                "owner": {
                    "username": "reKOmo",
                    "id": 2
                },
                "uuid": "sHFeCQmD"
            }
        ]
    },
    nextPage: 24
}
  • 403
    {
        "ok": false,
        "result": string
    }