Three ways in.
All hit the same API, all write to the same git history.
Agent skill
Connection reference for existing configured users. Fresh installation has not been verified.
REST API
Direct HTTP from any language, agent harness, or automation.
CLI
Create, validate and render locally before committing to the store.
Path A — Agent skill
Install docgent-doc-access from the docgent-skills repo. The documented install flow describes requesting a per-brand token, checking it, saving it, and patching AGENTS.md so any Docgent URL routes to the skill instead of an unauthenticated fetch.
Token verification
Documented token check for an existing configured connection; this is not fresh-install verification:
Path B — REST API
Agents use a per-brand bearer token for the permitted document operations below. Status reads allow agents; status transitions require an authenticated human session. Agent bearer tokens cannot change status.
| What | Call |
|---|---|
| List a brand's documents | GET /api/docs/<brand>?status=&doctype= |
| Read (any version) | GET /api/doc/<brand>/<slug>?ref=<sha> |
| Create | PUT /api/doc/<brand>/<slug> — no baseSha |
| Update | PUT /api/doc/<brand>/<slug> — with baseSha |
| Propose a rewrite | POST /api/rewrite/<brand>/<slug> |
| Accept a proposal | POST /api/rewrite/<brand>/<slug>/accept |
| Semantic diff | GET /api/diff/<brand>/<slug>?base=&head= |
| Render committed PDF | GET /api/render/<brand>/<slug>?ref= |
| Preview unsaved | POST /api/preview/<brand>/<slug> |
| Read status (agents allowed) | GET /api/status/<brand>/<slug> |
| Status transitions (human-only) | POST /api/status/<brand>/<slug> — authenticated human session required, not an agent bearer token. |
| Restore old version | POST /api/restore/<brand>/<slug> |
| Brand config / assets | GET · PUT /api/brand/<brand>/configPUT /api/brand/<brand>/assets/<file> |
The expected edit loop
For agent rewrites, use propose → accept rather than a raw PUT. The proposal is held in memory until accepted. Accepting a proposal commits content; it does not record human review or approve or release the document. Have a human inspect the changes; only an authenticated human session can change review status.
PUT is fine for a new document or a verbatim mechanical edit. For "improve this," use propose → accept.Status codes worth knowing
| 409 | Stale write, invalid transition, or restore no-op. Re-read, reconcile, don't retry blind. |
| 422 | Vocabulary validation failed. diagnostics names the block. |
| 502 | Render pipeline error. Not a content problem. |
Path C — CLI
The CLI is useful for local authoring, validation before commit, and render preview. Requires pandoc 3.x, WeasyPrint 60+, Node 20+.
--renderer chrome swaps WeasyPrint for headless Chrome if you prefer.
Known gaps
- No remote doctype/template listing. Use
GET /api/docs/<brand>to see what doctypes exist — the values returned are the practical proxy. - No brand creation endpoint. Brands are provisioned manually today.
- Tokens are issued by an operator, not self-serve. Self-serve issuance is on the roadmap.