REST API Reference
The 36 REST routes of the Dock document workspace API, grouped by capability area. Standard HTTP under /api/d/*, callable from any language.
The REST API lives under /api/d/* on https://app.agentdock.ai. It is plain HTTP, so any language or backend that can make a request can use it. Authenticate with the x-api-key header (see Authentication).
curl https://app.agentdock.ai/api/d \
-H "x-api-key: ak_usr_YOUR_TOKEN"All paths below are relative to /api/d. There are 36 routes across eight areas.
| Method | Path | Does |
|---|---|---|
GET | / | List your documents, newest first |
POST | / | Create a new blank document |
GET | /{id} | Read a document (JSON by default; Accept: text/markdown for markdown, ?format=nodes for the node list) |
PATCH | /{id} | Update content, title, or the document's citation style |
DELETE | /{id} | Delete a document |
POST | /{id}/duplicate | Copy a document |
PATCH | /{id}/move | Move a document to a folder, or to the root |
POST | /import-url | Import a web page as a new editable document |
The GET /{id} route returns the structured editor document as JSON by default. Send an Accept: text/markdown header to get the document as markdown text, or pass ?format=nodes to get a flat node list with stable node IDs for targeted edits. A PATCH /{id} body can carry markdown to replace content, title to rename, or citationStyle to set the bibliography style for that document.
| Method | Path | Does |
|---|---|---|
POST | /{id}/publish | Publish to a public /p/slug page with SEO metadata |
DELETE | /{id}/publish | Unpublish, reverting to a private draft |
The publish body accepts an optional slug, seoTitle, seoDescription, and an isListed flag for an unlisted page. Omit them and the server derives a slug and metadata from the document.
| Method | Path | Does |
|---|---|---|
GET | /{id}/suggestions | List pending suggestions on a document |
DELETE | /{id}/suggestions/{sid} | Reject a suggestion (discard without applying) |
POST | /{id}/suggestions/{sid}/accept | Accept a suggestion (apply the change) |
A suggestion is proposed by writing to the document in suggest mode rather than direct mode; see Writing Modes. These three routes are how a reviewer works through the pending list.
| Method | Path | Does |
|---|---|---|
GET | /folders | List your folders |
POST | /folders | Create a folder |
PATCH | /folders/{folderId} | Rename or move a folder |
DELETE | /folders/{folderId} | Delete a folder (its documents move to the root) |
| Method | Path | Does |
|---|---|---|
GET | /{id}/versions | List version history metadata |
GET | /{id}/versions/{vid} | Read a specific past version |
Every write creates a version, and each version records whether a human or an agent made it, plus the model name when it was automated.
Citations span three groups: in a document, in your reusable library, and in collections.
In a document
| Method | Path | Does |
|---|---|---|
GET | /{id}/cite | List the citations in a document |
POST | /{id}/cite | Add a citation by DOI, URL, PMID, or arXiv ID |
DELETE | /{id}/cite/{cid} | Remove a citation from a document |
GET | /cite/search | Search academic sources to cite |
Library
| Method | Path | Does |
|---|---|---|
GET | /citations | List saved citations in your library |
POST | /citations | Save a citation to your library |
GET | /citations/{citationId} | Read a saved citation |
DELETE | /citations/{citationId} | Delete a saved citation |
GET | /citations/search | Full-text search your library |
POST | /citations/format | Format a citation in a style (preview, no save) |
Collections
| Method | Path | Does |
|---|---|---|
GET | /citation-collections | List your citation collections |
POST | /citation-collections | Create a collection |
DELETE | /citation-collections/{collectionId} | Delete a collection |
POST | /citation-collections/{collectionId}/citations | Add a citation to a collection |
DELETE | /citation-collections/{collectionId}/citations/{citationId} | Remove a citation from a collection |
Citations format in seven academic styles: APA, MLA, Chicago, Harvard, IEEE, AMA, and Vancouver.
| Method | Path | Does |
|---|---|---|
GET | /prompts | List your personal and system prompts |
GET | /prompts/{promptId} | Read a prompt by ID |
So an agent can pull a saved prompt instead of improvising one.
Setting the per-document citation style is the document settings operation. It is a field on the document update rather than its own endpoint:
curl -X PATCH https://app.agentdock.ai/api/d/{id} \
-H "x-api-key: ak_usr_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"citationStyle": "IEEE"}'Routes return JSON. A successful create returns the new resource (with its id), a publish returns the public url and slug, and a list returns an array under a named key (documents, folders, citations, and so on). A request that uses a verb outside your key's scopes, or reaches a document a document-scoped token is not bound to, is rejected. See Authentication for scopes.
- CLI Reference: the same surface as terminal commands
- Writing Modes: direct write vs suggest
- Examples and Workflows: end-to-end recipes