API Documentation
# Base URL:
```
https://paste.monster/api
```
## Error Messages
If an error occurs during a request, the server will return a JSON response containing the error code and a human readable error message.
Example:
```json
{"code": 400, "message": "The name must be between 2 and 100 characters long"}
```
## Authentication
To use the API, you need to authenticate yourself using your API key. You must use the `Authorization` HTTP header in the format `Authorization: API_KEY`.
Example:
```
Authorization: hTXg1A27vUncnVdfsNOLdFCJCjCz210q
```
## Paste object
| **Field** | **Type** | **Description** |
| --------------- | -------- | ------------------------------------------------------------ |
| id | string | ID of the paste |
| name | string | name of the paste |
| content | string | content of the paste |
| expiration | string | expiration of the paste (`10 minutes`, `1 hour`, `1 day`, `1 week`, `2 weeks`, `1 month`, `6 months`, `1 year` or `Never`) |
| exposure | string | exposure of the paste (`public`, `unlisted` or `private`) |
Example Paste
```json
{
"id": "M5f0uKLMgwTM",
"name": "Example",
"content": "Example content",
"created_at": "15/02/2024, 17:28:01",
"expiration": "6 months",
"exposure": "public",
"views": 18,
}
```
## User object
| **Field** | **Type** | **Description** |
| --------------- | ---------------------- | ------------------------------------------------------------ |
| username | str | the user's username |
| bio | ?str | the user's bio |
| flags | int | the user's flags |
| created_at | ISO8601 timestamp | when the user created its account |
| last_login | ISO8601 timestamp | when the user last logged on |
| max_paste_chars | int | The maximum number of characters that can be sent in the whole set of user pastes |
| pastes | array of Paste objects | the user's pastes |
Example User
```json
{
"username": "admin",
"bio": "Owner",
"created_at": "2025-02-14T20:14:00.015390+00:00",
"last_login": "2025-02-15T17:30:37.655769+00:00",
"max_paste_chars": 1000000,
"pastes": []
}
```
# Pastes Endpoints
## Create a paste
### POST `/create`
Create a new paste. Return a paste object on success.
JSON Params:
| **Field** | **Type** | **Description** |
| ---------------- | -------- | ------------------------------------------------------------ |
| name | string | name of the paste |
| content | string | content of the paste |
| expiration? | string | expiration of the paste, default value is `Never` |
| exposure? | string | exposure of the paste, default value is `public` |
## Get a paste
### GET `/paste/@{paste.id}`
Return the paste object of the specified paste on success.
## Edit a paste
### PATCH `/edit/{paste.id}`
Edit a paste. Return the updated paste object on success.
JSON Params:
| **Field** | **Type** | **Description** |
| ---------------- | -------- | -------------------------------------------------------- |
| id | string | ID of the paste |
| name? | string | name of the paste |
| content? | string | content of the paste |
| expiration? | string | expiration of the paste |
| exposure? | string | exposure of the paste |
## Delete a paste
### DELETE `/delete/{paste.id}`
Delete a paste permanently. Return `204 No Content` on success.
## Get your user object
### GET `/@me`
Return the user object of the current API user on success.