> For the complete documentation index, see [llms.txt](https://wanitools.gitbook.io/wani-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wanitools.gitbook.io/wani-docs/paste/api-reference.md).

# API Reference

Base: `https://api.woojiee.lol/paste`

## Public

| Method | Path                | Description                                                                                                   |
| ------ | ------------------- | ------------------------------------------------------------------------------------------------------------- |
| GET    | `/paste`            | Editor page.                                                                                                  |
| POST   | `/paste`            | Create. Body: `{content, language?, title?, expires?, password?}` → `{ok, id, url, raw, deleteKey, account}`. |
| GET    | `/paste/:id`        | View page. `?format=json` for JSON, `?raw=1` for raw.                                                         |
| GET    | `/paste/raw/:id`    | Raw `text/plain`. `?pw=` for protected.                                                                       |
| GET    | `/paste/:id/meta`   | Metadata only (no view bump, no content).                                                                     |
| POST   | `/paste/:id/unlock` | `{password}` → `{ok, content}` for protected pastes.                                                          |
| POST   | `/paste/:id/delete` | `{key}` → `{ok}`. Delete key **or** owning account.                                                           |
| GET    | `/paste/health`     | Service health.                                                                                               |

## Accounts

| Method | Path                  | Description                            |
| ------ | --------------------- | -------------------------------------- |
| POST   | `/paste/api/register` | `{username, password}` → sets session. |
| POST   | `/paste/api/login`    | `{username, password}` → sets session. |
| GET    | `/paste/api/me`       | `{user}` (null when logged out).       |
| GET    | `/paste/api/mine`     | `{pastes}` for the logged-in user.     |
| GET    | `/paste/logout`       | Clears the session.                    |

## `expires` values (seconds)

`0` (never) · `600` · `3600` · `86400` · `604800` · `2592000`. Any other value is treated as never.

### Example: create a paste

```bash
curl -X POST https://api.woojiee.lol/paste \
  -H "Content-Type: application/json" \
  -d '{"content":"token1\ntoken2","language":"plaintext","expires":86400}'
```
