REST API
All endpoints live under https://agentdocs.page. Errors always look like { "error": { "code": "FILE_TOO_LARGE", "message": "...", "requestId": "..." } }.
API Key
After signing in, create one under Settings → API keys. Keys start with adk_ and are shown only once; a revoked key stops working immediately. Send it in the Authorization: Bearer header.
Permissions (scopes): docs:read to read, docs:write to create and edit, docs:share to change visibility, docs:delete to delete. A missing permission returns 403.
A key can also be limited to some documents: all documents (default), only documents the key created, or documents you choose (each with its sub-documents). Set it when creating the key or later with "Change access". Documents outside the limit answer exactly like missing ones (404) and are left out of lists and searches; a key limited to chosen documents can only create documents under one of them (parent_id, otherwise 403).
Creating a document
curl -H "Authorization: Bearer $AGENTDOCS_API_KEY" -H "Content-Type: application/json" \
-d '{"filename":"report.md","content":"# Report"}' https://agentdocs.page/api/docs
On success you get 201 (excerpt):
{
"id": "…",
"filename": "report.md",
"format": "md",
"visibility": "unlisted",
"headRevision": 1,
"viewerUrl": "https://agentdocs.page/d/…",
"rawUrl": "https://agentdocs.page/d/…/raw"
}
Send viewerUrl to people; agents fetch the source from rawUrl. New documents are unlisted by default: anyone with the link can read them, and search engines don't index them.
When storage usage passes 80% of the free tier, writes return 503. error.code is still STORAGE_UNAVAILABLE, and message explains that writes are paused. This is not rate limiting and never returns 429.
Links and reading
Each document has exactly two links:
- Reading link
https://agentdocs.page/d/<id>: for people. - Source link
https://agentdocs.page/d/<id>/raw: for agents; returns plain text and needs no JavaScript.
| Method and path | Description | Auth |
|---|---|---|
GET /d/:id |
Reading page. Returns the source when sent Accept: text/markdown or an Accept starting with text/plain |
None for unlisted / public; owner only for private |
GET /d/:id/raw |
Source, text/plain; charset=utf-8, whatever the document's format |
Same as above |
GET /api/docs/:id |
JSON: metadata and source |
Same as above |
GET /api/docs |
Your own documents; with q, searches titles and content |
docs:read |
PATCH /api/docs/:id |
Edit content, rename or change visibility, with base_revision; see MCP setup for edit semantics |
docs:write (changing visibility needs docs:share) |
DELETE /api/docs/:id |
Move to the trash, with its sub-documents; the links return 404 right away |
docs:delete |
POST /api/docs/:id/undelete |
Restore from the trash | docs:delete |
GET /api/docs/trash |
Documents in your trash, with when each is permanently deleted | docs:read |
GET /api/health |
{ ok, version } |
None |
Pass parent_id when creating to make a sub-document. Documents stay in the trash for 30 days and are then deleted for good. Permanent deletion and emptying the trash are only available to a signed-in person on the website; API keys and MCP clients can't do them.
Links contain only the document ID, so renaming or moving a document never changes them. The old /d/:id.md, ?raw and v0.1 /f/:id links are no longer served.
Error codes
| Code | Status | Meaning |
|---|---|---|
BAD_REQUEST |
400 | Malformed request (missing filename, invalid body, etc.) |
UNAUTHORIZED |
401 | Key missing or invalid |
FORBIDDEN |
403 | The key lacks the permission (scope) needed; cross-origin preflight requests are always refused |
NOT_FOUND |
404 | The document doesn't exist, was deleted, you can't read it, or the ID is malformed |
REVISION_CONFLICT |
409 | The document's base_revision isn't the current revision (also returned when permanently deleting a document that isn't in the trash) |
COLLAB_ACTIVE |
409 | The document is being edited live in several sessions and a full replacement would overwrite unsaved edits; use find-and-replace or retry later |
FILE_TOO_LARGE |
413 | Larger than 1 MiB |
UNSUPPORTED_FORMAT |
415 | The extension isn't on the allow list |
INVALID_TEXT |
422 | Not valid UTF-8 or contains NUL bytes |
EDIT_FAILED |
422 | A document edit's old_str matched nothing or more than once |
RATE_LIMITED |
429 | Rate limit reached |
INTERNAL_ERROR |
500 | Server error |
STORAGE_UNAVAILABLE |
503 | Storage is temporarily unavailable and can be retried; also used when the usage breaker pauses writes, with the reason in the message |
See Supported formats and Limits & privacy for formats and sizes.