# REST API reference All v1 endpoints are under `/api/v1` and authenticate with `Authorization: Bearer pd__`. Create tokens in [API tokens](/developers/tokens). The OpenAPI 3.1 specification is at [/api/openapi.json](/api/openapi.json). **Rate limits:** new tokens default to five requests per minute. Set `rateLimitPerMinute` to a value from 1 to 600 when creating a token. Exhausted budgets return 429 with `Retry-After`, `X-RateLimit-Limit` and `X-RateLimit-Remaining: 0`. The limit can be changed later under Configure on the [API tokens](/developers/tokens) page — no need to recreate the token. **Folder scope:** every token is bound to a folder scope, defaulting to **Chaos** (the root of the file tree). Pick a different folder — including its subfolders — when creating the token or later under Configure. **There is no "All folders" option**: a token that can reach every file in the account is a token that leaks every file in the account, so submitting `scopeAll` returns 400. A `folderId` outside the scope returns 403; when `folderId` is omitted, the upload lands in the token's own folder. `GET /v1/me` reports the current scope as `folderScope` (`root`, `folder` or `missing`; `unrestricted` only appears when the call is authenticated with a session cookie rather than a token). If the scoped folder is deleted the token becomes `missing` and refuses every request — it is never silently widened, so re-point it deliberately. **Errors:** non-2xx responses use `{ "error": "", "code": "" }`. Codes are shared across endpoints; see the table below. ## Endpoints ### `GET /v1/me` Returns the token's user and authentication source. Use it to check whether a token works. ```bash curl -H "Authorization: Bearer $TOKEN" $BASE/api/v1/me ``` ```json { "user": { "id": "cm...", "email": "you@example.com", "username": "aiven", "quotaBytes": 524288000, "usedBytes": 12345, "emailVerifiedAt": "2026-05-21T10:00:00Z" }, "auth": { "source": "token", "tokenId": "cm...", "rateLimitPerMinute": 5 }, "folderScope": { "mode": "root", "folderId": null, "folderName": "Chaos", "label": "Chaos" } } ``` `folderScope.mode` is one of `root` (limited to the Chaos root), `folder` (limited to one folder and its subfolders), `missing` (the folder was deleted, so the token is denied) or `unrestricted` (not a token request, e.g. a browser session; `label` is "All folders"). ### `GET /v1/files` Lists your files. Use `?folderId=` to filter by folder. The response includes `kind` (HTML, MARKDOWN or TEXT), `scanStatus` and `shareCount`. ### `POST /v1/files` (multipart) Uploads a single `.html`, `.htm`, `.md`, `.markdown`, `.txt` or `.text` file. New URLs use `/s//`; legacy `/s/` links remain compatible. > ⚠️ **Uploading is not publishing.** A file goes straight into a security scan > (`scanStatus: PENDING`) and **a share can only be created once the scan clears** > (`CLEAN`). Calling `POST /v1/shares` before that returns `425 SCAN_PENDING` > (still scanning). If the scan service itself is down (`SCAN_ERROR`), the file stays shareable — a review that never ran is not a review that failed. > > Because of that, a `share` field sent with the upload is **not** created — the > file cannot have cleared at that point. The response carries `shareDeferred: true` > instead of a `url`. Poll until `scanStatus` is `CLEAN`, then call > `POST /v1/shares`. Overwriting an already-shared file behaves the same way: it > goes back to `PENDING` and its existing share links return `425` until the new > version passes. ```bash # 1) upload (the share block is deferred, not created) curl -H "Authorization: Bearer $TOKEN" -F "file=@notes.md;type=text/markdown" -F 'share={"expiresInDays":7,"password":"hello12"}' $BASE/api/v1/files # 2) poll until the scan clears curl -H "Authorization: Bearer $TOKEN" $BASE/api/v1/files/ # 3) only now create the share curl -X POST -H "Authorization: Bearer $TOKEN" -d '{"fileId":"","expiresInDays":7,"password":"hello12"}' $BASE/api/v1/shares ``` The default single-file limit is 4 MiB. ZIP archives, video, audio, executable files and directory bundles are not accepted. Duplicate filenames in the same folder return 409 `DUPLICATE` by default. Add the multipart field `onConflict` (`overwrite` or `rename`; omitting it means `error`) to replace or auto-rename — `overwrite` **adds a new version** to that file rather than replacing the old one. Use the multipart field `folderId` (not a URL query parameter) to pick the target folder; it must be inside the token's scope. ### `GET /v1/files/{id}` · `DELETE /v1/files/{id}` Reads file metadata or moves the file to Trash and revokes all its shares. ### `GET /v1/files/{id}/versions` Lists the stored versions of a file, newest first: `id`, `versionNum`, `kind`, `sizeBytes`, `sha256`, `scanStatus`, `createdAt`, plus `isCurrent` for the current one. A share pinned with `lockedVersionId` takes its version id from here. ### `GET /v1/shares` · `POST /v1/shares` · `GET /v1/shares/{id}` · `DELETE /v1/shares/{id}` List / create / read / revoke. `GET /v1/shares` accepts an optional `?fileId=` to list only one file's shares. Lists, creates, reads and revokes shares. Example `POST /v1/shares` body: ```json { "fileId": "cm...", "expiresInDays": 7, "password": "hello12", "maxVisits": 100, "perVisitorMaxVisits": 3, "perLoginUserMaxVisits": 2, "oneTime": false, "requireLogin": false, "slug": "weekly-report", "oneSession": false, "emailAllowlist": ["a@b.com"], "copyProtectionEnabled": false, "burnAfterReadEnabled": false } ``` | Field | Meaning | |---|---| | `expiresInDays` | Expiration in days; null means no expiration | | `expiresAt` | Absolute expiry (ISO 8601). Must be in the future and no more than 3650 days out, otherwise 400. Wins over `expiresInDays` when both are sent; null means no expiration | | `password` | Access password; null means no password | | `maxVisits` | Total visit limit | | `perVisitorMaxVisits` | Limit per unique visitor; null means unlimited | | `perLoginUserMaxVisits` | Limit per signed-in account; visitors must sign in | | `oneTime` | When true, forces `maxVisits=1` | | `requireLogin` | Require a PageDrop account to view the share | | `slug` | Custom slug: 3–32 base62 characters plus `-` and `_` | | `oneSession` | Restrict access to one browser session | | `emailAllowlist` | Require sign-in and an email on this list | | `ipAllowlist` | Only these IPs or CIDR ranges (IPv4 / IPv6, up to 100) can open the share; everyone else gets 403. Stacks with password, login and the other rules | | `copyProtectionEnabled` | Block copying, cutting, dragging, selection and the context menu (inputs stay selectable). It does not stop screenshots | | `watermarkEnabled` | Overlay a watermark on the rendered page | | `watermarkText` | Watermark text, at most 80 characters | | `burnAfterReadEnabled` | Burn after read: paragraphs the reader scrolls past are cleared and covered with "已阅内容不可回看", and the scroll position is kept in that browser's local storage so a reload resumes from there. Scrolling back is only restricted once something has actually been burned — a page with nothing to burn scrolls freely. The file itself is never deleted — a different browser still sees the content | | `lockedVersionId` | Pin the share to one specific version of the file (a `FileVersion.id`), so later edits do not change what readers see. The version must belong to the file being shared, otherwise 400. Take the id from `GET /v1/files/{id}/versions` | Share options are optional. The response is `{ share, url }`, where `url` is an absolute viewing URL. `POST /v1/shares` accepts `lockedVersionId`: the version must belong to the file being shared, otherwise 400 `VALIDATION`. Without it, the share always serves the file's current version. `visitCount` counts successful main-page renders. `uniqueVisitCount` counts unique visitors using a rendering-domain cookie; before a cookie exists, an anonymized IP prefix and User-Agent establish the initial identity. ### `POST /v1/validate` Validates content without storing it. Use it to check agent-generated text before uploading. ```bash curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"content":"# hi","kind":"MARKDOWN"}' $BASE/api/v1/validate ``` Response: `{ ok: boolean, normalized: string, issues: [{ level, message, line? }] }`. Levels are `error` (makes `ok=false`), `warning` and `info`. Normalization converts CRLF to LF, tabs to four spaces, strips BOM and trims trailing whitespace, except the two trailing spaces that mark a Markdown hard line break. ### `POST /api/abuse-reports` (report a share, no auth) Anyone can report a share link; no PageDrop account is needed. The request body is JSON: | Field | Required | Meaning | |---|---|---| | `token` | yes | The share token, a `/s/{token}` path, or the full share URL | | `reason` | yes | `PHISHING`, `MALWARE`, `ILLEGAL`, `COPYRIGHT` or `OTHER`. Any other value returns 400 | | `details` | yes | Free-text description: 10–2000 characters after trimming | | `reporterEmail` | no | Reporter's email; ignored when malformed | ```bash curl -X POST https://pagedrop.space/api/abuse-reports -H 'Content-Type: application/json' -d '{"token":"abcd1234","reason":"PHISHING","details":"The page impersonates a bank sign-in and asks for a password."}' ``` Success returns `{ "ok": true, "reportId": "..." }`. Failures: 400 for a malformed body, an unrecognised token, an invalid reason, or details outside 10–2000 characters; 429 `RATE_LIMITED` when one IP sends more than 5 reports per hour, with `Retry-After` giving the wait in seconds. A report for an unknown token is still recorded so an admin can look into it. ## Error codes | code | HTTP | Meaning | |---|---|---| | `UNAUTHENTICATED` | 401 | Missing, invalid or revoked token | | `FORBIDDEN` | 403 | Authenticated but not permitted | | `NOT_FOUND` | 404 | Resource missing or owned by another user | | `VALIDATION` | 400 | Invalid body or parameters | | `RATE_LIMITED` | 429 | The token's configured rate budget is exhausted | | `OVER_QUOTA` | 413 | File too large or account storage full | | `INFECTED` | 409 | File marked as unsafe by ClamAV | | `SCAN_PENDING` | 425 | File is still being security-scanned; retry shortly | | `SLUG_TAKEN` | 409 | Custom URL slug already used | | `DUPLICATE` | 409 | Filename already exists in the folder | | `INTERNAL` | 500 | Server error, recorded in logs and Sentry | ## CORS v1 responses include `Access-Control-Allow-Origin: *` and allow the `Authorization` and `Content-Type` headers. Cross-origin browser clients can authenticate with Bearer tokens. `Allow-Credentials` is intentionally absent, so session cookies are not sent across origins. ## Try it Use the [Playground](/developers/playground) to select an endpoint, enter parameters and send a request using your token or signed-in session.